This file is indexed.

/usr/include/sipxtapi/sdp/Sdp.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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
// 
// Copyright (C) 2007-2012 SIPez LLC.  All rights reserved.
//
// Copyright (C) 2007 Plantronics
// Licensed to SIPfoundry under a Contributor Agreement.
// 
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////
// Author: Scott Godin (sgodin AT SipSpectrum DOT com)

#ifndef _Sdp_h_
#define _Sdp_h_

// SYSTEM INCLUDES
//#include <...>
#include <iostream>

// APPLICATION INCLUDES
#include <utl/UtlInt.h>
#include <utl/UtlString.h>
#include <utl/UtlVoidPtr.h>
#include <utl/UtlCopyableSList.h>
#include <utl/UtlSListIterator.h>
#include <utl/UtlHashMap.h>

#include "SdpCandidate.h"

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

//: Container for SDP specification
// This class holds the information related to an SDP.
// Included in this information is:  TODO
//

class SdpMediaLine;

class Sdp
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

   typedef enum 
   {
       // WARNING: this enum must stay in synch. with SdpNetTypeString
      NET_TYPE_NONE,
      NET_TYPE_IN             // "IN" - Internet - RFC4566
   } SdpNetType;
   static const char* SdpNetTypeString[];

   typedef enum 
   {
       // WARNING: this enum MUST stay in synch with SdpAddressTypeString
      ADDRESS_TYPE_NONE,
      ADDRESS_TYPE_IP4,       // "IP4" - RFC4566
      ADDRESS_TYPE_IP6        // "IP6" - RFC4566
   } SdpAddressType;
   static const char* SdpAddressTypeString[];

   typedef enum 
   {
      BANDWIDTH_TYPE_NONE,
      BANDWIDTH_TYPE_CT,      // "CT" - Conference Total - RFC4566
      BANDWIDTH_TYPE_AS,      // "AS" - Application Specific - RFC4566
      BANDWIDTH_TYPE_TIAS,    // "TIAS" - Transport Independent Application Specific - RFC3890,
      BANDWIDTH_TYPE_RS,      // "RS" - RTCP bandwidth on active senders - RFC3556
      BANDWIDTH_TYPE_RR       // "RR" - RTCP bandwidth allocated to other participants - RFC3556
   } SdpBandwidthType;
   static const char* SdpBandwidthTypeString[];

   class SdpBandwidth : public UtlCopyableContainable
   {
   public:
      SdpBandwidth(SdpBandwidthType type, unsigned int bandwidth) : mType(type), mBandwidth(bandwidth) {}
      SdpBandwidth(const SdpBandwidth& rhs) : mType(rhs.mType), mBandwidth(rhs.mBandwidth) {}

      // Containable requirements
      UtlContainableType getContainableType() const { static char type[] = "SdpBandwidth"; return type;}
      unsigned hash() const { return directHash(); }
      int compareTo(UtlContainable const *) const { return 0; } // not implemented
      UtlCopyableContainable* clone() const { return new SdpBandwidth(*this); }

      // Accessors
      void setType(SdpBandwidthType type) { mType = type; }
      SdpBandwidthType getType() const { return mType; }
      static SdpBandwidthType getTypeFromString(const char * type);

      void setBandwidth(unsigned int bandwidth) { mBandwidth = bandwidth; }
      unsigned int getBandwidth() const { return mBandwidth; }

   private:
      SdpBandwidthType  mType;
      unsigned int      mBandwidth;
   };

   class SdpTime : public UtlCopyableContainable
   {
   public:
      class SdpTimeRepeat : public UtlCopyableContainable
      {
      public:
         SdpTimeRepeat(unsigned int repeatInterval, unsigned int activeDuration) :
            mRepeatInterval(repeatInterval), mActiveDuration(activeDuration) {}
          SdpTimeRepeat(const SdpTimeRepeat& rhs) :
            mRepeatInterval(rhs.mRepeatInterval), mActiveDuration(rhs.mActiveDuration), mOffsetsFromStartTime(rhs.mOffsetsFromStartTime) {}

         // Containable requirements
         UtlContainableType getContainableType() const { static char type[] = "SdpTimeRepeat"; return type;}
         unsigned hash() const { return directHash(); }
         int compareTo(UtlContainable const *) const { return 0; } // not implemented
         UtlCopyableContainable* clone() const { return new SdpTimeRepeat(*this); }

         // Accessors
         void setRepeatInterval(unsigned int repeatInterval) { mRepeatInterval = repeatInterval; }
         unsigned int getRepeatInterval() const { return mRepeatInterval; }

         void setActiveDuration(unsigned int activeDuration) { mActiveDuration = activeDuration; }
         unsigned int getActiveDuration() const { return mActiveDuration; }

         void addOffsetFromStartTime(unsigned int offset) { mOffsetsFromStartTime.insert(new UtlInt(offset)); }
         void clearOffsetsFromStartTime() { mOffsetsFromStartTime.destroyAll(); }
         const UtlCopyableSList& getOffsetsFromStartTime() const { return mOffsetsFromStartTime; }

      private:
         unsigned int      mRepeatInterval;
         unsigned int      mActiveDuration;
         UtlCopyableSList  mOffsetsFromStartTime;
      };

      SdpTime(uint64_t startTime, uint64_t stopTime) : mStartTime(startTime), mStopTime(stopTime) {}
      SdpTime(const SdpTime& rhs) : mStartTime(rhs.mStartTime), mStopTime(rhs.mStopTime), mRepeats(rhs.mRepeats) {}

      // Containable requirements
      UtlContainableType getContainableType() const { static char type[] = "SdpTime"; return type;}
      unsigned hash() const { return directHash(); }
      int compareTo(UtlContainable const *) const { return 0; } // not implemented
      UtlCopyableContainable* clone() const { return new SdpTime(*this); }

      // Accessors
      void setStartTime(uint64_t startTime) { mStartTime = startTime; }
      uint64_t getStartTime() const { return mStartTime; }

      void setStopTime(uint64_t stopTime) { mStopTime = stopTime; }
      uint64_t getStopTime() const { return mStopTime; }

      void addRepeat(SdpTimeRepeat* sdpTimeRepeat) { mRepeats.insert(sdpTimeRepeat); }
      void clearRepeats() { mRepeats.destroyAll(); }
      const UtlCopyableSList& getRepeats() const { return mRepeats; }

   private:
      uint64_t     mStartTime;
      uint64_t     mStopTime;
      UtlCopyableSList   mRepeats;       
   };

   class SdpTimeZone : public UtlCopyableContainable
   {
   public:
      SdpTimeZone(int adjustmentTime, int offset) : mAdjustmentTime(adjustmentTime), mOffset(offset) {}
      SdpTimeZone(const SdpTimeZone& rhs) : mAdjustmentTime(rhs.mAdjustmentTime), mOffset(rhs.mOffset) {}

      // Containable requirements
      UtlContainableType getContainableType() const { static char type[] = "SdpTimeZone"; return type;}
      unsigned hash() const { return directHash(); }
      int compareTo(UtlContainable const *) const { return 0; } // not implemented
      UtlCopyableContainable* clone() const { return new SdpTimeZone(*this); }

      // Accessors
      void setAdjustmentTime(int adjustmentTime) { mAdjustmentTime = adjustmentTime; }
      uint64_t getAdjustmentTime() const { return mAdjustmentTime; }

      void setOffset(int offset) { mOffset = offset; }
      uint64_t getOffset() const { return mOffset; }

   private:
      int         mAdjustmentTime;
      int         mOffset;
   };

   typedef enum 
   {
      CONFERENCE_TYPE_NONE,
      CONFERENCE_TYPE_BROADCAST, // "broadcast" - RFC4566
      CONFERENCE_TYPE_MODERATED, // "moderated" - RFC4566
      CONFERENCE_TYPE_TEST,      // "test" - RFC4566
      CONFERENCE_TYPE_H332       // "H332" - RFC4566
   } SdpConferenceType;
   static const char* SdpConferenceTypeString[];

   typedef enum 
   {
      GROUP_SEMANTICS_NONE,
      GROUP_SEMANTICS_LS,        // "LS" - Lip Sync - RFC3388
      GROUP_SEMANTICS_FID,       // "FID" - Flow Identifier - RFC3388
      GROUP_SEMANTICS_SRF,       // "SRF" - Single Reservation Flow - RFC3524
      GROUP_SEMANTICS_ANAT       // "ANAT" - Alternative Network Address Types - RFC4091
   } SdpGroupSemantics;
   static const char* SdpGroupSemanticsString[];

   class SdpGroup : public UtlCopyableContainable
   {
   public:
      SdpGroup(SdpGroupSemantics semantics) : mSemantics(semantics) {}
      SdpGroup(const SdpGroup& rhs) : mSemantics(rhs.mSemantics), mIdentificationTags(rhs.mIdentificationTags) {}

      // Containable requirements
      UtlContainableType getContainableType() const { static char type[] = "SdpGroup"; return type;}
      unsigned hash() const { return directHash(); }
      int compareTo(UtlContainable const *) const { return 0; } // not implemented
      UtlCopyableContainable* clone() const { return new SdpGroup(*this); }

      // Accessors
      void setSemantics(SdpGroupSemantics semantics) { mSemantics = semantics; }
      SdpGroupSemantics getSemantics() const { return mSemantics; }
      static SdpGroupSemantics getSemanticsFromString(const char * type);

      void addIdentificationTag(const char * identificationTag) { mIdentificationTags.insert(new UtlString(identificationTag)); }
      void clearIdentificationTags() { mIdentificationTags.destroyAll(); }
      const UtlCopyableSList& getIdentificationTags() const { return mIdentificationTags; }
      
   private:
      SdpGroupSemantics mSemantics;
      UtlCopyableSList          mIdentificationTags;
   };

   class SdpFoundation : public UtlCopyableContainable
   {
   public:
      SdpFoundation(SdpCandidate::SdpCandidateType candidateType, const char * baseAddress, const char * stunAddress) : 
         mCandidateType(candidateType), mBaseAddress(baseAddress), mStunAddress(stunAddress) {}
      SdpFoundation(const SdpFoundation& rhs) :
         mCandidateType(rhs.mCandidateType), mBaseAddress(rhs.mBaseAddress), mStunAddress(rhs.mStunAddress) {}

      // Containable requirements
      UtlContainableType getContainableType() const { static char type[] = "SdpFoundationId"; return type;}
      unsigned hash() const { return mBaseAddress.hash() ^ mStunAddress.hash() ^ mCandidateType; }
      int compareTo(UtlContainable const *) const;
      UtlCopyableContainable* clone() const { return new SdpFoundation(*this); }

   private:
      SdpCandidate::SdpCandidateType mCandidateType;
      UtlString                      mBaseAddress;
      UtlString                      mStunAddress;
   };

