reSIProcate/stack  9694
Classes | Public Types | Public Member Functions | Private Attributes | Friends
resip::SdpContents::Session Class Reference

Provides an interface to read and modify SDP bodies. More...

#include <SdpContents.hxx>

Collaboration diagram for resip::SdpContents::Session:
Collaboration graph
[legend]

List of all members.

Classes

class  Bandwidth
 Process optional b= (bandwidth) lines in SDP. More...
class  Codec
 parameters for a specific codec are stored in this class. More...
class  Connection
 Process c= (connection) lines in SDP. More...
class  Email
 process e= (email) lines in the SDP More...
class  Encryption
 process k= (encryption key) line More...
class  Medium
 process m= (media announcement) blocks More...
class  Origin
 processes o= lines in SDP More...
class  Phone
 process p= (phone number) lines in the SDP More...
class  Time
 Process t= (start/stop time) lines in SDP. More...
class  Timezones
 process z= (timezone) lines More...

Public Types

typedef std::list< MediumMediumContainer

Public Member Functions

 Session (int version, const Origin &origin, const Data &name)
 session constructor
 Session ()
 Session (const Session &rhs)
Sessionoperator= (const Session &rhs)
void parse (ParseBuffer &pb)
EncodeStreamencode (EncodeStream &) const
int version () const
 return session version
int & version ()
 return session version
const Originorigin () const
 return session Origin line
Originorigin ()
 return session Origin line
const Dataname () const
 return session name
Dataname ()
 return session name
const Datainformation () const
 return session Information
Datainformation ()
 return session Information
const Uriuri () const
 return session Uri
Uriuri ()
 return session Uri
const std::list< Email > & getEmails () const
 return session Email list
const std::list< Phone > & getPhones () const
 return session Phone number list
const Connectionconnection () const
 return session Connection
Connectionconnection ()
 return session Connection
bool isConnection () const
 check if a c= line is present for the session
const std::list< Bandwidth > & bandwidths () const
 return session Bandwidth lines
std::list< Bandwidth > & bandwidths ()
 return session Bandwidth lines
const std::list< Time > & getTimes () const
 return session Time lines
std::list< Time > & getTimes ()
 return session Time lines
const TimezonesgetTimezones () const
const EncryptiongetEncryption () const
const Encryptionencryption () const
Encryptionencryption ()
const MediumContainermedia () const
 return session Media lines
MediumContainermedia ()
 return session Media lines
void addEmail (const Email &email)
 add an e= (email) line to session
void addPhone (const Phone &phone)
 add a p= (phone number) line to session
void addBandwidth (const Bandwidth &bandwidth)
 add a b= (Bandwidth) line to session
void addTime (const Time &t)
 add a t= (Time) line to session
void addMedium (const Medium &medium)
 add an m= (Medium) section to session
void clearMedium ()
 remove all Medium sections from session
void clearAttribute (const Data &key)
 erase all attributes for a given key
void addAttribute (const Data &key, const Data &value=Data::Empty)
 add a session attribute line
bool exists (const Data &key) const
 tests if an a= key is present in the session
const std::list< Data > & getValues (const Data &key) const
 get the attribute values corresponding to the key

Private Attributes

int mVersion
Origin mOrigin
Data mName
MediumContainer mMedia
Data mInformation
Uri mUri
std::list< EmailmEmails
std::list< PhonemPhones
Connection mConnection
std::list< BandwidthmBandwidths
std::list< TimemTimes
Timezones mTimezones
Encryption mEncryption
AttributeHelper mAttributeHelper

Friends

class SdpContents

Detailed Description

Provides an interface to read and modify SDP bodies.

Definition at line 61 of file SdpContents.hxx.


Member Typedef Documentation

Definition at line 917 of file SdpContents.hxx.


Constructor & Destructor Documentation

SdpContents::Session::Session ( int  version,
const Origin origin,
const Data name 
)

session constructor

