reSIProcate/stack  9694
Public Types | Public Member Functions | Private Attributes | Static Private Attributes
resip::Via Class Reference

Represents the "via-parm" element in the RFC 3261 grammar. More...

#include <Via.hxx>

Inheritance diagram for resip::Via:
Inheritance graph
[legend]
Collaboration diagram for resip::Via:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { commaHandling = CommasAllowedOutputMulti }

Public Member Functions

 Via ()
 Via (const HeaderFieldValue &hfv, Headers::Type type, PoolBase *pool=0)
 Via (const Via &orig, PoolBase *pool=0)
Viaoperator= (const Via &)
DataprotocolName ()
const DataprotocolName () const
DataprotocolVersion ()
const DataprotocolVersion () const
Datatransport ()
const Datatransport () const
DatasentHost ()
const DatasentHost () const
int & sentPort ()
int sentPort () const
virtual void parse (ParseBuffer &pb)
virtual ParserCategoryclone () const
virtual ParserCategoryclone (void *location) const
virtual ParserCategoryclone (PoolBase *pool) const
virtual EncodeStreamencodeParsed (EncodeStream &str) const
virtual ParametercreateParam (ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool)
bool exists (const Param< Via > &paramType) const
void remove (const Param< Via > &paramType)
 defineParam (branch,"branch", BranchParameter,"RFC 3261")
 defineParam (comp,"comp", DataParameter,"RFC 3486")
 defineParam (received,"received", DataParameter,"RFC 3261")
 defineParam (rport,"rport", RportParameter,"RFC 3581")
 defineParam (ttl,"ttl", UInt32Parameter,"RFC 3261")
 defineParam (sigcompId,"sigcomp-id", QuotedDataParameter,"RFC 5049")
 defineParam (maddr,"maddr", DataParameter,"RFC 3261")

Private Attributes

Data mProtocolName
Data mProtocolVersion
Data mTransport
Data mSentHost
int mSentPort

Static Private Attributes

static ParameterTypes::Factory ParameterFactories [ParameterTypes::MAX_PARAMETER] = {0}

Detailed Description

Represents the "via-parm" element in the RFC 3261 grammar.

Definition at line 17 of file Via.hxx.


Member Enumeration Documentation

anonymous enum
Enumerator:
commaHandling 

Definition at line 20 of file Via.hxx.


Constructor & Destructor Documentation

Via::Via ( )

Definition at line 20 of file Via.cxx.

References resip::ParserCategory::param().

Referenced by clone().

   : ParserCategory(), 
     mProtocolName(Data::Share,Symbols::ProtocolName),
     mProtocolVersion(Data::Share,Symbols::ProtocolVersion),
     mTransport(),
     mSentHost(),
     mSentPort(0) 
{
   // insert a branch in all Vias (default constructor)
   this->param(p_branch);
   this->param(p_rport); // add the rport parameter by default as per rfc 3581
}

Here is the call graph for this function:

Via::Via ( const HeaderFieldValue hfv,
Headers::Type  type,
PoolBase pool = 0 
)
Via::Via ( const Via orig,
PoolBase pool = 0 
)

Definition at line 44 of file Via.cxx.

   : ParserCategory(rhs, pool),
     mProtocolName(rhs.mProtocolName),
     mProtocolVersion(rhs.mProtocolVersion),
     mTransport(rhs.mTransport),
     mSentHost(rhs.mSentHost),
     mSentPort(rhs.mSentPort)
{
}

Member Function Documentation

ParserCategory * Via::clone ( ) const [virtual]

Implements resip::ParserCategory.

Definition at line 71 of file Via.cxx.

References Via().

{
   return new Via(*this);
}

Here is the call graph for this function:

ParserCategory * Via::clone ( void *  location) const [virtual]

Implements resip::ParserCategory.

Definition at line 77 of file Via.cxx.

References Via().

{
   return new (location) Via(*this);
}

