|
reSIProcate
SIP stack, Dialog Usage Manager and related libraries
|
Base class for all SIP grammar elements that can have parameters. More...
#include <ParserCategory.hxx>
Classes | |
| class | Exception |
| Exception class used by ParserCategory. More... | |
Public Types | |
| enum | { UnknownParserCategory = -1 } |
| enum | CommaHandlingMode { NoCommaTokenizing = 0 , CommasAllowedOutputMulti = 1 , CommasAllowedOutputCommas = 3 } |
| typedef std::set< ParameterTypes::Type > | ParameterTypeSet |
Public Member Functions | |
| ParserCategory (const HeaderFieldValue &headerFieldValue, Headers::Type type, PoolBase *pool=0) | |
| ParserCategory (const char *buf, int length, Headers::Type type, PoolBase *pool=0) | |
| ParserCategory (const ParserCategory &rhs, PoolBase *pool=0) | |
| ParserCategory & | operator= (const ParserCategory &rhs) |
| virtual | ~ParserCategory () |
| virtual ParserCategory * | clone () const =0 |
| virtual Parameter * | createParam (ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool) |
| virtual ParserCategory * | clone (void *location) const =0 |
| virtual ParserCategory * | clone (PoolBase *pool) const =0 |
| bool | exists (const ParamBase ¶mType) const |
| Checks for the existence of a natively supported parameter. | |
| void | remove (const ParamBase ¶mType) |
| Removes a natively supported parameter, if the parameter is present. | |
| const Data & | param (const ExtensionParameter ¶m) const |
| Const accessor for non-natively-supported parameter types. | |
| Data & | param (const ExtensionParameter ¶m) |
| Accessor for non-natively-supported parameter types. | |
| void | remove (const ExtensionParameter ¶m) |
| Removes a non-natively-supported parameter, if the parameter is present. | |
| bool | exists (const ExtensionParameter ¶m) const |
| Checks for the existence of a non-natively-supported parameter. | |
| void | removeParametersExcept (const ParameterTypeSet &set=EmptyParameterTypeSet) |
| Removes all known parameters except those that are specified in set. | |
| void | clearUnknownParameters () |
| void | parseParameters (ParseBuffer &pb) |
| EncodeStream & | encodeParameters (EncodeStream &str) const |
| Encodes parameters as they should appear on the wire. | |
| Data | commutativeParameterHash () const |
| Parameter * | getParameterByEnum (ParameterTypes::Type type) const |
| void | removeParameterByEnum (ParameterTypes::Type type) |
| void | setParameter (const Parameter *parameter) |
| int | numKnownParams () const |
| Returns the number of known (natively supported) parameters. | |
| int | numUnknownParams () const |
| Returns the number of unknown parameters. | |
Public Member Functions inherited from resip::LazyParser | |
| LazyParser (const HeaderFieldValue &headerFieldValue) | |
| LazyParser (const char *buf, int length) | |
| LazyParser (const HeaderFieldValue &headerFieldValue, HeaderFieldValue::CopyPaddingEnum e) | |
| LazyParser (const LazyParser &rhs) | |
| LazyParser (const LazyParser &rhs, HeaderFieldValue::CopyPaddingEnum e) | |
| LazyParser & | operator= (const LazyParser &rhs) |
| virtual | ~LazyParser () |
| virtual EncodeStream & | encodeParsed (EncodeStream &str) const =0 |
| virtual void | parse (ParseBuffer &pb)=0 |
| EncodeStream & | encode (EncodeStream &str) const |
| Encodes this element to a stream, in the fashion it should be represented on the wire. | |
| bool | isParsed () const |
| Returns true iff a parse has been attempted. | |
| HeaderFieldValue & | getHeaderField () |
| void | checkParsed () const |
| void | checkParsed () |
| void | doParse () const |
| void | markDirty () const |
| bool | isWellFormed () const |
| Returns true iff this element was parsed successfully, according to the implementation of parse(). | |
Static Public Attributes | |
| static const ParameterTypeSet | EmptyParameterTypeSet |
Protected Types | |
| typedef std::vector< Parameter *, StlPoolAllocator< Parameter *, PoolBase > > | ParameterList |
Protected Member Functions | |
| ParserCategory (PoolBase *pool=0) | |
| bool | addParameter (Parameter *param) |
| bool | addParameter (UnknownParameter *unknownParam) |
| Parameter * | getParameterByData (const Data &data) const |
| void | removeParameterByData (const Data &data) |
| PoolBase * | getPool () |
| void | freeParameter (Parameter *p) |
| virtual const Data & | errorContext () const |
Protected Member Functions inherited from resip::LazyParser | |
| LazyParser () | |
| void | clear () |
Protected Attributes | |
| ParameterList | mParameters |
| ParameterList | mUnknownParameters |
| PoolBase * | mPool |
| Headers::Type | mHeaderType |
Friends | |
| class | NameAddr |
| EncodeStream & | operator<< (EncodeStream &, const ParserCategory &) |
Base class for all SIP grammar elements that can have parameters.
The pattern for accessing the parameters in a ParserCategory is very similar to accessing headers in a SipMessage. Each parameter type has an access token class (a subclass of ParamBase), and a corresponding ParserCategory::param() function that takes an instance of that subclass as an argument, and returns the correct type for that parameter. Common examples of access-token include p_tag, p_q, p_lr, p_expires, p_branch, etc.
Note the calls to ParserCategory::exists() in the code above; calling ParserCategory::param() when the relevant parameter doesn't exist will either cause the parameter to be created, or an exception to be thrown (if you're working with a const reference).
In some cases, you will need to access parameter-types that are not natively supported by the stack (ie, don't have an access-token). ExtensionParameter will allow you to construct an access-token at runtime that will retrieve the parameter as a raw Data. Here's an example:
Definition at line 84 of file ParserCategory.hxx.
|
protected |
Definition at line 308 of file ParserCategory.hxx.
| typedef std::set<ParameterTypes::Type> resip::ParserCategory::ParameterTypeSet |
Definition at line 189 of file ParserCategory.hxx.
| anonymous enum |
| Enumerator | |
|---|---|
| UnknownParserCategory | |
Definition at line 87 of file ParserCategory.hxx.
| Enumerator | |
|---|---|
| NoCommaTokenizing | |
| CommasAllowedOutputMulti | |
| CommasAllowedOutputCommas | |
Definition at line 95 of file ParserCategory.hxx.
| ParserCategory::ParserCategory | ( | const HeaderFieldValue & | headerFieldValue, |
| Headers::Type | type, | ||
| PoolBase * | pool = 0 |
||
| ) |
Definition at line 30 of file ParserCategory.cxx.
| ParserCategory::ParserCategory | ( | const char * | buf, |
| int | length, | ||
| Headers::Type | type, | ||
| PoolBase * | pool = 0 |
||
| ) |
Definition at line 41 of file ParserCategory.cxx.
| ParserCategory::ParserCategory | ( | const ParserCategory & | rhs, |
| PoolBase * | pool = 0 |
||
| ) |
Definition at line 61 of file ParserCategory.cxx.
|
virtual |
Definition at line 128 of file ParserCategory.cxx.
|
protected |
Definition at line 52 of file ParserCategory.cxx.
|
protected |
Definition at line 263 of file ParserCategory.cxx.
|
protected |
Definition at line 283 of file ParserCategory.cxx.
| void ParserCategory::clearUnknownParameters | ( | ) |
Definition at line 201 of file ParserCategory.cxx.
|
pure virtual |
Implemented in resip::Auth, resip::CallID, resip::CSeqCategory, resip::DateCategory, resip::ExpiresCategory, resip::GenericUri, resip::IdentityCategory, resip::IntegerCategory, resip::Mime, resip::NameAddr, resip::PrivacyCategory, resip::RAckCategory, resip::StringCategory, resip::Token, resip::TokenOrQuotedStringCategory, resip::UInt32Category, resip::Uri, resip::Via, and resip::WarningCategory.
|
pure virtual |
Implemented in resip::Auth, resip::CallID, resip::CSeqCategory, resip::DateCategory, resip::ExpiresCategory, resip::GenericUri, resip::IdentityCategory, resip::IntegerCategory, resip::Mime, resip::NameAddr, resip::PrivacyCategory, resip::RAckCategory, resip::StringCategory, resip::Token, resip::TokenOrQuotedStringCategory, resip::UInt32Category, resip::Uri, resip::Via, and resip::WarningCategory.
|
pure virtual |
Implemented in resip::Auth, resip::CallID, resip::CSeqCategory, resip::DateCategory, resip::ExpiresCategory, resip::GenericUri, resip::IdentityCategory, resip::IntegerCategory, resip::Mime, resip::NameAddr, resip::PrivacyCategory, resip::RAckCategory, resip::StringCategory, resip::Token, resip::TokenOrQuotedStringCategory, resip::UInt32Category, resip::Uri, resip::Via, and resip::WarningCategory.
| Data ParserCategory::commutativeParameterHash | ( | ) | const |
Definition at line 473 of file ParserCategory.cxx.
|
virtual |
Reimplemented in resip::Auth, resip::CallID, resip::ExpiresCategory, resip::GenericUri, resip::IdentityCategory, resip::Mime, resip::NameAddr, resip::Token, resip::TokenOrQuotedStringCategory, resip::UInt32Category, resip::Uri, and resip::Via.
Definition at line 304 of file ParserCategory.cxx.
| EncodeStream & ParserCategory::encodeParameters | ( | EncodeStream & | str | ) | const |
Encodes parameters as they should appear on the wire.
| str | The ostream to encode to. |
Definition at line 312 of file ParserCategory.cxx.
|
protectedvirtual |
Implements resip::LazyParser.
Definition at line 504 of file ParserCategory.cxx.
| bool ParserCategory::exists | ( | const ExtensionParameter & | param | ) | const |
Checks for the existence of a non-natively-supported parameter.
| param | The runtime constructed accessor token. |
Definition at line 175 of file ParserCategory.cxx.
|
inline |
Checks for the existence of a natively supported parameter.
| paramType | The accessor token for the parameter. |
Definition at line 145 of file ParserCategory.hxx.
|
inlineprotected |
Definition at line 292 of file ParserCategory.hxx.
Definition at line 440 of file ParserCategory.cxx.
| Parameter * ParserCategory::getParameterByEnum | ( | ParameterTypes::Type | type | ) | const |
Definition at line 385 of file ParserCategory.cxx.
|
inlineprotected |
Definition at line 287 of file ParserCategory.hxx.
|
inline |
Returns the number of known (natively supported) parameters.
Definition at line 259 of file ParserCategory.hxx.
|
inline |
Returns the number of unknown parameters.
Definition at line 264 of file ParserCategory.hxx.
| ParserCategory & ParserCategory::operator= | ( | const ParserCategory & | rhs | ) |
Definition at line 76 of file ParserCategory.cxx.
| Data & ParserCategory::param | ( | const ExtensionParameter & | param | ) |
Accessor for non-natively-supported parameter types.
Will create the parameter if it does not exist.
| param | The runtime constructed parameter accessor. |
Definition at line 147 of file ParserCategory.cxx.
| const Data & ParserCategory::param | ( | const ExtensionParameter & | param | ) | const |
Const accessor for non-natively-supported parameter types.
| ParserCategory::Exception | if this parameter doesn't exist. |
| param | The runtime constructed parameter accessor. |
Definition at line 134 of file ParserCategory.cxx.
| void ParserCategory::parseParameters | ( | ParseBuffer & | pb | ) |
dlb! @ here?
Definition at line 212 of file ParserCategory.cxx.
| void ParserCategory::remove | ( | const ExtensionParameter & | param | ) |
Removes a non-natively-supported parameter, if the parameter is present.
| param | The accessor token for the parameter. |
Definition at line 168 of file ParserCategory.cxx.
| void ParserCategory::remove | ( | const ParamBase & | paramType | ) |
Removes a natively supported parameter, if the parameter is present.
| paramType | The accessor token for the parameter. |
Definition at line 161 of file ParserCategory.cxx.
|
protected |
Definition at line 454 of file ParserCategory.cxx.
| void ParserCategory::removeParameterByEnum | ( | ParameterTypes::Type | type | ) |
Definition at line 421 of file ParserCategory.cxx.
| void ParserCategory::removeParametersExcept | ( | const ParameterTypeSet & | set = EmptyParameterTypeSet | ) |
Removes all known parameters except those that are specified in set.
| set | The set of parameters to retain, as an enum. |
Definition at line 182 of file ParserCategory.cxx.
| void ParserCategory::setParameter | ( | const Parameter * | parameter | ) |
Definition at line 399 of file ParserCategory.cxx.
|
friend |
Definition at line 317 of file ParserCategory.hxx.
|
friend |
|
static |
Definition at line 191 of file ParserCategory.hxx.
|
protected |
Definition at line 312 of file ParserCategory.hxx.
|
protected |
Definition at line 309 of file ParserCategory.hxx.
|
protected |
Definition at line 311 of file ParserCategory.hxx.
|
protected |
Definition at line 310 of file ParserCategory.hxx.