/usr/include/sipxtapi/rtcp/RTCPHeader.h is in libsipxtapi-dev 3.3.0~test17-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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | //
// Copyright (C) 2006-2013 SIPez LLC. All rights reserved.
//
// 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 _RTCPHeader_h
#define _RTCPHeader_h
#include "rtcp/RtcpConfig.h"
// Includes
#include "BaseClass.h"
#include "IRTCPHeader.h"
// Defines
#define MAX_SOURCE_LENGTH 256 // Max Length of a NULL terminated SDES element
#define HEADER_LENGTH 8 // Header Size
#define PAYLOAD_OFFSET 1
#define LENGTH_OFFSET 2
#define SSRC_OFFSET 4
#define COUNT_MASK 0x1F
/**
*
* Class Name: CRTCPHeader
*
* Inheritance: CBaseClass - Base Class Implementation
*
*
* Interfaces: IRTCPHeader - Services for loading and extracting RTCP header
* info.
*
* Description: The CRTCPHeader Class manages the basic header and structure
* information associated with an RTCP report.
*
* Notes: The CRTCPHeader is inherited by all RTCP Report objects.
*
*/
class CRTCPHeader
{
// Public Methods
public:
/**
*
* Method Name: CRTCPHeader() - Constructor
*
*
* Inputs: unsigned long ulSSRC
* - The the Identifier for this source
* RTCP_REPORTS_ET etPayloadType
* - The Payload type associated with this report
* unsigned long ulVersion
* - Version of the RFC Standard being followed
*
*
* Outputs: None
*
* Returns: None
*
* Description: The CRTCPHeader is an abstract class that is initialized by
* a derived object at construction time.
*
* Usage Notes:
*
*/
CRTCPHeader(ssrc_t ulSSRC,
RTCP_REPORTS_ET etPayloadType,
unsigned long ulVersion=2);
/**
*
* Method Name: ~CRTCPHeader() - Destructor
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: None
*
* Description: Shall deallocated and/or release all resources which was
* acquired over the course of runtime.
*
* Usage Notes:
*
*
*/
virtual ~CRTCPHeader(void);
/**
*
* Method Name: VetPacket
*
*
* Inputs: unsigned char *buffer - Data Buffer received from Network Source
* int bufferLen - Length of Data Buffer
*
* Outputs: OsSysLog messages
*
* Returns: int: length of valid RTCP packet; may be 0 (first chunk not valid,
* or any multiple of 4 up to as much as 3 larger than the input length.
* (e.g. 61, 62, or 63 may return 64).
*
* Description: VetPacket() walks the headers in the report chunks in a received
* RTCP packet applying various sanity checks. It is to be called
* before calling ProcessPacket so that ProcessPacket (and its
* subsidiaries) can assume a degree of basic correctness.
*
* In order to fix up for a relatively harmless deviation from
* the RFC, if the length of the packet as read from the socket
* is not a multiple of 4, this routine will write 0 to the
* 1, 2, or 3 bytes following the end of the packet and then
* round the length up to that next multiple of 4 before walking
* the chunks.
*
* After making sure that the length is a multiple of 4, the
* headers will be walked. The checks are
* 1. The first two bits each header must be 0b10 (RTCP ver 2)
* 2. The PT is in the range 200..204; if not, emit warning
* 3. The length indicates that the chunk ends within the packet
* data, and either 8 or more bytes from the end, or exactly
* at the end.
*
*/
static int VetPacket(unsigned char* buffer, int bufferLen);
/**
*
* Method Name: GetHeaderLength
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Returns the size of the RTCP Header
*
* Description: Retrieves the size of the RTCP Header that preceeds
* the payload.
*
* Usage Notes:
*
*
*/
virtual unsigned long GetHeaderLength(void);
/**
*
* Method Name: GetVersion
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Returns the Version
*
* Description: Retrieves the Version attribute stored within the object.
*
* Usage Notes:
*
*
*/
virtual unsigned long GetVersion(void);
/**
*
* Method Name: GetPadding
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Returns the Padding Flag
*
* Description: Retrieves the Padding attribute stored within the object.
*
* Usage Notes:
*
*
*/
virtual unsigned long GetPadding(void);
/**
*
* Method Name: GetPayload
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: RTCP_REPORTS_ET - Returns the Payload Type
*
* Description: Retrieves the payload type associated with this RTCP report.
*
* Usage Notes:
*
*
*/
virtual RTCP_REPORTS_ET GetPayload(void);
/**
*
* Method Name: GetReportCount
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Returns the Report Count
*
* Description: Retrieves the report count associated with this RTCP report.
*
* Usage Notes:
*
*
*/
virtual unsigned long GetReportCount(void);
/**
*
* Method Name: GetReportlength
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Returns the Report Length
*
* Description: Retrieves the report length associated with this RTCP report.
*
* Usage Notes:
*
*
*/
virtual unsigned long GetReportLength(void);
/**
*
* Method Name: GetSSRC
*
*
* Inputs: None
*
* Outputs: None
*
* Returns: unsigned long - Return the SSRC IDt
*
* Description: Retrieves the SSRC attribute stored within the object.
*
* Usage Notes:
*
*
*/
virtual ssrc_t GetSSRC(void);
/**
*
* Method Name: SetSSRC
*
*
* Inputs: unsigned long ulSSRC - Source ID
*
* Outputs: None
*
* Returns: void
*
* Description: Stores the Source Identifier associated with an RTP connection.
*
* Usage Notes:
*
*
*
*/
virtual void SetSSRC(ssrc_t ulSSRC);
/**
*
* Method Name: IsOurSSRC
*
*
* Inputs: ssrc_t ulSSRC - SSRC ID
*
* Outputs: None
*
* Returns: boolean
*
* Description: Compares the SSRC ID passed to that stored as an attribute
* within this object instance. Will return either True or
* False based on the match.
*
* Usage Notes:
*
*
*/
virtual bool IsOurSSRC(ssrc_t ulSSRC);
protected: // Protected Methods
/**
*
* Method Name: FormatRTCPHeader
*
*
* Inputs: unsigned long ulPadding - Padding used
* unsigned long ulCount - Report Count
* unsigned long ulPayloadLength - Payload Length (Excluding Header)
*
* Outputs: unsigned char *puchRTCPBuffer
* - Buffer used to store the RTCP Report Header
*
* Returns: unsigned long
* - Returns the number of octets written into the buffer.
*
* Description: Constructs an RTCP Report report using information stored
* and passed by the caller.
*
* Usage Notes: A buffer of sufficient size should be allocated and passed
* to this formatting method.
*
*
*/
unsigned long FormatRTCPHeader(unsigned char *puchRTCPBuffer,
unsigned long ulPadding,
unsigned long ulCount,
unsigned long ulPayloadLength);
/**
*
* Method Name: ParseRTCPHeader
*
*
* Inputs: unsigned char *puchRTCPBuffer
* - Character Buffer containing the contents of the RTCP Report
*
* Outputs: None
*
* Returns: bool
*
* Description: Extracts the header contents of an RTCP report using the
* buffer passed in by the caller. The header will be validated
* to determine whether it has an appropriate version, payload
* type, and SSRC for this object.
*
* Usage Notes:
*
*
*/
bool ParseRTCPHeader(unsigned char *puchRTCPBuffer);
protected: // Protected Data Members
/**
*
* Attribute Name: m_ulVersion
*
* Type: unsigned long
*
* Description: The protocol version of the RTCP Report.
*
*/
unsigned long m_ulVersion;
/**
*
* Attribute Name: m_ulPadding
*
* Type: unsigned long
*
* Description: A flag identifying the use of padding within an RTCP report.
*
*/
unsigned long m_ulPadding;
/**
*
* Attribute Name: m_ulCount
*
* Type: unsigned long
*
* Description: The number of composite records contained with an RTCP report.
*
*/
unsigned long m_ulCount;
/**
*
* Attribute Name: m_etPayloadType
*
* Type: RTCP_REPORTS_ET
*
* Description: The RTCP Payload type.
*
*/
RTCP_REPORTS_ET m_etPayloadType;
/**
*
* Attribute Name: m_ulLength
*
* Type: unsigned long
*
* Description: The RTCP Report Length.
*
*/
unsigned long m_ulLength;
/**
*
* Attribute Name: m_ulSSRC
*
* Type: unsigned long
*
* Description: This member shall store the SSRC ID of the associated
* RTP connection.
*
*/
unsigned long m_ulSSRC;
};
#endif
|