Here is the call graph for this function:

ParserCategory * Via::clone ( PoolBase pool) const [virtual]

Implements resip::ParserCategory.

Definition at line 83 of file Via.cxx.

References Via().

{
   return new (pool) Via(*this, pool);
}

Here is the call graph for this function:

Parameter * Via::createParam ( ParameterTypes::Type  type,
ParseBuffer pb,
const std::bitset< 256 > &  terminators,
PoolBase pool 
) [virtual]
resip::Via::defineParam ( branch  ,
"branch"  ,
BranchParameter  ,
"RFC 3261"   
)
resip::Via::defineParam ( comp  ,
"comp"  ,
DataParameter  ,
"RFC 3486"   
)
resip::Via::defineParam ( received  ,
"received"  ,
DataParameter  ,
"RFC 3261"   
)
resip::Via::defineParam ( rport  ,
"rport"  ,
RportParameter  ,
"RFC 3581"   
)
resip::Via::defineParam ( ttl  ,
"ttl"  ,
UInt32Parameter  ,
"RFC 3261"   
)
resip::Via::defineParam ( sigcompId  ,
"sigcomp-id"  ,
QuotedDataParameter  ,
"RFC 5049"   
)
resip::Via::defineParam ( maddr  ,
"maddr"  ,
DataParameter  ,
"RFC 3261"   
)
EncodeStream & Via::encodeParsed ( EncodeStream str) const [virtual]
bool Via::exists ( const Param< Via > &  paramType) const

Definition at line 262 of file Via.cxx.

References resip::LazyParser::checkParsed(), resip::ParserCategory::getParameterByEnum(), and resip::ParamBase::getTypeNum().

Referenced by main(), and resip::UdpTransport::processRxParse().

{
    checkParsed();
    bool ret = getParameterByEnum(paramType.getTypeNum()) != NULL;
    return ret;
}

Here is the call graph for this function:

Via & Via::operator= ( const Via rhs)

Definition at line 56 of file Via.cxx.

References mProtocolName, mProtocolVersion, mSentHost, mSentPort, and mTransport.

void Via::parse ( ParseBuffer pb) [virtual]

Implements resip::LazyParser.

Definition at line 159 of file Via.cxx.

References resip::ParseBuffer::assertNotEof(), resip::DnsUtil::canonicalizeIpV6Address(), resip::ParseBuffer::data(), resip::Data::empty(), resip::ParseBuffer::eof(), resip::ParseBuffer::integer(), mProtocolName, mProtocolVersion, mSentHost, mSentPort, mTransport, resip::ParserCategory::parseParameters(), resip::ParseBuffer::position(), resip::ParseBuffer::skipChar(), resip::ParseBuffer::skipNonWhitespace(), resip::ParseBuffer::skipToChar(), resip::ParseBuffer::skipToOneOf(), resip::ParseBuffer::skipWhitespace(), and resip::Data::toBitset().

