1#if !defined(RESIP_SDPCONTENTS_HXX)
2#define RESIP_SDPCONTENTS_HXX
22class TrickleIceContents;
42 std::list<std::pair<Data, Data> > mAttributeList;
82 Codec() : mName(), mRate(0), mPayloadType(-1) {}
174 Data mEncodingParameters;
176 static std::unique_ptr<CodecMap> sStaticCodecs;
177 static bool sStaticCodecsCreated;
199 const Data& address);
275 const Data& freeText);
316 const Data& freeText);
361 unsigned long ttl = 0);
386 unsigned long ttl()
const {
return mTTL;}
387 unsigned long&
ttl() {
return mTTL;}
444 unsigned long mKbPerSecond;
465 Time(
unsigned long start,
479 Repeat(
unsigned long interval,
480 unsigned long duration,
481 std::list<int> offsets);
491 unsigned long mInterval;
492 unsigned long mDuration;
493 std::list<int> mOffsets;
510 const std::list<Repeat>&
getRepeats()
const {
return mRepeats;}
514 unsigned long mStart;
516 std::list<Repeat> mRepeats;
554 std::list<Adjustment> mAdjustments;
587 typedef std::vector<std::reference_wrapper<const SdpContents::Session::Direction>>
DirectionList;
597 const std::reference_wrapper<const Direction>
cref;
600 typedef std::pair<Data, std::reference_wrapper<const SdpContents::Session::Direction>>
Tuple;
609 bool send()
const {
return mSend; }
610 bool recv()
const {
return mRecv; }
622 Direction(
const Direction& d) =
delete;
623 void operator=(
const Direction& d) =
delete;
629 static const std::map<Tuple::first_type, Tuple::second_type> directions;
701 int port()
const {
return mPort;}
706 unsigned long&
port() {
return mPort;}
788 const std::list<Bandwidth>&
bandwidths()
const {
return mBandwidths;}
868 unsigned long mMulticast;
870 std::list<Data> mFormats;
874 std::list<Connection> mConnections;
875 std::list<Bandwidth> mBandwidths;
880 typedef HashMap<int, Codec> RtpMap;
960 const std::list<Email>&
getEmails()
const {
return mEmails;}
965 const std::list<Phone>&
getPhones()
const {
return mPhones;}
985 const std::list<Bandwidth>&
bandwidths()
const {
return mBandwidths;}
995 const std::list<Time>&
getTimes()
const {
return mTimes;}
1148 std::list<Email> mEmails;
1149 std::list<Phone> mPhones;
1151 std::list<Bandwidth> mBandwidths;
1152 std::list<Time> mTimes;
1153 Timezones mTimezones;
1154 Encryption mEncryption;
Wraps your platform's implementation of hash_map, hash_multimap, and hash_set.
static const struct nv types[]
static constexpr size_t MaxParsedAttributeNames
parse() fails a section with more distinct attribute names than this
RESIP_HeapCount(AttributeHelper)
void clearAttribute(const Data &key)
const std::list< Data > & getValues(const Data &key) const
EncodeStream & encode(EncodeStream &s) const
AttributeHelper & operator=(const AttributeHelper &rhs)
void addAttribute(const Data &key, const Data &value=Data::Empty)
bool exists(const Data &key) const
void parse(ParseBuffer &pb)
Connection implements, via sockets, ConnectionBase for managed connections.
Base class for all SIP body types.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
static const Data Empty
Constant that represents a zero-length data.
Represents the "media-type" element in the RFC 3261 grammar.
Provides string-parsing functionality with protection from buffer overflow.
Process optional b= (bandwidth) lines in SDP.
Bandwidth & operator=(const Bandwidth &rhs)
Data modifier()
returns the modifier string
unsigned long kbPerSecond() const
returns the number of kilobits/second maximum bandwidth
unsigned long & kbPerSecond()
returns the number of kilobits/second maximum bandwidth
EncodeStream & encode(EncodeStream &) const
const Data & modifier() const
returns the modifier string
void parse(ParseBuffer &pb)
parameters for a specific codec are stored in this class.
static const Codec G723_8000
static const Codec G729_8000
const Data & encodingParameters() const
returns the encoding parameters associated with this codec
static const Codec TelephoneEvent
static const Codec G722_8000
Codec & operator=(const Codec &codec)
void assignFormatParameters(const SdpContents::Session::Medium &medium)
const Data & parameters() const
returns the parameters associated with this codec
int & payloadType()
returns the RTP payload type associated with this codec.
static CodecMap & getStaticCodecs()
friend EncodeStream & operator<<(EncodeStream &, const Codec &)
void parse(ParseBuffer &pb, const SdpContents::Session::Medium &medium, int payLoadType)
const Data & getName() const
returns the name of the codec.
static const Codec ULaw_8000
Data & parameters()
returns the parameters associated with this codec
Data & encodingParameters()
returns the encoding parameters associated with this codec
int payloadType() const
returns the RTP payload type associated with this codec.
HashMap< int, Codec > CodecMap
friend bool operator==(const Codec &, const Codec &)
static const Codec FrfDialedDigit
static const Codec GSM_8000
int getRate() const
returns the name of the codec.
static const Codec ALaw_8000
Process c= (connection) lines in SDP.
unsigned long ttl() const
void parse(ParseBuffer &pb)
const Data & getAddress() const
returns the connection address
void setAddress(const Data &host, AddrType type=IP4)
set the address for the connection
EncodeStream & encode(EncodeStream &) const
Connection & operator=(const Connection &rhs)
AddrType getAddressType() const
returns the connection address type
const Tuple tuple() const
static DirectionList ordered()
bool operator==(const Direction &d) const
static bool valid(const Data &name)
static const Direction INACTIVE
static const Direction SENDRECV
const std::reference_wrapper< const Direction > cref
bool operator<(const Direction &d) const
static const Direction & get(const Data &name)
const Data & name() const
std::pair< Data, std::reference_wrapper< const SdpContents::Session::Direction > > Tuple
static const Direction RECVONLY
static const Direction SENDONLY
process e= (email) lines in the SDP
void parse(ParseBuffer &pb)
const Data & getFreeText() const
returns the string describing the email address
EncodeStream & encode(EncodeStream &) const
Email & operator=(const Email &rhs)
const Data & getAddress() const
returns the email address
process k= (encryption key) line
EncodeStream & encode(EncodeStream &) const
Encryption & operator=(const Encryption &rhs)
const KeyType & getMethod() const
const KeyType & method() const
const Data & getKey() const
void parse(ParseBuffer &pb)
process m= (media announcement) blocks
const Codec & findTelephoneEventPayloadCodec() const
finds the telephone-event codec
Medium & operator=(const Medium &rhs)
const std::list< Connection > getConnections() const
get a list of Connection objects, including the Session's c= line.
unsigned long & multicast()
get the number of transport port pairs
const std::list< Connection > & getMediumConnections() const
get a list of Connection objects from the m= section.
const Codec & findFirstMatchingCodecs(const CodecContainer &codecs, Codec *pMatchingCodec=0) const
void addBandwidth(const Bandwidth &bandwidth)
void setConnection(const Connection &connection)
set the media connection line.
int firstRtcpPort() const
get the value of the first specified RTCP port or if no rtcp: attribute found, the default port() val...
void addAttribute(const Data &key, const Data &value=Data::Empty)
add a media attribute line
const std::list< Data > & getValues(const Data &key) const
get the attribute values corresponding to the key - returns the attributes set on this medium,...
EncodeStream & encode(EncodeStream &) const
bool exists(const Data &key) const
tests if an a= key is present in the media section
void addConnection(const Connection &connection)
add a media connection line.
void setBandwidth(const Bandwidth &bandwidth)
const Encryption & encryption() const
int port() const
return the base port
const std::list< Data > & getFormats() const
return a list of codec formats
void addCodec(const Codec &codec)
add a codec to the m= line
std::list< Connection > & getMediumConnections()
void addFormat(const Data &format)
add a format identifier to the m= line
void parse(ParseBuffer &pb)
unsigned long & port()
return the base port
void setPort(int port)
change the base port
std::list< Codec > CodecContainer
std::list< Data > getMergedValues(const Data &key) const
get the attribute values corresponding to the key - returns both the attributes set on this medium,...
const CodecContainer & codecs() const
preferred codec/format interface
const Encryption & getEncryption() const
const std::list< Bandwidth > & bandwidths() const
get a list of bandwidth lines
Data & name()
return the media type
void clearCodecs()
remove all codecs from SDP
Data & protocol()
return the transport protocol
int multicast() const
get the number of transport port pairs
const Data & information() const
get optional i= (information) line contents
const Direction & getDirection() const
std::list< Bandwidth > & bandwidths()
const Data & protocol() const
return the transport protocol
const Data & name() const
return the media type
int findTelephoneEventPayloadType() const
finds the telephone-event payload type
void clearAttribute(const Data &key)
erase all attributes for a given key
Encryption & encryption()
Data & information()
get optional i= (information) line contents
processes o= lines in SDP
EncodeStream & encode(EncodeStream &) const
void setAddress(const Data &host, AddrType type=IP4)
set the address for the session
const uint64_t & getVersion() const
returns the session version
uint64_t & getSessionId()
returns the session ID
void parse(ParseBuffer &pb)
const Data & getAddress() const
returns the session address type
const uint64_t & getSessionId() const
returns the session ID
uint64_t & getVersion()
returns the session version
const Data & user() const
returns the user string for the session
Data & user()
returns the user string for the session
AddrType getAddressType() const
returns the session address type
Origin & operator=(const Origin &rhs)
process p= (phone number) lines in the SDP
const Data & getNumber() const
return the phone number
void parse(ParseBuffer &pb)
const Data & getFreeText() const
return text string describing the phone number
EncodeStream & encode(EncodeStream &) const
Phone & operator=(const Phone &rhs)
unsigned long getInterval() const
void parse(ParseBuffer &pb)
const std::list< int > getOffsets() const
EncodeStream & encode(EncodeStream &) const
unsigned long getDuration() const
Process t= (start/stop time) lines in SDP.
const std::list< Repeat > & getRepeats() const
unsigned long getStart() const
return the start time
Time & operator=(const Time &rhs)
void parse(ParseBuffer &pb)
unsigned long getStop() const
return the stop time
void addRepeat(const Repeat &repeat)
EncodeStream & encode(EncodeStream &) const
specify the time at which a timezone shift will occur and the offset, in seconds
Adjustment & operator=(const Adjustment &rhs)
process z= (timezone) lines
void addAdjustment(const Adjustment &adjusment)
EncodeStream & encode(EncodeStream &) const
Timezones & operator=(const Timezones &rhs)
const std::list< Adjustment > & getAdjustments() const
void parse(ParseBuffer &pb)
Provides an interface to read and modify SDP bodies.
const std::list< Bandwidth > & bandwidths() const
return session Bandwidth lines
const std::list< Time > & getTimes() const
return session Time lines
void addMedium(const Medium &medium)
add an m= (Medium) section to session
Origin & origin()
return session Origin line
void addPhone(const Phone &phone)
add a p= (phone number) line to session
void addTime(const Time &t)
add a t= (Time) line to session
std::list< Medium > MediumContainer
const Timezones & getTimezones() const
Data & name()
return session name
std::shared_ptr< TrickleIceContents > makeIceFragment(const Data &fragment, unsigned int lineIndex, const Data &mid)
based on the original SDP in this instances of SdpContents, find the relevant ICE and m= line(s),...
const std::list< Phone > & getPhones() const
return session Phone number list
const Data & information() const
return session Information
std::list< std::reference_wrapper< Medium > > getMediaByType(const Data &type)
return session Media lines filtered by type
const Direction & getDirection() const
const std::list< Email > & getEmails() const
return session Email list
int version() const
return session version
std::list< Time > & getTimes()
return session Time lines
void parse(ParseBuffer &pb)
int & version()
return session version
const Encryption & getEncryption() const
DirectionList getNetDirections(const SdpContents &remote) const
const Origin & origin() const
return session Origin line
Session & operator=(const Session &rhs)
const std::list< Data > & getValues(const Data &key) const
get the attribute values corresponding to the key
std::vector< std::reference_wrapper< const SdpContents::Session::Direction > > DirectionList
Encryption & encryption()
const Data & name() const
return session name
bool isConnection() const
check if a c= line is present for the session
bool isWebRTC() const
determine if the SDP appears to conform to WebRTC
Uri & uri()
return session Uri
Connection & connection()
return session Connection
void addBandwidth(const Bandwidth &bandwidth)
add a b= (Bandwidth) line to session
MediumContainer & media()
return session Media lines
std::set< Data > getMediaStreamLabels() const
retrieve label (RFC 4574) attributes in a set
void transformLocalHold(bool holding)
change the direction attributes as if the peer who created the SDP is on hold or not
const Connection & connection() const
return session Connection
const Medium * getMediumByMid(const Data &mid) const
find the Medium with given mid value
EncodeStream & encode(EncodeStream &) const
void clearAttribute(const Data &key)
erase all attributes for a given key
void addEmail(const Email &email)
add an e= (email) line to session
bool exists(const Data &key) const
tests if an a= key is present in the session
bool isTrickleIceSupported() const
determine if ice-options:trickle is present
const Encryption & encryption() const
const MediumContainer & media() const
return session Media lines
Data & information()
return session Information
void clearMedium()
remove all Medium sections from session
DirectionList getDirections() const
void transformCOMedia(const Data &setupDirection="active", const Data &cOMediaAttribute="setup")
apply RFC 4145 COMEDIA transform
const Uri & uri() const
return session Uri
void addAttribute(const Data &key, const Data &value=Data::Empty)
add a session attribute line
std::list< Bandwidth > & bandwidths()
return session Bandwidth lines
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
const Session & session() const
virtual EncodeStream & encodeParsed(EncodeStream &str) const
virtual void parse(ParseBuffer &pb)
static const SdpContents Empty
virtual Contents * clone() const
duplicate an SdpContents object
RESIP_HeapCount(SdpContents)
static const Mime & getStaticType()
Session & session()
get the parsed SDP
SdpContents & operator=(const SdpContents &rhs)
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
dcm! – add UnusedChecking(_enum) below;
SdpContents::Session::Codec Codec
unsigned long long uint64_t
static bool invokeSdpContentsInit
void skipEol(ParseBuffer &pb)
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
bool operator==(const char *lhs, const Data &rhs)
bool operator!=(const Data &lhs, const Data &rhs)
Hasher for hash containers keyed by data received from the network, e.g.