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

Process c= (connection) lines in SDP. More...

#include <SdpContents.hxx>

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

List of all members.

Public Member Functions

 Connection (AddrType addType, const Data &address, unsigned long ttl=0)
 constructor
 Connection (const Connection &rhs)
Connectionoperator= (const Connection &rhs)
void parse (ParseBuffer &pb)
EncodeStreamencode (EncodeStream &) const
AddrType getAddressType () const
 returns the connection address type
const DatagetAddress () const
 returns the connection address
void setAddress (const Data &host, AddrType type=IP4)
 set the address for the connection
unsigned long ttl () const
unsigned long & ttl ()

Private Member Functions

 Connection ()

Private Attributes

AddrType mAddrType
Data mAddress
unsigned long mTTL

Friends

class Session
class Medium

Detailed Description

Process c= (connection) lines in SDP.

This line specifies the IP address and address type used in the session

Definition at line 336 of file SdpContents.hxx.


Constructor & Destructor Documentation

SdpContents::Session::Connection::Connection ( AddrType  addType,
const Data address,
unsigned long  ttl = 0 
)

constructor

Parameters:
addTypeaddress type (IP4 or IP6)
addressIP address
ttltime to live

Definition at line 480 of file SdpContents.cxx.

   : mAddrType(addType),
     mAddress(address),
     mTTL(ttl)
{}
SdpContents::Session::Connection::Connection ( const Connection rhs)

Definition at line 494 of file SdpContents.cxx.

   : mAddrType(rhs.mAddrType),
     mAddress(rhs.mAddress),
     mTTL(rhs.mTTL)
{
}
SdpContents::Session::Connection::Connection ( ) [private]

Definition at line 488 of file SdpContents.cxx.

   : mAddrType(IP4),
     mAddress(),
     mTTL(0)
{}

Member Function Documentation

EncodeStream & SdpContents::Session::Connection::encode ( EncodeStream s) const

Definition at line 514 of file SdpContents.cxx.

References CRLF, NetworkType, resip::Symbols::SLASH, and resip::Symbols::SPACE.

{
   s << "c=IN "
     << NetworkType[mAddrType] << Symbols::SPACE[0] << mAddress;

   if (mTTL)
   {
      s << Symbols::SLASH[0] << mTTL;
   }
   s << Symbols::CRLF;
   return s;
}
const Data& resip::SdpContents::Session::Connection::getAddress ( ) const [inline]

returns the connection address

Returns:
IP address

Definition at line 365 of file SdpContents.hxx.

References mAddress.

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

{return mAddress;}
AddrType resip::SdpContents::Session::Connection::getAddressType ( ) const [inline]

returns the connection address type

Returns:
address type (IP4 or IP6)

Definition at line 359 of file SdpContents.hxx.

References mAddrType.

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

Definition at line 502 of file SdpContents.cxx.

References mAddress, mAddrType, and mTTL.

{
   if (this != &rhs)
   {
      mAddrType = rhs.mAddrType;
      mAddress = rhs.mAddress;
      mTTL = rhs.mTTL;
   }
   return *this;
}
void SdpContents::Session::Connection::parse ( ParseBuffer pb)

Definition at line 535 of file SdpContents.cxx.

References resip::Symbols::CRLF, resip::ParseBuffer::data(), resip::ParseBuffer::eof(), resip::Symbols::EQUALS, resip::ParseBuffer::integer(), resip::SdpContents::IP4, resip::SdpContents::IP6, NetworkType, resip::ParseBuffer::position(), resip::ParseBuffer::skipChar(), skipEol(), resip::ParseBuffer::skipToChar(), resip::ParseBuffer::skipToOneOf(), resip::Symbols::SLASH, and resip::Symbols::SPACE.

{
   pb.skipChar('c');
   pb.skipChar(Symbols::EQUALS[0]);
   pb.skipChar('I');
   pb.skipChar('N');

   const char* anchor = pb.skipChar(Symbols::SPACE[0]);
   pb.skipToChar(Symbols::SPACE[0]);
   Data addrType;
   pb.data(addrType, anchor);
   if (addrType == NetworkType[IP4])
   {
      mAddrType = IP4;
   }
   else if (addrType == NetworkType[IP6])
   {
      mAddrType = IP6;
   }
   else
   {
      mAddrType = static_cast<AddrType>(0);
   }

   anchor = pb.skipChar();
   pb.skipToOneOf(Symbols::SLASH, Symbols::CRLF);
   pb.data(mAddress, anchor);

   mTTL = 0;
   if (mAddrType == IP4 && !pb.eof() && *pb.position() == Symbols::SLASH[0])
   {
      pb.skipChar();
      mTTL = pb.integer();
   }

   // multicast dealt with above this parser
   if (!pb.eof() && *pb.position() != Symbols::SLASH[0])
   {
      skipEol(pb);
   }
}

Here is the call graph for this function:

void SdpContents::Session::Connection::setAddress ( const Data host,
AddrType  type = IP4 
)

set the address for the connection

Parameters:
hostIP address to associate with the connection
typetype of addressing

Definition at line 528 of file SdpContents.cxx.

{
    mAddress = host;
    mAddrType = addr;
}
unsigned long resip::SdpContents::Session::Connection::ttl ( ) const [inline]

Definition at line 373 of file SdpContents.hxx.

References mTTL.

{return mTTL;}
unsigned long& resip::SdpContents::Session::Connection::ttl ( ) [inline]

Definition at line 374 of file SdpContents.hxx.

References mTTL.

{return mTTL;}

Friends And Related Function Documentation

friend class Medium [friend]

Definition at line 384 of file SdpContents.hxx.

friend class Session [friend]

Definition at line 383 of file SdpContents.hxx.


Member Data Documentation

Definition at line 379 of file SdpContents.hxx.

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

Definition at line 381 of file SdpContents.hxx.

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


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