Create a new session from origin line, version, and session anme

Parameters:
versionsession version
originOrigin line
namesession name

Definition at line 946 of file SdpContents.cxx.

resip::SdpContents::Session::Session ( ) [inline]

Definition at line 811 of file SdpContents.hxx.

: mVersion(0) {}
SdpContents::Session::Session ( const Session rhs)

Definition at line 954 of file SdpContents.cxx.

{
   *this = rhs;
}

Member Function Documentation

void SdpContents::Session::addAttribute ( const Data key,
const Data value = Data::Empty 
)

add a session attribute line

Parameters:
keyattribute key
valueattribute value

Definition at line 1173 of file SdpContents.cxx.

References rtpmap.

{
   mAttributeHelper.addAttribute(key, value);

   if (key == rtpmap)
   {
      for (MediumContainer::iterator i = mMedia.begin();
           i != mMedia.end(); ++i)
      {
         i->mRtpMapDone = false;
      }
   }
}
void SdpContents::Session::addBandwidth ( const Bandwidth bandwidth)

add a b= (Bandwidth) line to session

Parameters:
bandwidthBandwidth line to add

Definition at line 1160 of file SdpContents.cxx.

Referenced by resip::SdpContents::Session::Medium::parse(), and resip::SdpContents::Session::Medium::setBandwidth().

{
   mBandwidths.push_back(bandwidth);
}
void SdpContents::Session::addEmail ( const Email email)

add an e= (email) line to session

Parameters:
emailEmail line to add

Definition at line 1142 of file SdpContents.cxx.

{
   mEmails.push_back(email);
}
void SdpContents::Session::addMedium ( const Medium medium)

add an m= (Medium) section to session

Parameters:
mediumMedium section to add

Definition at line 1166 of file SdpContents.cxx.

Referenced by main().

{
   mMedia.push_back(medium);
   mMedia.back().setSession(this);
}
void SdpContents::Session::addPhone ( const Phone phone)

add a p= (phone number) line to session

Parameters:
phonePhone line to add

Definition at line 1154 of file SdpContents.cxx.

{
   mPhones.push_back(phone);
}
void SdpContents::Session::addTime ( const Time t)

add a t= (Time) line to session

Parameters:
tTime line to add

Definition at line 1148 of file SdpContents.cxx.

Referenced by main().

{
   mTimes.push_back(t);
}
const std::list<Bandwidth>& resip::SdpContents::Session::bandwidths ( ) const [inline]

return session Bandwidth lines

Returns:
Bandwidth lines

Definition at line 897 of file SdpContents.hxx.

References mBandwidths.

{return mBandwidths;}
std::list<Bandwidth>& resip::SdpContents::Session::bandwidths ( ) [inline]

return session Bandwidth lines

Returns:
Bandwidth lines

Definition at line 902 of file SdpContents.hxx.

References mBandwidths.

{return mBandwidths;}
void SdpContents::Session::clearAttribute ( const Data key)

erase all attributes for a given key

Parameters:
keykey to clear

Definition at line 1188 of file SdpContents.cxx.

References rtpmap.

Referenced by resip::SdpContents::Session::Medium::clearCodecs().

{
   mAttributeHelper.clearAttribute(key);

   if (key == rtpmap)
   {
      for (MediumContainer::iterator i = mMedia.begin();
           i != mMedia.end(); ++i)
      {
         i->mRtpMapDone = false;
      }
   }
}
void resip::SdpContents::Session::clearMedium ( ) [inline]

remove all Medium sections from session

Definition at line 962 of file SdpContents.hxx.

References mMedia.

{  mMedia.clear(); }
const Connection& resip::SdpContents::Session::connection ( ) const [inline]

return session Connection

Returns:
Connection line

Definition at line 882 of file SdpContents.hxx.

References mConnection.

Referenced by resip::SdpContents::Session::Medium::getConnections(), and main().

{return mConnection;}
Connection& resip::SdpContents::Session::connection ( ) [inline]

