|
reSIProcate/stack
9694
|
Represents the "via-parm" element in the RFC 3261 grammar. More...
#include <Via.hxx>


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) | |
| Via & | operator= (const Via &) |
| Data & | protocolName () |
| const Data & | protocolName () const |
| Data & | protocolVersion () |
| const Data & | protocolVersion () const |
| Data & | transport () |
| const Data & | transport () const |
| Data & | sentHost () |
| const Data & | sentHost () const |
| int & | sentPort () |
| int | sentPort () const |
| virtual void | parse (ParseBuffer &pb) |
| virtual ParserCategory * | clone () const |
| virtual ParserCategory * | clone (void *location) const |
| virtual ParserCategory * | clone (PoolBase *pool) const |
| virtual EncodeStream & | encodeParsed (EncodeStream &str) const |
| virtual Parameter * | createParam (ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool) |
| bool | exists (const Param< Via > ¶mType) const |
| void | remove (const Param< Via > ¶mType) |
| 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} |
| anonymous enum |
| 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 }

| Via::Via | ( | const HeaderFieldValue & | hfv, |
| Headers::Type | type, | ||
| PoolBase * | pool = 0 |
||
| ) |
Definition at line 33 of file Via.cxx.
: ParserCategory(hfv, type, pool), mProtocolName(Data::Share,Symbols::ProtocolName), mProtocolVersion(Data::Share,Symbols::ProtocolVersion), mTransport(Data::Share,Symbols::UDP), // !jf! mSentHost(), mSentPort(-1) {}
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) { }
| ParserCategory * Via::clone | ( | ) | const [virtual] |
Implements resip::ParserCategory.
Definition at line 71 of file Via.cxx.
References Via().
{
return new Via(*this);
}

| 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);
}

| 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);
}

| Parameter * Via::createParam | ( | ParameterTypes::Type | type, |
| ParseBuffer & | pb, | ||
| const std::bitset< 256 > & | terminators, | ||
| PoolBase * | pool | ||
| ) | [virtual] |
Reimplemented from resip::ParserCategory.
Definition at line 252 of file Via.cxx.
References resip::ParameterTypes::MAX_PARAMETER, ParameterFactories, type, and resip::ParameterTypes::UNKNOWN.
{
if(type > ParameterTypes::UNKNOWN && type < ParameterTypes::MAX_PARAMETER && ParameterFactories[type])
{
return ParameterFactories[type](type, pb, terminators, pool);
}
return 0;
}
| 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] |
Implements resip::LazyParser.
Definition at line 227 of file Via.cxx.
References resip::Symbols::COLON, resip::ParserCategory::encodeParameters(), resip::DnsUtil::isIpV6Address(), mProtocolName, mProtocolVersion, mSentHost, mSentPort, mTransport, resip::Symbols::SLASH, and resip::Symbols::SPACE.
{
str << mProtocolName << Symbols::SLASH << mProtocolVersion << Symbols::SLASH << mTransport
<< Symbols::SPACE;
if (DnsUtil::isIpV6Address(mSentHost))
{
str << '[' << mSentHost << ']';
}
else
{
str << mSentHost;
}
if (mSentPort != 0)
{
str << Symbols::COLON << mSentPort;
}
encodeParameters(str);
return str;
}

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;
}

Definition at line 56 of file Via.cxx.
References mProtocolName, mProtocolVersion, mSentHost, mSentPort, and mTransport.
{
if (this != &rhs)
{
ParserCategory::operator=(rhs);
mProtocolName = rhs.mProtocolName;
mProtocolVersion = rhs.mProtocolVersion;
mTransport = rhs.mTransport;
mSentHost = rhs.mSentHost;
mSentPort = rhs.mSentPort;
}
return *this;
}
| 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);
}

| Data & Via::protocolName | ( | ) |
Definition at line 89 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mProtocolName.
{
checkParsed();
return mProtocolName;
}

| const Data & Via::protocolName | ( | ) | const |
Definition at line 96 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mProtocolName.
{
checkParsed();
return mProtocolName;
}

| Data & Via::protocolVersion | ( | ) |
Definition at line 103 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mProtocolVersion.
{
checkParsed();
return mProtocolVersion;
}

| const Data & Via::protocolVersion | ( | ) | const |
Definition at line 110 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mProtocolVersion.
{
checkParsed();
return mProtocolVersion;
}

Definition at line 270 of file Via.cxx.
References resip::LazyParser::checkParsed(), resip::ParamBase::getTypeNum(), and resip::ParserCategory::removeParameterByEnum().
Referenced by resip::TransportSelector::transmit().
{
checkParsed();
removeParameterByEnum(paramType.getTypeNum());
}

| Data & Via::sentHost | ( | ) |
Definition at line 131 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mSentHost.
Referenced by main().
{
checkParsed();
return mSentHost;
}

| const Data & Via::sentHost | ( | ) | const |
Definition at line 138 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mSentHost.
{
checkParsed();
return mSentHost;
}

| int & Via::sentPort | ( | ) |
Definition at line 145 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mSentPort.
Referenced by main().
{
checkParsed();
return mSentPort;
}

| int Via::sentPort | ( | ) | const |
Definition at line 152 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mSentPort.
{
checkParsed();
return mSentPort;
}

| Data & Via::transport | ( | ) |
Definition at line 117 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mTransport.
Referenced by main().
{
checkParsed();
return mTransport;
}

| const Data & Via::transport | ( | ) | const |
Definition at line 124 of file Via.cxx.
References resip::LazyParser::checkParsed(), and mTransport.
{
checkParsed();
return mTransport;
}

Data resip::Via::mProtocolName [private] |
Definition at line 73 of file Via.hxx.
Referenced by encodeParsed(), operator=(), parse(), and protocolName().
Data resip::Via::mProtocolVersion [private] |
Definition at line 74 of file Via.hxx.
Referenced by encodeParsed(), operator=(), parse(), and protocolVersion().
Data resip::Via::mSentHost [private] |
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().
Data resip::Via::mTransport [private] |
Definition at line 75 of file Via.hxx.
Referenced by encodeParsed(), operator=(), parse(), and transport().
ParameterTypes::Factory Via::ParameterFactories = {0} [static, private] |
Definition at line 79 of file Via.hxx.
Referenced by createParam().
1.7.5.1