reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
Via.hxx
Go to the documentation of this file.
1#if !defined(RESIP_VIA_HXX)
2#define RESIP_VIA_HXX
3
4#include <iosfwd>
5#include "rutil/Data.hxx"
8
9namespace resip
10{
11class PoolBase;
12
17class Via : public ParserCategory
18{
19 public:
21
22 Via();
23 Via(const HeaderFieldValue& hfv,
24 Headers::Type type,
25 PoolBase* pool=0);
26 Via(const Via& orig,
27 PoolBase* pool=0);
28 Via& operator=(const Via&);
29
31 const Data& protocolName() const;
33 const Data& protocolVersion() const;
34 Data& transport();
35 const Data& transport() const;
36 Data& sentHost();
37 const Data& sentHost() const;
38 int& sentPort();
39 int sentPort() const;
40
41 virtual void parse(ParseBuffer& pb);
42 virtual ParserCategory* clone() const;
43 virtual ParserCategory* clone(void* location) const;
44 virtual ParserCategory* clone(PoolBase* pool) const;
45 virtual EncodeStream& encodeParsed(EncodeStream& str) const;
46
47 // Inform the compiler that overloads of these may be found in
48 // ParserCategory, too.
52
53 virtual Parameter* createParam(ParameterTypes::Type type, ParseBuffer& pb, const std::bitset<256>& terminators, PoolBase* pool);
54 bool exists(const Param<Via>& paramType) const;
55 void remove(const Param<Via>& paramType);
56
57#define defineParam(_enum, _name, _type, _RFC_ref_ignored) \
58 const _enum##_Param::DType& param(const _enum##_Param& paramType) const; \
59 _enum##_Param::DType& param(const _enum##_Param& paramType); \
60 friend class _enum##_Param
61
62defineParam(branch, "branch", BranchParameter, "RFC 3261");
63defineParam(comp, "comp", DataParameter, "RFC 3486");
64defineParam(received, "received", ReceivedParameter, "RFC 3261");
65defineParam(rport, "rport", RportParameter, "RFC 3581");
66defineParam(ttl, "ttl", UInt32Parameter, "RFC 3261");
67defineParam(sigcompId, "sigcomp-id", QuotedDataParameter, "RFC 5049");
68defineParam(maddr, "maddr", DataParameter, "RFC 3261");
69
70#undef defineParam
71
72 private:
73 Data mProtocolName;
74 Data mProtocolVersion;
75 Data mTransport;
76 Data mSentHost;
77 int mSentPort;
78
80};
82
83
84}
85
86
87#endif
88
89/* ====================================================================
90 * The Vovida Software License, Version 1.0
91 *
92 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
93 *
94 * Redistribution and use in source and binary forms, with or without
95 * modification, are permitted provided that the following conditions
96 * are met:
97 *
98 * 1. Redistributions of source code must retain the above copyright
99 * notice, this list of conditions and the following disclaimer.
100 *
101 * 2. Redistributions in binary form must reproduce the above copyright
102 * notice, this list of conditions and the following disclaimer in
103 * the documentation and/or other materials provided with the
104 * distribution.
105 *
106 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
107 * and "Vovida Open Communication Application Library (VOCAL)" must
108 * not be used to endorse or promote products derived from this
109 * software without prior written permission. For written
110 * permission, please contact vocal@vovida.org.
111 *
112 * 4. Products derived from this software may not be called "VOCAL", nor
113 * may "VOCAL" appear in their name, without prior written
114 * permission of Vovida Networks, Inc.
115 *
116 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
117 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
119 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
120 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
121 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
122 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
123 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
124 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
125 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
127 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
128 * DAMAGE.
129 *
130 * ====================================================================
131 *
132 * This software consists of voluntary contributions made by Vovida
133 * Networks, Inc. and many individuals on behalf of Vovida Networks,
134 * Inc. For more information on Vovida Networks, Inc., please see
135 * <http://www.vovida.org/>.
136 *
137 */
Represents the "via-branch" parameter of the RFC 3261 grammar.
Generically represents miscellaneous parameter data.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
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,...
Generically represents miscellaneous parameter data that is encoded using double quotes.
Represents the "via-received" element in the RFC 3261 grammar.
Represents the "response-port" element of the SIP grammar (as extended in RFC 3581).
Generically represents unsigned 32-bit integer values conveyed by SIP parameters.
Represents the "via-parm" element in the RFC 3261 grammar.
Definition Via.hxx:18
void remove(const Param< Via > &paramType)
Definition Via.cxx:274
defineParam(ttl, "ttl", UInt32Parameter, "RFC 3261")
defineParam(received, "received", ReceivedParameter, "RFC 3261")
Data & transport()
Definition Via.cxx:121
virtual void parse(ParseBuffer &pb)
Definition Via.cxx:163
static constexpr CommaHandlingMode commaHandling
Definition Via.hxx:20
virtual ParserCategory * clone() const
Definition Via.cxx:75
Data & protocolName()
Definition Via.cxx:93
defineParam(branch, "branch", BranchParameter, "RFC 3261")
defineParam(comp, "comp", DataParameter, "RFC 3486")
defineParam(rport, "rport", RportParameter, "RFC 3581")
Via & operator=(const Via &)
Definition Via.cxx:60
bool exists(const Param< Via > &paramType) const
Definition Via.cxx:266
Data & protocolVersion()
Definition Via.cxx:107
defineParam(sigcompId, "sigcomp-id", QuotedDataParameter, "RFC 5049")
defineParam(maddr, "maddr", DataParameter, "RFC 3261")
virtual Parameter * createParam(ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool)
Definition Via.cxx:256
virtual EncodeStream & encodeParsed(EncodeStream &str) const
Definition Via.cxx:231
int & sentPort()
Definition Via.cxx:149
Data & sentHost()
Definition Via.cxx:135
dcm! – add UnusedChecking(_enum) below;
ParserContainer< Via > Vias
Definition Headers.hxx:296
#define EncodeStream