/* ============================ CREATORS ================================== */

   Sdp();
     //:Default constructor

   Sdp(const Sdp& rSdp);
     //:Copy constructor

   virtual ~Sdp();
     //:Destructor

/* ============================ MANIPULATORS ============================== */

   Sdp& operator=(const Sdp& rhs);
     //:Assignment operator

   void setSdpVersion(unsigned int sdpVersion) { mSdpVersion = sdpVersion; }

   void setOriginatorInfo(const char* userName, uint64_t sessionId, uint64_t sessionVersion, SdpNetType netType, SdpAddressType addressType, const char* unicastAddress);
   void setOriginatorUserName(const char* originatorUserName) { mOriginatorUserName = originatorUserName; }
   void setOriginatorSessionId(uint64_t originatorSessionId) { mOriginatorSessionId = originatorSessionId; }
   void setOriginatorSessionVersion(uint64_t originatorSessionVersion) { mOriginatorSessionVersion = originatorSessionVersion; }
   void setOriginatorNetType(SdpNetType originatorNetType) { mOriginatorNetType = originatorNetType; }
   void setOriginatorAddressType(SdpAddressType originatorAddressType) { mOriginatorAddressType = originatorAddressType; }
   void setOriginatorUnicastAddress(const char* originatorUnicastAddress) { mOriginatorUnicastAddress = originatorUnicastAddress; }

   void setSessionName(const char * sessionName) { mSessionName = sessionName; }
   void setSessionInformation(const char * sessionInformation) { mSessionInformation = sessionInformation; }
   void setSessionUri(const char * sessionUri) { mSessionUri = sessionUri; }

   void addEmailAddress(const char * emailAddress) { mEmailAddresses.insert(new UtlString(emailAddress)); }
   void clearEmailAddresses() { mEmailAddresses.destroyAll(); }

   void addPhoneNumber(const char * phoneNumber) { mPhoneNumbers.insert(new UtlString(phoneNumber)); }
   void clearPhoneNumbers() { mPhoneNumbers.destroyAll(); }

   void addBandwidth(SdpBandwidthType type, unsigned int bandwidth) { addBandwidth(new SdpBandwidth(type, bandwidth)); }
   void addBandwidth(SdpBandwidth* sdpBandwidth) { mBandwidths.insert(sdpBandwidth); }
   void clearBandwidths() { mBandwidths.destroyAll(); }

   void addTime(uint64_t startTime, uint64_t stopTime) { addTime(new SdpTime(startTime, stopTime)); }
   void addTime(SdpTime* time) { mTimes.insert(time); }
   void clearTimes() { mTimes.destroyAll(); }

   void addTimeZone(int adjustmentTime, int offset) { addTimeZone(new SdpTimeZone(adjustmentTime, offset)); }
   void addTimeZone(SdpTimeZone* timeZone) { mTimeZones.insert(timeZone); }
   void clearTimeZones() { mTimeZones.destroyAll(); }

   void setCategory(const char * category) { mCategory = category; }
   void setKeywords(const char * keywords) { mKeywords = keywords; }
   void setToolNameAndVersion(const char * toolNameAndVersion) { mToolNameAndVersion = toolNameAndVersion; }
   void setConferenceType(SdpConferenceType conferenceType) { mConferenceType = conferenceType; }
   void setCharSet(const char * charSet) { mCharSet = charSet; }
   void setIcePassiveOnlyMode(bool icePassiveOnlyMode) { mIcePassiveOnlyMode = icePassiveOnlyMode; }

   void addGroup(SdpGroup* group) { mGroups.insert(group); }
   void clearGroups() { mGroups.destroyAll(); }

   void setSessionLanguage(const char * sessionLanguage) { mSessionLanguage = sessionLanguage; }
   void setDescriptionLanguage(const char * descriptionLanguage) { mDescriptionLanguage = descriptionLanguage; }
   void setMaximumPacketRate(double maximumPacketRate) { mMaximumPacketRate = maximumPacketRate; }

   void addMediaLine(SdpMediaLine* mediaLine);
   void clearMediaLines();
   
