reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
RportParameter.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
8#include "rutil/Logger.hxx"
11
12using namespace resip;
13using namespace std;
14
15#define RESIPROCATE_SUBSYSTEM resip::Subsystem::SIP
16
18 ParseBuffer& pb,
19 const std::bitset<256>& terminators)
20 : Parameter(type),
21 mValue(0),
22 mHasValue(false)
23{
24 pb.skipWhitespace();
25 if (!pb.eof() && *pb.position() == Symbols::EQUALS[0])
26 {
27 mHasValue = true;
28
29 pb.skipChar();
30 pb.skipWhitespace();
31
32 // Catch the exception gracefully to handle seeing ;rport=
33 try
34 {
35 mValue = pb.integer();
36 }
37 catch(BaseException& e )
38 {
39 ErrLog(<<"Caught exception: "<< e);
40 mHasValue = false;
41 }
42 }
43}
44
46 : Parameter(type),
47 mValue(value),
48 mHasValue(true)
49{
50}
51
53 : Parameter(type),
54 mValue(-1),
55 mHasValue(false)
56{
57}
58
61{
62 return new RportParameter(*this);
63}
64
66RportParameter::encode(EncodeStream& stream) const
67{
68 if (mHasValue || mValue > 0)
69 {
70 return stream << getName() << Symbols::EQUALS << mValue;
71 }
72 else
73 {
74 return stream << getName();
75 }
76}
77
78
79/* ====================================================================
80 * The Vovida Software License, Version 1.0
81 *
82 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
83 *
84 * Redistribution and use in source and binary forms, with or without
85 * modification, are permitted provided that the following conditions
86 * are met:
87 *
88 * 1. Redistributions of source code must retain the above copyright
89 * notice, this list of conditions and the following disclaimer.
90 *
91 * 2. Redistributions in binary form must reproduce the above copyright
92 * notice, this list of conditions and the following disclaimer in
93 * the documentation and/or other materials provided with the
94 * distribution.
95 *
96 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
97 * and "Vovida Open Communication Application Library (VOCAL)" must
98 * not be used to endorse or promote products derived from this
99 * software without prior written permission. For written
100 * permission, please contact vocal@vovida.org.
101 *
102 * 4. Products derived from this software may not be called "VOCAL", nor
103 * may "VOCAL" appear in their name, without prior written
104 * permission of Vovida Networks, Inc.
105 *
106 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
107 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
108 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
109 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
110 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
111 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
112 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
113 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
114 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
115 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
116 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
117 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
118 * DAMAGE.
119 *
120 * ====================================================================
121 *
122 * This software consists of voluntary contributions made by Vovida
123 * Networks, Inc. and many individuals on behalf of Vovida Networks,
124 * Inc. For more information on Vovida Networks, Inc., please see
125 * <http://www.vovida.org/>.
126 *
127 */
#define ErrLog(args_)
Definition Logger.hxx:137
The abstract base-class for all exceptions thrown by resip code.
virtual const Data & getName() const
Definition Parameter.cxx:23
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipWhitespace()
CurrentPosition position() const
CurrentPosition skipChar()
Represents the "response-port" element of the SIP grammar (as extended in RFC 3581).
virtual Parameter * clone() const
RportParameter(ParameterTypes::Type, ParseBuffer &pb, const std::bitset< 256 > &terminators)
virtual EncodeStream & encode(EncodeStream &stream) const
static const char * EQUALS
Definition Symbols.hxx:29
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream