reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
Token.hxx
Go to the documentation of this file.
1#if !defined(RESIP_TOKEN_HXX)
2#define RESIP_TOKEN_HXX
3
4#include <iosfwd>
5#include "rutil/Data.hxx"
8
9namespace resip
10{
11
12
17class Token : public ParserCategory
18{
19 public:
21
22 Token();
23 explicit Token(const Data& d);
24 Token(const HeaderFieldValue& hfv,
25 Headers::Type type,
26 PoolBase* pool=0);
27 Token(const Token& orig,
28 PoolBase* pool=0);
29 Token& operator=(const Token&);
30 bool isEqual(const Token& rhs) const;
31 bool operator==(const Token& rhs) const;
32 bool operator!=(const Token& rhs) const;
33 bool operator<(const Token& rhs) const;
34
38 const Data& value() const;
39 Data& value();
40
41 virtual void parse(ParseBuffer& pb); // remember to call parseParameters()
42 virtual ParserCategory* clone() const;
43 virtual ParserCategory* clone(void* location) const;
44 virtual ParserCategory* clone(PoolBase* pool) const;
45
46 virtual EncodeStream& encodeParsed(EncodeStream& str) const;
47
48 // Inform the compiler that overloads of these may be found in
49 // ParserCategory, too.
53
54 virtual Parameter* createParam(ParameterTypes::Type type, ParseBuffer& pb, const std::bitset<256>& terminators, PoolBase* pool);
55 bool exists(const Param<Token>& paramType) const;
56 void remove(const Param<Token>& paramType);
57
58#define defineParam(_enum, _name, _type, _RFC_ref_ignored) \
59 const _enum##_Param::DType& param(const _enum##_Param& paramType) const; \
60 _enum##_Param::DType& param(const _enum##_Param& paramType); \
61 friend class _enum##_Param
62
63 defineParam(text, "text", ExistsOrDataParameter, "RFC 3840");
64 defineParam(cause, "cause", UInt32Parameter, "RFC 3326");
65 defineParam(dAlg, "d-alg", DataParameter, "RFC 3329");
66 defineParam(dQop, "d-qop", DataParameter, "RFC 3329");
67 defineParam(dVer, "d-ver", QuotedDataParameter, "RFC 3329");
68 defineParam(expires, "expires", UInt32Parameter, "RFC 3261");
69 defineParam(filename, "filename", DataParameter, "RFC 2183");
70 defineParam(fromTag, "from-tag", DataParameter, "RFC 4235");
71 defineParam(handling, "handling", DataParameter, "RFC 3261");
72 defineParam(id, "id", DataParameter, "RFC 3265");
73 defineParam(q, "q", QValueParameter, "RFC 3261");
74 defineParam(reason, "reason", DataParameter, "RFC 3265");
75 defineParam(retryAfter, "retry-after", UInt32Parameter, "RFC 3265");
76 defineParam(toTag, "to-tag", DataParameter, "RFC 4235");
77 defineParam(extension, "ext", DataParameter, "RFC 3966"); // Token is used when ext is a user-parameter
78 defineParam(profileType, "profile-type", DataParameter, "RFC 6080");
79 defineParam(vendor, "vendor", QuotedDataParameter, "RFC 6080");
80 defineParam(model, "model", QuotedDataParameter, "RFC 6080");
81 defineParam(version, "version", QuotedDataParameter, "RFC 6080");
82 defineParam(effectiveBy, "effective-by", UInt32Parameter, "RFC 6080");
83 defineParam(document, "document", DataParameter, "draft-ietf-sipping-config-framework-07 (removed in 08)");
84 defineParam(appId, "app-id", DataParameter, "draft-ietf-sipping-config-framework-05 (renamed to auid in 06, which was then removed in 08)");
85 defineParam(networkUser, "network-user", DataParameter, "draft-ietf-sipping-config-framework-11 (removed in 12)");
86 defineParam(require, "require", ExistsParameter, "RFC 5373");
87
88 defineParam(utranCellId3gpp, "utran-cell-id-3gpp", DataParameter, "RFC 3455"); // P-Access-Network-Info
89 defineParam(cgi3gpp, "cgi-3gpp", DataParameter, "RFC 3455"); // P-Access-Network-Info
90 defineParam(ccf, "ccf", DataParameter, "RFC 3455"); // P-Charging-Function-Addresses
91 defineParam(ecf, "ecf", DataParameter, "RFC 3455"); // P-Charging-Function-Addresses
92 defineParam(icidValue, "icid-value", DataParameter, "RFC 3455"); // P-Charging-Vector
93 defineParam(icidGeneratedAt, "icid-generated-at", DataParameter, "RFC 3455"); // P-Charging-Vector
94 defineParam(origIoi, "orig-ioi", DataParameter, "RFC 3455"); // P-Charging-Vector
95 defineParam(termIoi, "term-ioi", DataParameter, "RFC 3455"); // P-Charging-Vector
96
97#undef defineParam
98
99 private:
100 Data mValue;
101
103};
105
106}
107
108#endif
109
110/* ====================================================================
111 * The Vovida Software License, Version 1.0
112 *
113 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
114 *
115 * Redistribution and use in source and binary forms, with or without
116 * modification, are permitted provided that the following conditions
117 * are met:
118 *
119 * 1. Redistributions of source code must retain the above copyright
120 * notice, this list of conditions and the following disclaimer.
121 *
122 * 2. Redistributions in binary form must reproduce the above copyright
123 * notice, this list of conditions and the following disclaimer in
124 * the documentation and/or other materials provided with the
125 * distribution.
126 *
127 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
128 * and "Vovida Open Communication Application Library (VOCAL)" must
129 * not be used to endorse or promote products derived from this
130 * software without prior written permission. For written
131 * permission, please contact vocal@vovida.org.
132 *
133 * 4. Products derived from this software may not be called "VOCAL", nor
134 * may "VOCAL" appear in their name, without prior written
135 * permission of Vovida Networks, Inc.
136 *
137 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
138 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
139 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
140 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
141 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
142 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
143 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
144 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
145 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
146 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
147 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
148 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
149 * DAMAGE.
150 *
151 * ====================================================================
152 *
153 * This software consists of voluntary contributions made by Vovida
154 * Networks, Inc. and many individuals on behalf of Vovida Networks,
155 * Inc. For more information on Vovida Networks, Inc., please see
156 * <http://www.vovida.org/>.
157 *
158 */
Generically represents miscellaneous parameter data.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Represents various parameters that are indicated to be in effect merely by being present,...
Parameter *(* Factory)(ParameterTypes::Type, ParseBuffer &, const std::bitset< 256 > &terminators, PoolBase *pool)
Provides string-parsing functionality with protection from buffer overflow.
Base class for all SIP grammar elements that can have parameters.
void remove(const ParamBase &paramType)
Removes a natively supported parameter, if the parameter is present.
bool exists(const ParamBase &paramType) const
Checks for the existence of a natively supported parameter.
const Data & param(const ExtensionParameter &param) const
Const accessor for non-natively-supported parameter types.
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact,...
Represents the "q" parameter value of the RFC 3261 grammar.
Generically represents miscellaneous parameter data that is encoded using double quotes.
Represents the "token" element in the RFC 3261 grammar.
Definition Token.hxx:18
defineParam(toTag, "to-tag", DataParameter, "RFC 4235")
defineParam(q, "q", QValueParameter, "RFC 3261")
bool operator!=(const Token &rhs) const
Definition Token.cxx:65
bool exists(const Param< Token > &paramType) const
Definition Token.cxx:139
defineParam(effectiveBy, "effective-by", UInt32Parameter, "RFC 6080")
virtual Parameter * createParam(ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool)
Definition Token.cxx:129
const Data & value() const
Gets the value (ie; no parameters) of this Token as a Data&.
Definition Token.cxx:77
virtual ParserCategory * clone() const
Definition Token.cxx:101
bool isEqual(const Token &rhs) const
Definition Token.cxx:53
defineParam(model, "model", QuotedDataParameter, "RFC 6080")
defineParam(cgi3gpp, "cgi-3gpp", DataParameter, "RFC 3455")
static constexpr CommaHandlingMode commaHandling
Definition Token.hxx:20
defineParam(icidGeneratedAt, "icid-generated-at", DataParameter, "RFC 3455")
virtual EncodeStream & encodeParsed(EncodeStream &str) const
Definition Token.cxx:119
defineParam(cause, "cause", UInt32Parameter, "RFC 3326")
defineParam(expires, "expires", UInt32Parameter, "RFC 3261")
defineParam(dAlg, "d-alg", DataParameter, "RFC 3329")
defineParam(handling, "handling", DataParameter, "RFC 3261")
defineParam(extension, "ext", DataParameter, "RFC 3966")
defineParam(appId, "app-id", DataParameter, "draft-ietf-sipping-config-framework-05 (renamed to auid in 06, which was then removed in 08)")
defineParam(fromTag, "from-tag", DataParameter, "RFC 4235")
defineParam(retryAfter, "retry-after", UInt32Parameter, "RFC 3265")
defineParam(text, "text", ExistsOrDataParameter, "RFC 3840")
bool operator<(const Token &rhs) const
Definition Token.cxx:71
defineParam(filename, "filename", DataParameter, "RFC 2183")
defineParam(dQop, "d-qop", DataParameter, "RFC 3329")
defineParam(profileType, "profile-type", DataParameter, "RFC 6080")
void remove(const Param< Token > &paramType)
Definition Token.cxx:147
defineParam(networkUser, "network-user", DataParameter, "draft-ietf-sipping-config-framework-11 (removed in 12)")
defineParam(vendor, "vendor", QuotedDataParameter, "RFC 6080")
defineParam(reason, "reason", DataParameter, "RFC 3265")
defineParam(require, "require", ExistsParameter, "RFC 5373")
Token & operator=(const Token &)
Definition Token.cxx:42
defineParam(ccf, "ccf", DataParameter, "RFC 3455")
defineParam(dVer, "d-ver", QuotedDataParameter, "RFC 3329")
defineParam(origIoi, "orig-ioi", DataParameter, "RFC 3455")
defineParam(termIoi, "term-ioi", DataParameter, "RFC 3455")
virtual void parse(ParseBuffer &pb)
Definition Token.cxx:91
defineParam(document, "document", DataParameter, "draft-ietf-sipping-config-framework-07 (removed in 08)")
defineParam(utranCellId3gpp, "utran-cell-id-3gpp", DataParameter, "RFC 3455")
defineParam(icidValue, "icid-value", DataParameter, "RFC 3455")
defineParam(version, "version", QuotedDataParameter, "RFC 6080")
defineParam(id, "id", DataParameter, "RFC 3265")
bool operator==(const Token &rhs) const
Definition Token.cxx:59
defineParam(ecf, "ecf", DataParameter, "RFC 3455")
Generically represents unsigned 32-bit integer values conveyed by SIP parameters.
dcm! – add UnusedChecking(_enum) below;
ParserContainer< Token > Tokens
Definition Headers.hxx:114
#define EncodeStream