return session Connection

Returns:
Connection line

Definition at line 887 of file SdpContents.hxx.

References mConnection.

{return mConnection;} // !dlb! optional?
EncodeStream & SdpContents::Session::encode ( EncodeStream s) const

Definition at line 1069 of file SdpContents.cxx.

References CRLF, and resip::Contents::mVersion.

Referenced by resip::SdpContents::encodeParsed().

{
   s << "v=" << mVersion << Symbols::CRLF;
   mOrigin.encode(s);
   s << "s=" << mName << Symbols::CRLF;

   if (!mInformation.empty())
   {
      s << "i=" << mInformation << Symbols::CRLF;
   }

   if (!mUri.host().empty())
   {
      s << "u=";
      mUri.encode(s);
      s << Symbols::CRLF;
   }

   for (list<Email>::const_iterator i = mEmails.begin();
        i != mEmails.end(); ++i)
   {
      i->encode(s);
   }

   for (list<Phone>::const_iterator i = mPhones.begin();
        i != mPhones.end(); ++i)
   {
      i->encode(s);
   }

   if (!mConnection.getAddress().empty())
   {
      mConnection.encode(s);
   }

   for (list<Bandwidth>::const_iterator i = mBandwidths.begin();
        i != mBandwidths.end(); ++i)
   {
      i->encode(s);
   }

   if (mTimes.empty())
   {
      s << "t=0 0" << Symbols::CRLF;
   }
   else
   {
      for (list<Time>::const_iterator i = mTimes.begin();
           i != mTimes.end(); ++i)
      {
         i->encode(s);
      }
   }

   mTimezones.encode(s);

   if (mEncryption.getMethod() != Encryption::NoEncryption)
   {
      mEncryption.encode(s);
   }

   mAttributeHelper.encode(s);

   for (MediumContainer::const_iterator i = mMedia.begin();
        i != mMedia.end(); ++i)
   {
      i->encode(s);
   }

   return s;
}
const Encryption& resip::SdpContents::Session::encryption ( ) const [inline]

Definition at line 915 of file SdpContents.hxx.

References mEncryption.

{return mEncryption;}
Encryption& resip::SdpContents::Session::encryption ( ) [inline]

Definition at line 916 of file SdpContents.hxx.

References mEncryption.

{return mEncryption;}
bool SdpContents::Session::exists ( const Data key) const

tests if an a= key is present in the session

Parameters:
keykey to check
Returns:
true if key exists, false otherwise

Definition at line 1203 of file SdpContents.cxx.

Referenced by resip::SdpContents::Session::Medium::codecs(), and resip::SdpContents::Session::Medium::exists().

{
   return mAttributeHelper.exists(key);
}
const std::list<Email>& resip::SdpContents::Session::getEmails ( ) const [inline]

return session Email list

Returns:
Email list

Definition at line 872 of file SdpContents.hxx.

References mEmails.

{return mEmails;}
const Encryption& resip::SdpContents::Session::getEncryption ( ) const [inline]

Definition at line 914 of file SdpContents.hxx.

References mEncryption.

{return mEncryption;}
const std::list<Phone>& resip::SdpContents::Session::getPhones ( ) const [inline]

return session Phone number list

Returns:
Phone number list

Definition at line 877 of file SdpContents.hxx.

References mPhones.

{return mPhones;}
const std::list<Time>& resip::SdpContents::Session::getTimes ( ) const [inline]

return session Time lines

Returns:
Time lines

Definition at line 907 of file SdpContents.hxx.

References mTimes.

{return mTimes;}
std::list<Time>& resip::SdpContents::Session::getTimes ( ) [inline]

return session Time lines

Returns:
Time lines

Definition at line 912 of file SdpContents.hxx.

References mTimes.

{return mTimes;}
const Timezones& resip::SdpContents::Session::getTimezones ( ) const [inline]

