reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
HeaderFieldValue.cxx
Go to the documentation of this file.
1
#if defined(HAVE_CONFIG_H)
2
#include "config.h"
3
#endif
4
5
#include <iostream>
6
7
#include "
resip/stack/UnknownParameter.hxx
"
8
#include "
resip/stack/ExistsParameter.hxx
"
9
#include "
resip/stack/HeaderFieldValue.hxx
"
10
#include "
resip/stack/MsgHeaderScanner.hxx
"
11
#include "
resip/stack/ParserCategory.hxx
"
12
#include "
resip/stack/Symbols.hxx
"
13
#include "
rutil/ParseBuffer.hxx
"
14
#include "
rutil/Logger.hxx
"
15
#include "
rutil/WinLeakCheck.hxx
"
16
17
using namespace
std;
18
using namespace
resip
;
19
20
21
#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
22
23
const
HeaderFieldValue
HeaderFieldValue::Empty
;
24
25
HeaderFieldValue::HeaderFieldValue
(
const
char
* field,
size_t
fieldLength)
26
: mField(field),
27
mFieldLength(fieldLength),
28
mMine(false)
29
{}
30
31
HeaderFieldValue::HeaderFieldValue
(
const
HeaderFieldValue
& hfv)
32
: mField(0),
33
mFieldLength(hfv.mFieldLength),
34
mMine(true)
35
{
36
if
(mFieldLength)
37
{
38
char
* newField =
new
char
[mFieldLength];
39
memcpy(newField, hfv.mField, mFieldLength);
40
mField=newField;
41
}
42
}
43
44
HeaderFieldValue
&
45
HeaderFieldValue::operator=
(
const
HeaderFieldValue
& rhs)
46
{
47
if
(
this
!=&rhs)
48
{
49
mFieldLength=rhs.mFieldLength;
50
if
(mMine)
delete
[] mField;
51
mMine=
true
;
52
if
(mFieldLength)
53
{
54
char
* newField =
new
char
[mFieldLength];
55
memcpy(newField, rhs.mField, mFieldLength);
56
mField=newField;
57
}
58
else
59
{
60
mField=0;
61
}
62
}
63
64
return
*
this
;
65
}
66
67
HeaderFieldValue
&
68
HeaderFieldValue::copyWithPadding
(
const
HeaderFieldValue
& rhs)
69
{
70
if
(
this
!=&rhs)
71
{
72
mFieldLength=rhs.mFieldLength;
73
if
(mMine)
delete
[] mField;
74
mMine=
true
;
75
if
(mFieldLength)
76
{
77
char
* newField =
MsgHeaderScanner::allocateBuffer
(mFieldLength);
78
memcpy(newField, rhs.mField, mFieldLength);
79
mField=newField;
80
}
81
else
82
{
83
mField=0;
84
}
85
}
86
87
return
*
this
;
88
}
89
90
HeaderFieldValue::HeaderFieldValue
(
const
HeaderFieldValue
& hfv,
CopyPaddingEnum
e)
91
: mField(0),
92
mFieldLength(hfv.mFieldLength),
93
mMine(true)
94
{
95
char
* newField =
MsgHeaderScanner::allocateBuffer
(mFieldLength);
96
memcpy(newField, hfv.mField, mFieldLength);
97
mField=newField;
98
}
99
100
HeaderFieldValue::HeaderFieldValue
(
const
HeaderFieldValue
& hfv,
NoOwnershipEnum
n)
101
: mField(hfv.mField),
102
mFieldLength(hfv.mFieldLength),
103
mMine(false)
104
{
105
// ?bwc? assert(!hfv.mMine); ?
106
}
107
108
HeaderFieldValue
&
109
HeaderFieldValue::swap
(
HeaderFieldValue
& orig)
110
{
111
if
(
this
!= &orig)
112
{
113
std::swap(mField, orig.mField);
114
std::swap(mFieldLength, orig.mFieldLength);
115
std::swap(mMine, orig.mMine);
116
}
117
return
*
this
;
118
}
119
120
HeaderFieldValue::~HeaderFieldValue
()
121
{
122
if
(mMine)
123
{
124
delete
[] mField;
125
}
126
}
127
128
EncodeStream
&
129
HeaderFieldValue::encode
(EncodeStream& str)
const
130
{
131
str.write(mField, mFieldLength);
132
return
str;
133
}
134
135
EncodeStream
&
resip::operator<<
(EncodeStream& stream,
HeaderFieldValue
& hfv)
136
{
137
hfv.
encode
(stream);
138
return
stream;
139
}
140
141
/* ====================================================================
142
* The Vovida Software License, Version 1.0
143
*
144
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
145
*
146
* Redistribution and use in source and binary forms, with or without
147
* modification, are permitted provided that the following conditions
148
* are met:
149
*
150
* 1. Redistributions of source code must retain the above copyright
151
* notice, this list of conditions and the following disclaimer.
152
*
153
* 2. Redistributions in binary form must reproduce the above copyright
154
* notice, this list of conditions and the following disclaimer in
155
* the documentation and/or other materials provided with the
156
* distribution.
157
*
158
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
159
* and "Vovida Open Communication Application Library (VOCAL)" must
160
* not be used to endorse or promote products derived from this
161
* software without prior written permission. For written
162
* permission, please contact vocal@vovida.org.
163
*
164
* 4. Products derived from this software may not be called "VOCAL", nor
165
* may "VOCAL" appear in their name, without prior written
166
* permission of Vovida Networks, Inc.
167
*
168
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
169
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
170
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
171
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
172
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
173
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
174
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
175
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
176
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
177
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
178
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
179
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
180
* DAMAGE.
181
*
182
* ====================================================================
183
*
184
* This software consists of voluntary contributions made by Vovida
185
* Networks, Inc. and many individuals on behalf of Vovida Networks,
186
* Inc. For more information on Vovida Networks, Inc., please see
187
* <http://www.vovida.org/>.
188
*
189
*/
ExistsParameter.hxx
HeaderFieldValue.hxx
Logger.hxx
MsgHeaderScanner.hxx
ParseBuffer.hxx
ParserCategory.hxx
Symbols.hxx
UnknownParameter.hxx
WinLeakCheck.hxx
resip::HeaderFieldValue
Definition
HeaderFieldValue.hxx:21
resip::HeaderFieldValue::CopyPaddingEnum
CopyPaddingEnum
Definition
HeaderFieldValue.hxx:26
resip::HeaderFieldValue::swap
HeaderFieldValue & swap(HeaderFieldValue &orig)
Definition
HeaderFieldValue.cxx:109
resip::HeaderFieldValue::encode
EncodeStream & encode(EncodeStream &str) const
Definition
HeaderFieldValue.cxx:129
resip::HeaderFieldValue::Empty
static const HeaderFieldValue Empty
Definition
HeaderFieldValue.hxx:23
resip::HeaderFieldValue::HeaderFieldValue
HeaderFieldValue()
Definition
HeaderFieldValue.hxx:35
resip::HeaderFieldValue::~HeaderFieldValue
~HeaderFieldValue()
Definition
HeaderFieldValue.cxx:120
resip::HeaderFieldValue::NoOwnershipEnum
NoOwnershipEnum
Definition
HeaderFieldValue.hxx:31
resip::HeaderFieldValue::copyWithPadding
HeaderFieldValue & copyWithPadding(const HeaderFieldValue &rhs)
Definition
HeaderFieldValue.cxx:68
resip::HeaderFieldValue::operator=
HeaderFieldValue & operator=(const HeaderFieldValue &)
Definition
HeaderFieldValue.cxx:45
resip::MsgHeaderScanner::allocateBuffer
static char * allocateBuffer(size_t size)
Definition
MsgHeaderScanner.cxx:46
resip
dcm! – add UnusedChecking(_enum) below;
Definition
AbstractFifo.hxx:16
resip::operator<<
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
Definition
BaseException.cxx:25
EncodeStream
#define EncodeStream
Definition
resipfaststreams.hxx:461
resip
stack
HeaderFieldValue.cxx
Generated by
1.9.8