/usr/include/sipxtapi/rtcp/RTCPTimer.h is in libsipxtapi-dev 3.3.0~test17-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | //
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
// Border Guard
#ifndef _RTCPTimer_h
#define _RTCPTimer_h
#include "rtcp/RtcpConfig.h"
// Includes
#ifndef WIN32
#include <time.h>
#endif
#include "IRTCPConnection.h"
#include "IRTCPSession.h"
#ifdef __pingtel_on_posix__
#include "os/OsTime.h"
#include "os/OsCallback.h"
#include "os/OsTimer.h"
#endif
// Defines
#define MILLI2SECS 1000
#define MILLI2NANO 1000000
/**
*
* Class Name: CRTCPTimer
*
* Inheritance: CBaseClass - Generic Base Class
*
*
* Interfaces: IRTCPTimer - RTP Header Interface
*
* Description: The CRTCPTimer is a class that implements a renewable timer
* used to signal the periodic generation of RTCP Reports.
*
* Notes:
*
*/
class CRTCPTimer
{
// Public Methods
public:
/**
*
* Method Name: CRTCPTimer() - Constructor
*
*
* Inputs: unsigned long ulTimerPeriod - Amount of time to run before alarming
*
* Outputs: None
*
* Returns: None
*
* Description: Performs routine CRTCPTimer object initialization.
*
* Usage Notes: The argument passed in the constructor list shall be
* stored as an attribute and used establish the alarm period.
*
*
*/
CRTCPTimer(unsigned long ulTimerPeriod);
/**
*
* Method Name: ~CRTCPTimer() - Destructor
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: None
*
* Description: Shall deallocate and/or release all resources which were
* acquired over the course of runtime.
*
* Usage Notes: This shall override the virtual destructor in the base class so
* that deallocation specific to the derived class will be done
* despite the destruction being performed in the base class as
* part of the release.
*
*/
virtual ~CRTCPTimer(void);
/**
*
* Method Name: CRTCPTimer::Initialize
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: Boolean True/False
*
* Description: Create a timer thread that shall wakeup periodically and
* perform some operation and go back to sleep.
*
* Usage Notes: This shall override the virtual destructor in the base class so
* that deallocation specific to the derived class will be done
* despite the destruction being performed in the base class as
* part of the release.
*
*/
bool Initialize(void);
/**
*
* Method Name: SetReportTimer
*
*
* Inputs: unsigned long ulTimerPeriod
* - Number of milliseconds to elapse before alarming
*
* Outputs: None
*
* Returns: None
*
* Description: The SetReportTimer method sets a timer to expire at a
* specified period.
*
*
* Usage Notes:
*
*
*/
virtual void SetReportTimer(unsigned long ulTimerPeriod);
/**
*
* Method Name: GetReportTimer
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Number of milliseconds to elapse before alarming
*
* Description: The GetReportTimer method returns the value of the report timer.
*
* Usage Notes:
*
*/
virtual unsigned long GetReportTimer(void);
/**
*
* Method Name: RTCPReportingAlarm
*
*
* Inputs: IRTCPConnection *piRTCPConnection
* - Interface to associated RTCP Connection
* IRTCPSession *piRTCPSession
* - Interface to associated RTCP Session
*
* Outputs: None
*
* Returns: None
*
* Description: The RTCPReportingAlarm() event method shall inform the
* recipient of the expiration of the RTCP Reporting Timer. This
* signals the generation of the next round of RTCP Reports.
*
* Usage Notes: This method shall be overloaded by the superior class.
*
*
*/
virtual void RTCPReportingAlarm(IRTCPConnection *piRTCPConnection=NULL,
IRTCPSession *piRTCPSession=NULL) {};
protected: // Protected Methods
/**
*
* Method Name: Shutdown
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: Boolean True/False
*
* Description: Perform RTCPTimer shutdown operations in preparation for
* terminating the network interface.
*
* Usage Notes:
*
*
*/
bool Shutdown(void);
private: // Private Methods
#ifdef WIN32 /* [ */
/**
*
* Method Name: CRTCPTimer::CreateTimerThread
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: Boolean True/False
*
* Description: Creates the Timer Processing Thread. This thread shall be
* responsible for generating a periodic event to signal the
* commencement of a new reporting period.
*
* Usage Notes:
*
*
*/
bool CreateTimerThread(void);
/**
*
* Method Name: CRTCPTimer::TimerThreadProc
*
*
* Inputs: void * lpParameter - An opaque element
*
* Outputs: None
*
* Returns: unsigned long
*
* Description: A static method that shall wake up periodically and perform
* some unit of work.
*
* Usage Notes:
*
*
*/
static unsigned int __stdcall TimerThreadProc(void * lpParameter);
#elif defined(_VXWORKS) /* ] [ */
/**
*
* Method Name: ReportingAlarm
*
*
* Inputs: timer_t tTimer - Timer Handle
* int iArgument - Argument associated with alarming timer
*
* Outputs: None
*
* Returns: None
*
* Description: A static method that be called by a vxWorks timer object when
* a previously established time has expired and is alarming.
*
* Usage Notes:
*
*
*/
static void ReportingAlarm(timer_t tTimer, intptr_t iArgument);
#elif defined(__pingtel_on_posix__) /* ] [ */
static void ReportingAlarm(const intptr_t userData, const intptr_t eventData);
#endif /* ] */
private: // Private Data Members
/**
*
* Attribute Name: m_ulTimerPeriod
*
* Type: unsigned long
*
* Description: This member shall store the RTCP Report Period value
* used to set the timer.
*
*/
unsigned long m_ulTimerPeriod;
#ifdef _VXWORKS /* [ */
struct itimerspec m_stTimeout;
#endif /* ] */
#ifdef WIN32 /* [ */
/**
*
* Attribute Name: m_hTerminateEvent
*
* Type: HANDLE
*
* Description: Event Handle used to signal the termination of the timer
* thread created when running in a Windows environment.
*
*/
HANDLE m_hTerminateEvent;
/**
*
* Attribute Name: m_hTimerThread
*
* Type: HANDLE
*
* Description: Thread Handle used to identify the timer thread
* created when running in a Windows environment.
*
*/
HANDLE m_hTimerThread;
#elif defined(_VXWORKS) /* ] [ */
/**
*
* Attribute Name: m_tTimer
*
* Type: timer_t
*
* Description: Timer ID used to identify a timer resource under vxWorks.
*
*/
timer_t m_tTimer;
#elif defined(__pingtel_on_posix__)
OsTime * m_pTimeout;
OsCallback * m_pCallback;
OsTimer * m_pTimer;
#endif /* ] */
};
/**
*
* Method Name: SetReportTimer
*
*
* Inputs: unsigned long ulTimerPeriod - Number of mSec between alarms
*
* Outputs: None
*
* Returns: None
*
* Description: The SetReportTimer method sets a timer to expire at a
* specified period.
*
* Usage Notes:
*
*/
inline void CRTCPTimer::SetReportTimer(unsigned long ulTimerPeriod)
{
m_ulTimerPeriod = ulTimerPeriod;
#ifdef _VXWORKS /* [ */
// Set the next fire value
m_stTimeout.it_value.tv_sec = ulTimerPeriod / MILLI2SECS;
m_stTimeout.it_value.tv_nsec = (ulTimerPeriod % MILLI2SECS) * MILLI2NANO;
// Set the next fire interval (period timer) as the value
m_stTimeout.it_interval.tv_sec = ulTimerPeriod / MILLI2SECS;
m_stTimeout.it_interval.tv_nsec = (ulTimerPeriod % MILLI2SECS) * MILLI2NANO;
#endif /* ] */
}
/**
*
* Method Name: GetReportTimer
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Number of milliseconds to elapse before alarming
*
* Description: Returns the value of the report timer.
*
* Usage Notes:
*
*/
inline unsigned long CRTCPTimer::GetReportTimer(void)
{
return(m_ulTimerPeriod);
}
#endif
|