/* ============================ ACCESSORS ================================= */

   void toString(UtlString& sdpString) const;

/* ============================ INQUIRY =================================== */

   static SdpAddressType getAddressTypeFromString(const char * type);

   unsigned int getSdpVersion() const { return mSdpVersion; }

   const UtlString& getOriginatorUserName() const { return mOriginatorUserName; }
   uint64_t getOriginatorSessionId() const { return mOriginatorSessionId; }
   uint64_t getOriginatorSessionVersion() const { return mOriginatorSessionVersion; }
   SdpNetType getOriginatorNetType() const { return mOriginatorNetType; }
   SdpAddressType getOriginatorAddressType() const { return mOriginatorAddressType; }
   const UtlString& getOriginatorUnicastAddress() const { return mOriginatorUnicastAddress; }

   const UtlString& getSessionName() const { return mSessionName; }
   const UtlString& getSessionInformation() const { return mSessionInformation; }
   const UtlString& getSessionUri() const { return mSessionUri; }

   const UtlCopyableSList& getEmailAddresses() const { return mEmailAddresses; }
   const UtlCopyableSList& getPhoneNumbers() const { return mPhoneNumbers; }
   const UtlCopyableSList& getBandwidths() const { return mBandwidths; }
   const UtlCopyableSList& getTimes() const { return mTimes; }
   const UtlCopyableSList& getTimeZones() const { return mTimeZones; }

   const UtlString& getCategory() const { return mCategory; }
   const UtlString& getKeywords() const { return mKeywords; }
   const UtlString& getToolNameAndVersion() const { return mToolNameAndVersion; }
   SdpConferenceType getConferenceType() const { return mConferenceType; }
   static SdpConferenceType getConferenceTypeFromString(const char * type);
   const UtlString& getCharSet() const { return mCharSet; }
   bool isIcePassiveOnlyMode() const { return mIcePassiveOnlyMode; }

   const UtlCopyableSList& getGroups() const { return mGroups; }

   const UtlString& getSessionLanguage() const { return mSessionLanguage; }
   const UtlString& getDescriptionLanguage() const { return mDescriptionLanguage; }
   double getMaximumPacketRate() const { return mMaximumPacketRate; }

   const UtlCopyableSList& getMediaLines() const;

   UtlString getLocalFoundationId(SdpCandidate::SdpCandidateType candidateType, const char * baseAddress, const char * stunAddress=0);


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

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
   // v=
   unsigned int   mSdpVersion;

   // o=
   UtlString      mOriginatorUserName;
   uint64_t       mOriginatorSessionId;
   uint64_t       mOriginatorSessionVersion;
   SdpNetType     mOriginatorNetType;
   SdpAddressType mOriginatorAddressType;
   UtlString      mOriginatorUnicastAddress;

   // s=
   UtlString      mSessionName;

   // i=
   UtlString      mSessionInformation;

   // u=         
   UtlString      mSessionUri;

   // e=
   UtlCopyableSList mEmailAddresses;

   // p=
   UtlCopyableSList mPhoneNumbers;

   // c= is only stored in sdpMediaLine

   // b=
   UtlCopyableSList mBandwidths;

   // t=, r=
   UtlCopyableSList mTimes;

   // z=
   UtlCopyableSList mTimeZones;

   // k= is only stored in sdpMediaLine

   // a= session level only attributes 
   UtlString      mCategory;           // a=cat:<category> - RFC4566
   UtlString      mKeywords;           // a=keywds:<keywords> - RFC4566
   UtlString      mToolNameAndVersion; // a=tool:<name and version of tool> - RFC4566
   SdpConferenceType mConferenceType;  // a=type:<conference type> - RFC4566
   UtlString      mCharSet;            // a=charset:<character set> - RFC4566
   bool           mIcePassiveOnlyMode; // a=ice-passive - ietf-draft-mmusic-ice-12
   UtlCopyableSList mGroups;             // a=group:<semantics> <id-tag> ... - RFC3388

   // a= attributes that have meaning when not associated to a particular media line
   UtlString      mSessionLanguage;     // a=lang:<language tag> - RFC4566
   UtlString      mDescriptionLanguage; // a=sdplang:<language tag> - RFC4566
   double         mMaximumPacketRate;   // a=maxprate:<packetrate> in packets/s - RFC3890

   // Media Lines
   UtlCopyableSList       mMediaLines;

   // Foundation Id 
   UtlHashMap     mFoundationIds;
};

/* ============================ INLINE METHODS ============================ */

#endif  // _Sdp_h_