This file is indexed.

/usr/include/sipxtapi/rtcp/RTCPSource.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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
//
// 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 _RTCPSource_h
#define _RTCPSource_h

#include "rtcp/RtcpConfig.h"

//  Includes
#include "TLinkedList.h"
#include "RTCPHeader.h"
#include "ByeReport.h"
#include "SenderReport.h"
#include "ReceiverReport.h"
#include "SourceDescription.h"
#include "IRTCPStatistics.h"
#include "INetDispatch.h"
#include "IRTCPNotify.h"

#ifdef __pingtel_on_posix__
#include <netinet/in.h>
#endif

/**
 *
 * Class Name:  CRTCPSource
 *
 * Inheritance: CBaseClass           - Base Class Implementation
 *
 *
 * Interfaces:  INetDispatch,        - RTCP Report Input Interface
 *              IRTCPStatistics      - RTCP Statistics Retrieval Interface
 *
 * Description: The CRTCPSource Class coordinates the processing and generation
 *              of RTCP reports corresponding to an inbound RTP connection from
 *              a call participant.
 *
 * Notes:       CRTCPSource is derived from CBaseClass which provides basic
 *              Initialization and reference counting support.
 *
 */
class CRTCPSource:
         public CBaseClass,        // Inherits CBaseClass implementation
         public INetDispatch,      // RTCP Report Input Interface
         public IRTCPStatistics    // RTCP Statistics Retrieval Interface
 {

//  Public Methods
public:

/**
 *
 * Method Name:  CRTCPSource() - Constructor
 *
 *
 * Inputs:   ssrc_t          ulSSRC
 *                                    - The the Identifier for this source
 *           IRTCPNotify            *piRTCPNotify
 *                                    - RTCP Event Notification Interface
 *           ISetReceiverStatistics *piSetStatistics
 *                                    - Interface for setting receiver stats
 *
 * Outputs:  None
 *
 * Returns:  None
 *
 * Description:  Performs routine CRTCPSource object initialization include
 *               assignment of constructor arguments to internal attributes.
 *
 * Usage Notes:  It is assumed the the pointer obtained during CRTCPSource
 *               object construction shall be used in the construction or
 *               initialization of the Network Source, RTP Source, and RTCP
 *               Sender objects associated with an inbound RTP connection.
 *
 */
    CRTCPSource(ssrc_t ulSSRC, IRTCPNotify *piRTCPNotify,
                ISetReceiverStatistics *piSetStatistics);


/**
 *
 * Method Name: ~CRTCPSource() - Destructor
 *
 *
 * Inputs:      None
 *
 * Outputs:     None
 *
 * Returns:     None
 *
 * Description: Shall deallocated and/or release all resources which was
 *              acquired over the course of runtime.  In particular, the
 *              following shall occur:
 *                ==> The queue containing remote RTCP Source Description
 *                    objects shall be drained with the reference to each
 *                    object released.
 *                ==> The reference to the remote Source Report object shall
 *                    be released
 *                ==> The reference to the remote Receiver Report object shall
 *                    be released
 *
 * 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 ~CRTCPSource(void);

/**
 *
 * Method Name: ProcessPacket
 *
 *
 * Inputs:   unsigned char *puchDataBuffer
 *                            - Data Buffer received from Network Source
 *           unsigned long ulBufferLength
 *                            - Length of Data Buffer
 *
 * Outputs:  None
 *
 * Returns:  None
 *
 * Description: The ProcessPacket() sequentially processes data packets
 *              received by looking for for header information that describes
 *              the single or composite RTCP report sent.  The RTCP Payload
 *              type of each header found is examined.  A packet or a composite
 *              portion is discarded if it the header not contain a valid RTCP
 *              Payload Type (Types 200 - 204).  The packet or composite
 *              portion is then routed by Payload type to the associated
 *              Sender, Receiver Source Description, or Bye method for further
 *              report processing. This iterative process continues until a
 *              packet or composite has been full processed.
 *
 *
 * Usage Notes: The intention is for this method to be processed on the
 *              Execution thread of the Network Dispatcher.  This may be
 *              modified if RTCP processing is interferring with the
 *              Dispatcher's ability to receive and route high volume RTP
 *              packets.
 *
 *
 */
    void ProcessPacket(unsigned char *puchDataBuffer,
                       unsigned long ulBufferLength, int verbose=0);

/**
 *
 * Macro Name:  DECLARE_IBASE_M
 *
 *
 * Inputs:      None
 *
 * Outputs:     None
 *
 * Returns:     None
 *
 * Description: This implements the IBaseClass functions used and exposed by
 *              derived classes.
 *
 * Usage Notes:
 *
 *
 */
DECLARE_IBASE_M

private:        // Private Methods


/**
 *
 * Method Name: SendRTCPEvent
 *
 *
 * Inputs:   ulong ulEventType    - Event Type
 *           void  *pvInterface   - Opaque pointer to an associated interface
 *           ulong ulChangeMask   - Optional mask for SDES Changes
 *
 * Outputs:  None
 *
 * Returns:  None
 *
 * Description: A centralized processing method that will dispatch events to
 *              all subscribing parties based on their registered interest.
 *
 *
 * Usage Notes: This centralized event generation mechanism is useful in
 *              dispatching events to multiple subscribers.  This avoid the
 *              duplication of code in each method that might cause an event
 *              to be generated.
 *
 *
 */
    void SendRTCPEvent(unsigned long ulEventType,
                       void  *pvInterface,
                       unsigned long ulChangeMask=0);

/**
 *
 * Method Name: ProcessSenderReport
 *
 *
 * Inputs:   unsigned char *puchRTCPReport - A pointer to an RTCP Sender Report
 *
 * Outputs:  None
 *
 * Returns:  unsigned long
 *
 * Description: Takes the RTCP Sender Report passed and calls the CSenderReport
 *              object's ISenderReport interface to parse the Sender packet and
 *              extract the sender statistics contained therein.  This method
 *              shall also check for the presence of receiver reports within
 *              the packet and call the CReceiverReport object's
 *              IReceiverReport interface to parse and extract its contents.
 *              Although no more than one receiver report is expected under the
 *              current Pingtel call model, it is possible that multiple
 *              receiver reports (one per PingTel source) may be sent.  In this
 *              case,  a new CReceiverReport object shall be created and queued
 *              if not already existing on the Receiver Report list.
 *
 *
 * Usage Notes: Notifications shall be generated to all subscribing parties to
 *              inform them of the receipt of a new Source Report.
 *              The notification shall contain the event type and a pointer to
 *              the Source Report's IGetSenderStatistics interface.
 *
 *
 */
    unsigned long ProcessSenderReport(unsigned char *puchRTCPReport);


/**
 *
 * Method Name: ProcessReceiverReport
 *
 *
 * Inputs:   unsigned char *puchRTCPReport
 *                                       - A pointer to an RTCP Receiver Report
 *           unsigned long ulReportCount - An optional report count
 *
 * Outputs:  None
 *
 * Returns:  unsigned long
 *
 * Description: Takes the RTCP Receiver Report passed and calls the
 *              CReceiverReport object's IReceiverReport interface to parse the
 *              Receiver packet and extract the receiver statistics contained
 *              therein.  Although no more than one receiver report is expected
 *              under the current Pingtel call model, it is possible that
 *              multiple receiver reports (one per PingTel source) may be sent.
 *              In this case, a new CReceiverReport object shall be created and
 *              queued if not already existing on the Receiver Report list.
 *
 *
 * Usage Notes: Notifications shall be generated to all subscribing parties to
 *              inform them of the receipt of a new Receiver Report.
 *              The notification shall contain the event type and a pointer to
 *              the Receiver Report's IGetReceiverStatistics interface.
 *
 *
 */
    unsigned long ProcessReceiverReport(unsigned char *puchRTCPReport,
                                        unsigned long ulReportCount = 0);


/**
 *
 * Method Name: ProcessSDESReport
 *
 *
 * Inputs:   unsigned char *puchRTCPReport
 *                            - A pointer to an RTCP Source Description Report
 *
 * Outputs:  None
 *
 * Returns:  unsigned long
 *
 * Description: Takes the RTCP SDES Report passed and calls the
 *              CSourceDescription object's ISDESReport interface to parse the
 *              Source Description packet and extract the identification
 *              information contained therein.
 *
 *
 * Usage Notes: A call connection to a Mixer would cause all SDES Reports to be
 *              forward as multiple SDES Reports. In this case, a new
 *              CSourceDescription object shall be created and queued if not
 *              already existing on the SrcDescription list.  The SSRC ID will
 *              be used to determine uniqueness among reports.
 *
 *              Notifications shall be generated to all subscribing parties to
 *              inform them of the new Source Descriptions or changes in
 *              previously existing Source Descriptions.  The notification
 *              shall contain the event type and a pointer to the new or
 *              modified Source Description interface (IGetSrcDescription).
 */
    unsigned long ProcessSDESReport(unsigned char *puchRTCPReport);

/**
 *
 * Method Name: ProcessByeReport
 *
 *
 * Inputs:   unsigned char *puchRTCPReport - A pointer to an RTCP Bye Report
 *
 * Outputs:  None
 *
 * Returns:  unsigned long
 *
 * Description: Takes the RTCP Bye Report and extracts the associated SSRC ID.
 *              A notification shall be generated to all subscribing parties
 *              to inform them of the receipt of the BYE along with the
 *              associated SSRC ID.
 *
 *
 * Usage Notes:
 *
 *
 */
    unsigned long ProcessByeReport(unsigned char *puchRTCPReport);


/**
 *
 * Method Name: ProcessAppReport
 *
 *
 * Inputs:   unsigned char *puchRTCPReport
 *                               - A pointer to an RTCP Application Report
 *
 * Outputs:  None
 *
 * Returns:  unsigned long
 *
 * Description: No processing is performed on an Application Report but the
 *              length is extracted from the header and returned so that other
 *              composite reports might still be processed.
 *
 *
 * Usage Notes:
 *
 *
 */
    unsigned long ProcessAppReport(unsigned char *puchRTCPReport);


/**
 *
 * Method Name:  GetStatistics
 *
 *
 * Inputs:   None
 *
 * Outputs:  IGetSrcDescription     **piGetSrcDescription
 *                                      - Source Description Interface Pointer
 *           IGetSenderStatistics   **piSenderStatistics
 *                                      - Sender Statistics Interface Pointer
 *           IGetReceiverStatistics **piReceiverStatistics
 *                                      - Receiver Statistics Interface Pointer
 *           IByeInfo               **piGetByeInfo -
 *                                     Interface for retrieving Bye Report Info
 *
 *
 * Returns:  None
 *
 * Description:  Returns pointers to the Sender,Receiver and Bye statistics
 *              interfaces upon request.
 *
 * Usage Notes:  This would be used by the QOS object or the RTCP Statistics
 *              object if a polling method were supported.  These objects could
 *              alternatively be informed of statistic changes via notification
 *              with the interfaces contained within the callback.
 *
 *
 */
    void GetStatistics(IGetSrcDescription     **piGetSrcDescription,
                       IGetSenderStatistics   **piSenderStatistics,
                       IGetReceiverStatistics **piReceiverStatistics,
                       IGetByeInfo            **piGetByeInfo);

/**
 *
 * Method Name: GetPayloadType
 *
 *
 * Inputs:      unsigned char *puchDataBuffer   - RTCP Buffer
 *
 * Outputs:     None
 *
 * Returns:     RTCP_REPORTS_ET                 - Returns Payload Type
 *
 * Description: Returns the payload type value associated with the RTCP packet.
 *
 * Usage Notes:
 *
 *
 */
    RTCP_REPORTS_ET GetPayloadType(unsigned char *puchRTCPBuffer);


/**
 *
 * Method Name: GetSenderSSRC
 *
 *
 * Inputs:   bool bHeader        - TRUE implies presence of an RTCP Header
 *           unsigned char *puchRTCPBuffer  - RTCP Buffer
 *
 * Outputs:  None
 *
 * Returns:  ssrc_t                   - Returns Sender's SSRC
 *
 * Description: Returns the Sender's SSRC.
 *
 * Usage Notes:
 *
 *
 */
    ssrc_t GetSenderSSRC(bool bHeader, unsigned char *puchRTCPBuffer);


/**
 *
 * Method Name: GetReceiverSSRC
 *
 *
 * Inputs:   bool BRTCPHeader    - TRUE implies presence of an RTCP Header
 *           unsigned char *puchRTCPBuffer   - RTCP Buffer
 *
 * Outputs:  None
 *
 * Returns:  ssrc_t       - Returns Receiver's SSRC
 *
 * Description: Returns the Receiver's SSRC.
 *
 * Usage Notes:
 *
 *
 */
    ssrc_t GetReceiverSSRC(bool bRTCPHeader,
                                  unsigned char *puchRTCPBuffer);

/**
 *
 * Method Name: GetReportCount
 *
 *
 * Inputs:      unsigned char *puchRTCPBuffer   - RTCP Buffer
 *
 * Outputs:     None
 *
 * Returns:     unsigned long                   - Returns Report Count
 *
 * Description: Returns the RTCP Report Count.
 *
 * Usage Notes:
 *
 *
 */
    unsigned long GetReportCount(unsigned char *puchRTCPBuffer);


/**
 *
 * Method Name: GetReportLength
 *
 *
 * Inputs:      unsigned char *puchRTCPBuffer   - RTCP Buffer
 *
 * Outputs:     None
 *
 * Returns:     unsigned long                   - Returns Report Length
 *
 * Description: Returns the RTCP Report Length.
 *
 * Usage Notes:
 *
 *
 */
    unsigned long GetReportLength(unsigned char *puchRTCPBuffer);


private:        // Private Data Members

/**
 *
 * Attribute Name:  m_ulSSRC
 *
 * Type:            ssrc_t
 *
 * Description:  This member shall store the SSRC ID of the associated RTP
 *               connection.
 *
 */
      ssrc_t m_ulSSRC;


/**
 *
 * Attribute Name:  m_piRTCPNotify
 *
 * Type:            IRTCPNotify *
 *
 * Description:  This member shall contain the interface for delivering
 *               notification to a registered consumer.
 *
 */
      IRTCPNotify * m_piRTCPNotify;


/**
 *
 * Attribute Name:  m_piSetReceiverStatistics
 *
 * Type:            ISetReceiverStatistics
 *
 * Description:  Interface used by the Sender Report of an associated inbound
 *               RTP connection to update SR timestamp information within the
 *               corresponding Receiver Report.
 *
 */
      ISetReceiverStatistics *m_piSetReceiverStatistics;

/**
 *
 * Attribute Name:  m_tSrcDescriptorList
 *
 * Type:            CTLinkedList
 *
 * Description:  This member shall store the one or more SrcDescription objects
 *               representing unique RTCP SDES reports received.  More than one
 *               SDES report may result when connected to an audio mixer.
 *
 */
      CTLinkedList<CSourceDescription *> m_tSrcDescriptorList;


/**
 *
 * Attribute Name:  m_tReceiverReportList
 *
 * Type:            CTLinkedList
 *
 * Description:  This member shall store the one or more Receiver Report
 *               objects representing unique RTP sources associated with
 *               this call site.  Each object will store/extract RTCP
 *               Receiver Report statistics associated with that source (SSRC).
 *
 */
      CTLinkedList<CReceiverReport *> m_tReceiverReportList;

/**
 *
 * Attribute Name:  m_poSenderReport
 *
 * Type:            CSenderReport *
 *
 * Description:  This member shall contain a pointer to a Sender report object
 *               used to store/extract elements of a call participant's RTCP
 *               Sender Report.
 *
 */
      CSenderReport *m_poSenderReport;

/**
 *
 * Attribute Name:  m_poByeReport
 *
 * Type:            CByeReport *
 *
 * Description:  This member shall contain a pointer to a Bye report object
 *               used to store/extract elements of a call participant's RTCP
 *               Bye Report.
 *
 */
      CByeReport *m_poByeReport;

};