Definition at line 913 of file SdpContents.hxx.

References mTimezones.

{return mTimezones;}
const list< Data > & SdpContents::Session::getValues ( const Data key) const

get the attribute values corresponding to the key

Parameters:
keykey to check
Returns:
list of values for given key

Definition at line 1209 of file SdpContents.cxx.

Referenced by resip::SdpContents::Session::Medium::codecs(), and resip::SdpContents::Session::Medium::getValues().

{
   return mAttributeHelper.getValues(key);
}
const Data& resip::SdpContents::Session::information ( ) const [inline]

return session Information

Returns:
Information line

Definition at line 852 of file SdpContents.hxx.

References mInformation.

{return mInformation;}
Data& resip::SdpContents::Session::information ( ) [inline]

return session Information

Returns:
Information line

Definition at line 857 of file SdpContents.hxx.

References mInformation.

{return mInformation;}
bool resip::SdpContents::Session::isConnection ( ) const [inline]

check if a c= line is present for the session

Returns:
true if c= line is present

Definition at line 892 of file SdpContents.hxx.

References resip::SdpContents::Empty, resip::SdpContents::Session::Connection::mAddress, and mConnection.

const MediumContainer& resip::SdpContents::Session::media ( ) const [inline]

return session Media lines

Returns:
Media lines

Definition at line 922 of file SdpContents.hxx.

References mMedia.

{return mMedia;}
MediumContainer& resip::SdpContents::Session::media ( ) [inline]

return session Media lines

Returns:
Media lines

Definition at line 927 of file SdpContents.hxx.

References mMedia.

{return mMedia;}
const Data& resip::SdpContents::Session::name ( ) const [inline]

return session name

Returns:
name

Definition at line 842 of file SdpContents.hxx.

References mName.

{return mName;}
Data& resip::SdpContents::Session::name ( ) [inline]

return session name

Returns:
name

Definition at line 847 of file SdpContents.hxx.

References mName.

{return mName;}
SdpContents::Session & SdpContents::Session::operator= ( const Session rhs)

Definition at line 960 of file SdpContents.cxx.

References mAttributeHelper, mBandwidths, mConnection, mEmails, mEncryption, mInformation, mMedia, mName, mOrigin, mPhones, mTimes, mTimezones, mUri, resip::Contents::mVersion, and mVersion.

{
   if (this != &rhs)
   {
      mVersion = rhs.mVersion;
      mOrigin = rhs.mOrigin;
      mName = rhs.mName;
      mMedia = rhs.mMedia;
      mInformation = rhs.mInformation;
      mUri = rhs.mUri;
      mEmails = rhs.mEmails;
      mPhones = rhs.mPhones;
      mConnection = rhs.mConnection;
      mBandwidths = rhs.mBandwidths;
      mTimes = rhs.mTimes;
      mTimezones = rhs.mTimezones;
      mEncryption = rhs.mEncryption;
      mAttributeHelper = rhs.mAttributeHelper;

      for (MediumContainer::iterator i=mMedia.begin(); i != mMedia.end(); ++i)
      {
         i->setSession(this);
      }
   }
   return *this;
}
const Origin& resip::SdpContents::Session::origin ( ) const [inline]

return session Origin line

Returns:
Origin line

Definition at line 832 of file SdpContents.hxx.

References mOrigin.

{return mOrigin;}
Origin& resip::SdpContents::Session::origin ( ) [inline]

return session Origin line

Returns:
Origin line

Definition at line 837 of file SdpContents.hxx.

References mOrigin.

{return mOrigin;}
void SdpContents::Session::parse ( ParseBuffer pb)

Definition at line 988 of file SdpContents.cxx.

References resip::Symbols::CRLF, resip::ParseBuffer::data(), resip::ParseBuffer::eof(), resip::Symbols::EQUALS, resip::ParseBuffer::integer(), resip::Contents::mVersion, resip::ParseBuffer::position(), resip::ParseBuffer::skipChar(), skipEol(), and resip::ParseBuffer::skipToOneOf().