{
   const char* startMark;
   startMark = pb.skipWhitespace();
   static std::bitset<256> wos=Data::toBitset("\r\n\t /");
   pb.skipToOneOf(wos);
   pb.data(mProtocolName, startMark);
   pb.skipToChar('/');
   pb.skipChar();
   startMark = pb.skipWhitespace();
   pb.skipToOneOf(wos);
   pb.data(mProtocolVersion, startMark);

   pb.skipToChar('/');
   pb.skipChar();
   startMark = pb.skipWhitespace();

   // !jf! this should really be skipTokenChar() since for instance, if the
   // protocol token is missing it will read the rest of the Via into this field
   pb.skipNonWhitespace(); 
   pb.data(mTransport, startMark);
   
   startMark = pb.skipWhitespace();
   pb.assertNotEof();
   if (*startMark == '[')
   {
      startMark = pb.skipChar();
      pb.skipToChar(']');
      pb.data(mSentHost, startMark);
      // .bwc. We do not save this canonicalization, since we weren't doing so
      // before. This may change soon.
      Data canonicalizedHost=DnsUtil::canonicalizeIpV6Address(mSentHost);
      if(canonicalizedHost.empty())
      {
         // .bwc. So the V6 addy is garbage.
         throw ParseException("Unparsable V6 address (note, this might"
                                    " be unparsable because IPV6 support is not"
                                    " enabled)", "Via",
                                       __FILE__,
                                       __LINE__);
      }
      pb.skipChar();
   }
   else
   {
      // .bwc. If we hit whitespace, we have the host.
      static std::bitset<256> delimiter=Data::toBitset(";: \t\r\n");
      pb.skipToOneOf(delimiter);
      pb.data(mSentHost, startMark);
   }

   pb.skipToOneOf(";:");
   
   if (!pb.eof() && *pb.position() == ':')
   {
      startMark = pb.skipChar(':');
      mSentPort = pb.integer();
      static std::bitset<256> delimiter=Data::toBitset("; \t\r\n");
      pb.skipToOneOf(delimiter);
   }
   else
   {
      mSentPort = 0;
   }
   parseParameters(pb);
}

Here is the call graph for this function:

Data & Via::protocolName ( )

Definition at line 89 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mProtocolName.

{
   checkParsed(); 
   return mProtocolName;
}

Here is the call graph for this function:

const Data & Via::protocolName ( ) const

Definition at line 96 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mProtocolName.

{
   checkParsed(); 
   return mProtocolName;
}

Here is the call graph for this function:

Data & Via::protocolVersion ( )

Definition at line 103 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mProtocolVersion.

Here is the call graph for this function:

const Data & Via::protocolVersion ( ) const

Definition at line 110 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mProtocolVersion.

Here is the call graph for this function:

void Via::remove ( const Param< Via > &  paramType)

Definition at line 270 of file Via.cxx.

References resip::LazyParser::checkParsed(), resip::ParamBase::getTypeNum(), and resip::ParserCategory::removeParameterByEnum().

Referenced by resip::TransportSelector::transmit().

Here is the call graph for this function:

Data & Via::sentHost ( )

Definition at line 131 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mSentHost.

Referenced by main().

{
   checkParsed(); 
   return mSentHost;
}

Here is the call graph for this function:

const Data & Via::sentHost ( ) const

Definition at line 138 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mSentHost.

{
   checkParsed(); 
   return mSentHost;
}

Here is the call graph for this function:

int & Via::sentPort ( )

Definition at line 145 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mSentPort.

Referenced by main().

{
   checkParsed(); 
   return mSentPort;
}

Here is the call graph for this function:

int Via::sentPort ( ) const

Definition at line 152 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mSentPort.

{
   checkParsed(); 
   return mSentPort;
}

Here is the call graph for this function:

Data & Via::transport ( )

Definition at line 117 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mTransport.

Referenced by main().

{
   checkParsed(); 
   return mTransport;
}

Here is the call graph for this function:

const Data & Via::transport ( ) const

Definition at line 124 of file Via.cxx.

References resip::LazyParser::checkParsed(), and mTransport.

{
   checkParsed(); 
   return mTransport;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 73 of file Via.hxx.

Referenced by encodeParsed(), operator=(), parse(), and protocolName().

Definition at line 74 of file Via.hxx.

Referenced by encodeParsed(), operator=(), parse(), and protocolVersion().

Definition at line 76 of file Via.hxx.

Referenced by encodeParsed(), operator=(), parse(), and sentHost().

int resip::Via::mSentPort [private]

Definition at line 77 of file Via.hxx.

Referenced by encodeParsed(), operator=(), parse(), and sentPort().

Definition at line 75 of file Via.hxx.

Referenced by encodeParsed(), operator=(), parse(), and transport().

Definition at line 79 of file Via.hxx.

Referenced by createParam().


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