/**
 *
 * Method Name: GetPayloadType
 *
 *
 * Inputs:      unsigned char *puchDataBuffer   - RTCP Buffer
 *
 * Outputs:     None
 *
 * Returns:     RTCP_REPORTS_ET                 - Returns Payload Type
 *
 * Description: Returns the payload type value associated with the RTCP packet.
 *
 * Usage Notes:
 *
 *
 */
inline RTCP_REPORTS_ET
            CRTCPSource::GetPayloadType(unsigned char *puchRTCPBuffer)
{

//  Snoop into the packet header and return the payload type
    return((RTCP_REPORTS_ET)*(puchRTCPBuffer + PAYLOAD_OFFSET));

}


/**
 *
 * Method Name: GetSenderSSRC
 *
 *
 * Inputs:      unsigned char *puchRTCPBuffer   - RTCP Buffer
 *
 * Outputs:     None
 *
 * Returns:     ssrc_t                   - Returns Sender's SSRC
 *
 * Description: Returns the Sender's SSRC.
 *
 * Usage Notes:
 *
 *
 */
inline ssrc_t CRTCPSource::GetSenderSSRC(bool bRTCPHeader, unsigned char *puchRTCPBuffer)
{

//  Advance over RTCP Header if one exists
    if(bRTCPHeader)
        puchRTCPBuffer += SSRC_OFFSET;

//  Return Sender SSRC
    return(ntohl(*((ssrc_t *)puchRTCPBuffer)));

}


/**
 *
 * Method Name: GetReceiverSSRC
 *
 *
 * Inputs:   bool BRTCPHeader      - TRUE implies presence of RTCP Header
 *           unsigned char *puchRTCPBuffer   - RTCP Buffer
 *
 * Outputs:  None
 *
 * Returns:  ssrc_t         - Returns Receiver's SSRC
 *
 * Description: Returns the Receiver's SSRC.
 *
 * Usage Notes:
 *
 *
 */
inline ssrc_t CRTCPSource::GetReceiverSSRC(bool bRTCPHeader,
                                 unsigned char *puchRTCPBuffer)
{

//  Advance over RTCP Header if one exists
    if(bRTCPHeader)
        puchRTCPBuffer += HEADER_LENGTH;

//  Return Receiver SSRC
    return(ntohl(*((ssrc_t *)puchRTCPBuffer)));

}

/**
 *
 * Method Name: GetReportCount
 *
 *
 * Inputs:      unsigned char *puchRTCPBuffer   - RTCP Buffer
 *
 * Outputs:     None
 *
 * Returns:     unsigned long                   - Returns Report Count
 *
 * Description: Returns the RTCP Report Count.
 *
 * Usage Notes:
 *
 *
 */
inline unsigned long CRTCPSource::GetReportCount(unsigned char *puchRTCPBuffer)
{

//  Extract Report Count
    return(*puchRTCPBuffer & COUNT_MASK);

}

/**
 *
 * Method Name: GetReportLength
 *
 *
 * Inputs:      unsigned char *puchRTCPBuffer   - RTCP Buffer
 *
 * Outputs:     None
 *
 * Returns:     unsigned long                   - Returns Report Length
 *
 * Description: Returns the RTCP Report Length.
 *
 * Usage Notes:
 *
 *
 */
inline unsigned long CRTCPSource::GetReportLength(unsigned char *puchRTCPBuffer)
{

//  Extract Report Length
    unsigned long ulReportLength =
               ntohs(*((unsigned short *)(puchRTCPBuffer + LENGTH_OFFSET))) + 1;

    return(ulReportLength * sizeof(uint32_t));

}
#endif