/[resiprocate]/main/sip/resiprocate/StatusLine.cxx
ViewVC logotype

Contents of /main/sip/resiprocate/StatusLine.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4599 - (show annotations) (download)
Wed May 11 23:10:19 2005 UTC (14 years, 7 months ago) by derek
File size: 4723 byte(s)
set svn:eol-style to LF
1 #if defined(HAVE_CONFIG_H)
2 #include "resiprocate/config.hxx"
3 #endif
4
5 #include "resiprocate/StatusLine.hxx"
6 #include "resiprocate/os/Data.hxx"
7 #include "resiprocate/os/DnsUtil.hxx"
8 #include "resiprocate/os/Logger.hxx"
9 #include "resiprocate/os/ParseBuffer.hxx"
10 #include "resiprocate/os/WinLeakCheck.hxx"
11
12 using namespace resip;
13 using namespace std;
14
15 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
16
17 //====================
18 // StatusLine:
19 //====================
20 StatusLine::StatusLine()
21 : ParserCategory(),
22 mResponseCode(-1),
23 mSipVersion(Symbols::DefaultSipVersion),
24 mReason()
25 {}
26
27 StatusLine::StatusLine(HeaderFieldValue* hfv, Headers::Type type)
28 : ParserCategory(hfv, type),
29 mResponseCode(-1),
30 mSipVersion(Symbols::DefaultSipVersion),
31 mReason()
32 {}
33
34 StatusLine::StatusLine(const StatusLine& rhs)
35 : ParserCategory(rhs),
36 mResponseCode(rhs.mResponseCode),
37 mSipVersion(rhs.mSipVersion),
38 mReason(rhs.mReason)
39 {}
40
41 StatusLine&
42 StatusLine::operator=(const StatusLine& rhs)
43 {
44 if (this != &rhs)
45 {
46 ParserCategory::operator=(rhs);
47 mResponseCode = rhs.mResponseCode;
48 mSipVersion = rhs.mSipVersion;
49 mReason = rhs.mReason;
50 }
51 return *this;
52 }
53
54 ParserCategory *
55 StatusLine::clone() const
56 {
57 return new StatusLine(*this);
58 }
59
60 int&
61 StatusLine::responseCode()
62 {
63 checkParsed();
64 return mResponseCode;
65 }
66
67 int
68 StatusLine::responseCode() const
69 {
70 checkParsed();
71 return mResponseCode;
72 }
73
74 int&
75 StatusLine::statusCode()
76 {
77 checkParsed();
78 return mResponseCode;
79 }
80
81 int
82 StatusLine::statusCode() const
83 {
84 checkParsed();
85 return mResponseCode;
86 }
87
88 const Data&
89 StatusLine::getSipVersion() const
90 {
91 checkParsed();
92 return mSipVersion;
93 }
94
95 Data&
96 StatusLine::reason()
97 {
98 checkParsed();
99 return mReason;
100 }
101
102 const Data&
103 StatusLine::reason() const
104 {
105 checkParsed();
106 return mReason;
107 }
108
109 void
110 StatusLine::parse(ParseBuffer& pb)
111 {
112 const char* start = pb.skipWhitespace();
113 pb.skipNonWhitespace();
114 pb.data(mSipVersion, start);
115
116 start = pb.skipWhitespace();
117 mResponseCode = pb.integer();
118 start = pb.skipWhitespace();
119 pb.reset(pb.end());
120 pb.data(mReason, start);
121 }
122
123 ostream&
124 StatusLine::encodeParsed(ostream& str) const
125 {
126 str << mSipVersion << Symbols::SPACE
127 << mResponseCode << Symbols::SPACE
128 << mReason;
129 return str;
130 }
131
132 /* ====================================================================
133 * The Vovida Software License, Version 1.0
134 *
135 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
136 *
137 * Redistribution and use in source and binary forms, with or without
138 * modification, are permitted provided that the following conditions
139 * are met:
140 *
141 * 1. Redistributions of source code must retain the above copyright
142 * notice, this list of conditions and the following disclaimer.
143 *
144 * 2. Redistributions in binary form must reproduce the above copyright
145 * notice, this list of conditions and the following disclaimer in
146 * the documentation and/or other materials provided with the
147 * distribution.
148 *
149 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
150 * and "Vovida Open Communication Application Library (VOCAL)" must
151 * not be used to endorse or promote products derived from this
152 * software without prior written permission. For written
153 * permission, please contact vocal@vovida.org.
154 *
155 * 4. Products derived from this software may not be called "VOCAL", nor
156 * may "VOCAL" appear in their name, without prior written
157 * permission of Vovida Networks, Inc.
158 *
159 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
160 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
161 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
162 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
163 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
164 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
165 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
166 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
167 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
168 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
169 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
170 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
171 * DAMAGE.
172 *
173 * ====================================================================
174 *
175 * This software consists of voluntary contributions made by Vovida
176 * Networks, Inc. and many individuals on behalf of Vovida Networks,
177 * Inc. For more information on Vovida Networks, Inc., please see
178 * <http://www.vovida.org/>.
179 *
180 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27