This file is indexed.

/usr/include/sipxtapi/mp/MpRtpBuf.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
//  
// Copyright (C) 2006-2012 SIPez LLC.  All rights reserved.
//  
//  
// $$ 
////////////////////////////////////////////////////////////////////////////// 

#ifndef _INCLUDED_MPRTPBUF_H /* [ */
#define _INCLUDED_MPRTPBUF_H

// SYSTEM INCLUDES
#ifdef __pingtel_on_posix__ // [
#  include <netinet/in.h>
#endif // __pigntel_on_posix__ ]

#ifdef WIN32
#   include <winsock2.h>
#endif

// APPLICATION INCLUDES
#include <sdp/SdpCodec.h>
#include <mp/MpUdpBuf.h>
//#include <mp/MpTypes.h>
#include <mp/RtpHeader.h>
#include <mp/MpMisc.h>

// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// DEFINES

///  Buffer for RTP packet data.
/**
*  This is only the header for RTP data. It contain some RTP-related
*  parameters and pointer to external data (cause it is based on MpDataBuf).
*/
struct MpRtpBuf : public MpUdpBuf
{
    friend class MpRtpBufPtr;

/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

    /// Default pool for MpDataBuf objects.
    static MpBufPool *smpDefaultPool;

/* ============================ CREATORS ================================== */
///@name Creators
//@{


//@}

/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{

    /// Set number of bytes in payload data.
    /**
    * @see MpArrayBuf::setDataSize() for more details
    */
    bool setPayloadSize(int payloadSize)
    {
        if(!mpData.isValid())
        {
            MpMisc.RtpPool->profileFlowgraphPoolUsage();
        }
        return mpData->setDataSize(payloadSize);
    }

    /// Set RTP version of this packet.
    /**
    *  @see See getRtpVersion() for details.
    */
    void setRtpVersion(uint8_t version)
    { mRtpHeader.vpxcc = ( (version<<RTP_V_SHIFT)&RTP_V_MASK)
                         | (mRtpHeader.vpxcc&(~RTP_V_MASK));}

    /// Set padding bit in RTP header.
    /**
    *  @see See isRtpPadding() for details.
    */
    void enableRtpPadding()
    { mRtpHeader.vpxcc |= 1<<RTP_P_SHIFT;}

    /// Clear padding bit in RTP header.
    /**
    *  @see See isRtpPadding() for details.
    */
    void disableRtpPadding()
    { mRtpHeader.vpxcc &= ~RTP_P_MASK;}

    /// Set extension bit in RTP header.
    /**
    *  @see See isRtpExtension() for details.
    */
    void enableRtpExtension()
    { mRtpHeader.vpxcc |= 1<<RTP_X_SHIFT;}

    /// Clear extension bit in RTP header.
    /**
    *  @see See isRtpExtension() for details.
    */
    void disableRtpExtension()
    { mRtpHeader.vpxcc &= ~RTP_X_MASK;}

    /// Set CSRC Count for this packet.
    /**
    *  @see See getRtpCSRCCount() for details.
    */
    void setRtpCSRCCount(uint8_t csrcCount)
    { mRtpHeader.vpxcc = ( (csrcCount<<RTP_CC_SHIFT)&RTP_CC_MASK)
                         | (mRtpHeader.vpxcc&(~RTP_CC_MASK));}

    /// Set marker bit in RTP header.
    /**
    *  @see See isRtpMarker() for details.
    */
    void enableRtpMarker()
    { mRtpHeader.mpt |= 1<<RTP_M_SHIFT;}


    /// Clear marker bit in RTP header.
    /**
    *  @see See isRtpMarker() for details.
    */
    void disableRtpMarker()
    { mRtpHeader.mpt &= ~RTP_M_MASK;}

    /// Set Payload Type of this packet.
    /**
    *  @see See getRtpPayloadType() for details.
    */
    void setRtpPayloadType(uint8_t type)
    { mRtpHeader.mpt = ( (type<<RTP_PT_SHIFT)&RTP_PT_MASK)
                       | (mRtpHeader.mpt&(~RTP_PT_MASK));}

    /// Set Sequence Number of this packet.
    /**
    *  @see See getRtpSequenceNumber() for details.
    */
    void setRtpSequenceNumber(RtpSeq sequenceNumber)
    { mRtpHeader.seq = htons(sequenceNumber);}

    /// Set Timestamp of this packet.
    /**
    *  @see See getRtpTimestamp() for details.
    */
    void setRtpTimestamp(RtpTimestamp timestamp)
    { mRtpHeader.timestamp = htonl(timestamp);}

    /// Set SSRC of this packet.
    /**
    *  @see See getRtpSSRC() for details.
    */
    void setRtpSSRC(RtpSRC ssrc)
    { mRtpHeader.ssrc = htonl(ssrc);}

//@}

/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{

    /// Get current size of payload data.
    unsigned getPayloadSize() const {return mpData->getDataSize();}

    /// Get direct access to RtpHeader structure.
    RtpHeader &getRtpHeader() {return mRtpHeader;}

    /// Get read-only direct access to RtpHeader structure.
    const RtpHeader &getRtpHeader() const {return mRtpHeader;}

    /// Get direct access to RtpHeader structure.
    RtpSRC *getRtpCSRCs() {return mRtpCSRCs;}

    /// Get read-only direct access to RtpHeader structure.
    const RtpSRC *getRtpCSRCs() const {return mRtpCSRCs;}

    /// Get RTP version of this packet. Should be equal to 2.
    /**
    *  @note From RFC 3550:
    *  <i>"This field identifies the version of RTP.  The version defined by
    *  this specification is two (2).  (The value 1 is used by the first
    *  draft version of RTP and the value 0 is used by the protocol
    *  initially implemented in the "vat" audio tool.)"</i>
    */
    uint8_t getRtpVersion() const
    {return (mRtpHeader.vpxcc&RTP_V_MASK) >> RTP_V_SHIFT;}

    /// Get CSRC Count for this packet.
    /**
    *  @note From RFC 3550:
    *  <i>"The CSRC count contains the number of CSRC identifiers that follow
    *  the fixed header. "</i>
    */
    uint8_t getRtpCSRCCount() const {return mRtpHeader.vpxcc & RTP_CC_MASK;}

    /// Get Payload Type of this packet.
    /**
    *  @note From RFC 3550:
    *  <i>"This field identifies the format of the RTP payload and determines
    *  its interpretation by the application.  A profile MAY specify a
    *  default static mapping of payload type codes to payload formats.
    *  Additional payload type codes MAY be defined dynamically through
    *  non-RTP means.  A set of default mappings for
    *  audio and video is specified in the companion RFC 3551.  An
    *  RTP source MAY change the payload type during a session, but this
    *  field SHOULD NOT be used for multiplexing separate media streams.
    *  <br>
    *  A receiver MUST ignore packets with payload types that it does not
    *  understand."</i>
    */
    uint8_t getRtpPayloadType() const
    {return (mRtpHeader.mpt&RTP_PT_MASK) >> RTP_PT_SHIFT;}

    /// Get the internal codec ID for this RTP packet's payload
    SdpCodec::SdpCodecTypes getCodecId() const { return(mInternalCodecId); };
    /*
     * Note this must be set by the RTP Input connection as the bufer maintains no
     * codec mapping capablity.
     */

    /// Set the internal codec ID for this packet's payload
    void setCodecId(SdpCodec::SdpCodecTypes codecId) { mInternalCodecId = codecId; };

    /// Get Sequence Number of this packet.
    /**
    *  @note From RFC 3550:
    *  <i>"The sequence number increments by one for each RTP data packet
    *  sent, and may be used by the receiver to detect packet loss and to
    *  restore packet sequence.  The initial value of the sequence number
    *  SHOULD be random (unpredictable) to make known-plaintext attacks
    *  on encryption more difficult, even if the source itself does not
    *  encrypt, because the
    *  packets may flow through a translator that does."</i>
    */
    RtpSeq getRtpSequenceNumber() const {return ntohs(mRtpHeader.seq);}

    /// Get Timestamp of this packet.
    /**
    *  @note From RFC 3550:
    *  <i>"The timestamp reflects the sampling instant of the first octet in
    *  the RTP data packet.  The sampling instant MUST be derived from a
    *  clock that increments monotonically and linearly in time to allow
    *  synchronization and jitter calculations.  The
    *  resolution of the clock MUST be sufficient for the desired
    *  synchronization accuracy and for measuring packet arrival jitter
    *  (one tick per video frame is typically not sufficient)."</i>
    */
    RtpTimestamp getRtpTimestamp() const {return ntohl(mRtpHeader.timestamp);}

    /// Get SSRC of this packet.
    /**
    *  @note From RFC 3550:
    *  <i>"The SSRC field identifies the synchronization source.  This
    *  identifier SHOULD be chosen randomly, with the intent that no two
    *  synchronization sources within the same RTP session will have the
    *  same SSRC identifier.  Although the
    *  probability of multiple sources choosing the same identifier is
    *  low, all RTP implementations must be prepared to detect and
    *  resolve collisions."</i>
    */
    RtpSRC getRtpSSRC() const {return ntohl(mRtpHeader.ssrc);}

//@}

/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{

    /// Check padding bit in RTP header.
    /**
    *  @note From RFC 3550:
    *  <i>"If the padding bit is set, the packet contains one or more
    *  additional padding octets at the end which are not part of the
    *  payload.  The last octet of the padding contains a count of how
    *  many padding octets should be ignored, including itself.  Padding
    *  may be needed by some encryption algorithms with fixed block sizes
    *  or for carrying several RTP packets in a lower-layer protocol data
    *  unit. "</i>
    */
    bool isRtpPadding() const
    {return (mRtpHeader.vpxcc&RTP_P_MASK) == (1<<RTP_P_SHIFT);}

    /// Check extension bit in RTP header.
    /**
    *  @note From RFC 3550:
    *  <i>"If the extension bit is set, the fixed header MUST be followed by
    *  exactly one header extension."</i>
    */
    bool isRtpExtension() const
    {return (mRtpHeader.vpxcc&RTP_X_MASK) == (1<<RTP_X_SHIFT);}

    /// Check marker bit in RTP header.
    /**
    *  @note From RFC 3550:
    *  <i>"The interpretation of the marker is defined by a profile.  It is
    *  intended to allow significant events such as frame boundaries to
    *  be marked in the packet stream.  A profile MAY define additional
    *  marker bits or specify that there is no marker bit by changing the
    *  number of bits in the payload type field"</i>
    */
    bool isRtpMarker() const
    {return (mRtpHeader.mpt&RTP_M_MASK) == (1<<RTP_M_SHIFT);}

//@}

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:

    RtpHeader  mRtpHeader;   ///< Fixed header of RTP packet. It is contained as
                             ///< is and functions to access its components are
                             ///< provided.

    SdpCodec::SdpCodecTypes mInternalCodecId; ///<Internal codec ID for this packets payload ID

    RtpSRC mRtpCSRCs[RTP_MAX_CSRCS]; ///< CSRCs list of RTP packet.

    /// This is called in place of constructor.
    void init();

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:

    /// Disable copy (and other) constructor.
    MpRtpBuf(const MpBuf &);
    /**<
    * This struct will be initialized by init() member.
    */

    /// Disable assignment operator.
    MpRtpBuf &operator=(const MpBuf &);
    /**<
    * Buffers may be copied. But do we need this?
    */
};

///  Smart pointer to MpRtpBuf.
/**
*  You should only use this smart pointer, not #MpRtpBuf* itself.
*  The goal of this smart pointer is to care about reference counter and
*  buffer deallocation.
*/
class MpRtpBufPtr : public MpUdpBufPtr {

/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

/* ============================ CREATORS ================================== */
///@name Creators
//@{

    /// Default constructor - construct invalid pointer.
    MPBUF_DEFAULT_CONSTRUCTOR(MpRtpBuf)

    /// This constructor owns MpBuf object.
    MPBUFDATA_FROM_BASE_CONSTRUCTOR(MpRtpBuf, MP_BUF_RTP, MpUdpBuf)

    /// Copy object from base type with type check.
    MPBUF_TYPECHECKED_COPY(MpRtpBuf, MP_BUF_RTP, MpUdpBuf)

//@}

/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{


//@}

/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{

    /// Return pointer to MpRtpBuf.
    MPBUF_MEMBER_ACCESS_OPERATOR(MpRtpBuf)

    /// Return read-only pointer to MpRtpBuf.
    MPBUF_CONST_MEMBER_ACCESS_OPERATOR(MpRtpBuf)

//@}

/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{


//@}

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:


/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:

};

#endif /* ] _INCLUDED_MPRTPBUF_H */