Referenced by resip::SdpContents::parse().

{
   pb.skipChar('v');
   pb.skipChar(Symbols::EQUALS[0]);
   mVersion = pb.integer();
   skipEol(pb);

   mOrigin.parse(pb);

   pb.skipChar('s');
   const char* anchor = pb.skipChar(Symbols::EQUALS[0]);
   pb.skipToOneOf(Symbols::CRLF);
   pb.data(mName, anchor);
   skipEol(pb);

   if (!pb.eof() && *pb.position() == 'i')
   {
      pb.skipChar('i');
      const char* anchor = pb.skipChar(Symbols::EQUALS[0]);
      pb.skipToOneOf(Symbols::CRLF);
      pb.data(mInformation, anchor);
      skipEol(pb);
   }

   if (!pb.eof() && *pb.position() == 'u')
   {
      pb.skipChar('u');
      pb.skipChar(Symbols::EQUALS[0]);
      mUri.parse(pb);
      skipEol(pb);
   }

   while (!pb.eof() && *pb.position() == 'e')
   {
      addEmail(Email());
      mEmails.back().parse(pb);
   }

   while (!pb.eof() && *pb.position() == 'p')
   {
      addPhone(Phone());
      mPhones.back().parse(pb);
   }

   if (!pb.eof() && *pb.position() == 'c')
   {
      mConnection.parse(pb);
   }

   while (!pb.eof() && *pb.position() == 'b')
   {
      addBandwidth(Bandwidth());
      mBandwidths.back().parse(pb);
   }

   while (!pb.eof() && *pb.position() == 't')
   {
      addTime(Time());
      mTimes.back().parse(pb);
   }

   if (!pb.eof() && *pb.position() == 'z')
   {
      mTimezones.parse(pb);
   }

   if (!pb.eof() && *pb.position() == 'k')
   {
      mEncryption.parse(pb);
   }

   mAttributeHelper.parse(pb);

   while (!pb.eof() && *pb.position() == 'm')
   {
      addMedium(Medium());
      mMedia.back().parse(pb);
   }
}

Here is the call graph for this function:

const Uri& resip::SdpContents::Session::uri ( ) const [inline]

return session Uri

Returns:
Uri line

Definition at line 862 of file SdpContents.hxx.

References mUri.

{return mUri;}
Uri& resip::SdpContents::Session::uri ( ) [inline]

return session Uri

Returns:
Uri line

Definition at line 867 of file SdpContents.hxx.

References mUri.

{return mUri;}
int resip::SdpContents::Session::version ( ) const [inline]

return session version

Returns:
session version

Definition at line 822 of file SdpContents.hxx.

References mVersion.

{return mVersion;}
int& resip::SdpContents::Session::version ( ) [inline]

return session version

Returns:
session version

Definition at line 827 of file SdpContents.hxx.

References mVersion.

{return mVersion;}

Friends And Related Function Documentation

friend class SdpContents [friend]

Definition at line 1009 of file SdpContents.hxx.


Member Data Documentation

Definition at line 1002 of file SdpContents.hxx.

Referenced by connection(), isConnection(), and operator=().

Definition at line 1000 of file SdpContents.hxx.

Referenced by getEmails(), and operator=().

Definition at line 995 of file SdpContents.hxx.

Referenced by clearMedium(), media(), and operator=().

Definition at line 993 of file SdpContents.hxx.

Referenced by operator=(), and origin().

Definition at line 1001 of file SdpContents.hxx.

Referenced by getPhones(), and operator=().

Definition at line 1004 of file SdpContents.hxx.

Referenced by getTimes(), and operator=().

Definition at line 1005 of file SdpContents.hxx.

Referenced by getTimezones(), and operator=().

Definition at line 999 of file SdpContents.hxx.

Referenced by operator=(), and uri().


The documentation for this class was generated from the following files: