~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to resip/stack/OctetContents.cxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if defined(HAVE_CONFIG_H)
 
2
#include "config.h"
 
3
#endif
 
4
 
 
5
#include "resip/stack/OctetContents.hxx"
 
6
#include "resip/stack/SipMessage.hxx"
 
7
#include "rutil/Logger.hxx"
 
8
#include "rutil/ParseBuffer.hxx"
 
9
#include "rutil/WinLeakCheck.hxx"
 
10
 
 
11
 
 
12
using namespace resip;
 
13
using namespace std;
 
14
 
 
15
#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
 
16
 
 
17
const OctetContents OctetContents::Empty;
 
18
 
 
19
bool
 
20
OctetContents::init()
 
21
{
 
22
   static ContentsFactory<OctetContents> factory;
 
23
   (void)factory;
 
24
   return true;
 
25
}
 
26
 
 
27
OctetContents::OctetContents()
 
28
   : Contents(getStaticType()),
 
29
     mOctets()
 
30
{}
 
31
 
 
32
OctetContents::OctetContents(const Data& octets)
 
33
   : Contents(getStaticType()),
 
34
     mOctets(octets)
 
35
{}
 
36
 
 
37
OctetContents::OctetContents(const HeaderFieldValue& hfv, const Mime& contentsType)
 
38
   : Contents(hfv, contentsType),
 
39
     mOctets()
 
40
{
 
41
}
 
42
 
 
43
OctetContents::OctetContents(const Data& octets, const Mime& contentsType)
 
44
   : Contents(contentsType),
 
45
     mOctets(octets)
 
46
{
 
47
}
 
48
 
 
49
OctetContents::OctetContents(const OctetContents& rhs)
 
50
   : Contents(rhs),
 
51
     mOctets(rhs.mOctets)
 
52
{
 
53
}
 
54
 
 
55
OctetContents::~OctetContents()
 
56
{
 
57
}
 
58
 
 
59
OctetContents&
 
60
OctetContents::operator=(const OctetContents& rhs)
 
61
{
 
62
   if (this != &rhs)
 
63
   {
 
64
      Contents::operator=(rhs);
 
65
      mOctets = rhs.mOctets;
 
66
   }
 
67
   return *this;
 
68
}
 
69
 
 
70
Contents* 
 
71
OctetContents::clone() const
 
72
{
 
73
   return new OctetContents(*this);
 
74
}
 
75
 
 
76
const Mime& 
 
77
OctetContents::getStaticType() 
 
78
{
 
79
   static Mime type("application","octet-stream");
 
80
   return type;
 
81
}
 
82
 
 
83
EncodeStream& 
 
84
OctetContents::encodeParsed(EncodeStream& str) const
 
85
{
 
86
   //DebugLog(<< "OctetContents::encodeParsed " << mOctets);
 
87
   str << mOctets;
 
88
   return str;
 
89
}
 
90
 
 
91
void 
 
92
OctetContents::parse(ParseBuffer& pb)
 
93
{
 
94
   //DebugLog(<< "OctetContents::parse: " << pb.position());
 
95
 
 
96
   const char* anchor = pb.position();
 
97
   pb.skipToEnd();
 
98
   pb.data(mOctets, anchor);
 
99
 
 
100
   //DebugLog("OctetContents::parsed <" << mOctets << ">" );
 
101
}
 
102
 
 
103
 
 
104
/* ====================================================================
 
105
 * The Vovida Software License, Version 1.0 
 
106
 * 
 
107
 * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
 
108
 * 
 
109
 * Redistribution and use in source and binary forms, with or without
 
110
 * modification, are permitted provided that the following conditions
 
111
 * are met:
 
112
 * 
 
113
 * 1. Redistributions of source code must retain the above copyright
 
114
 *    notice, this list of conditions and the following disclaimer.
 
115
 * 
 
116
 * 2. Redistributions in binary form must reproduce the above copyright
 
117
 *    notice, this list of conditions and the following disclaimer in
 
118
 *    the documentation and/or other materials provided with the
 
119
 *    distribution.
 
120
 * 
 
121
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
 
122
 *    and "Vovida Open Communication Application Library (VOCAL)" must
 
123
 *    not be used to endorse or promote products derived from this
 
124
 *    software without prior written permission. For written
 
125
 *    permission, please contact vocal@vovida.org.
 
126
 *
 
127
 * 4. Products derived from this software may not be called "VOCAL", nor
 
128
 *    may "VOCAL" appear in their name, without prior written
 
129
 *    permission of Vovida Networks, Inc.
 
130
 * 
 
131
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
 
132
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
133
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
 
134
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
 
135
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
 
136
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
 
137
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
138
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 
139
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 
140
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
141
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 
142
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 
143
 * DAMAGE.
 
144
 * 
 
145
 * ====================================================================
 
146
 * 
 
147
 * This software consists of voluntary contributions made by Vovida
 
148
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
 
149
 * Inc.  For more information on Vovida Networks, Inc., please see
 
150
 * <http://www.vovida.org/>.
 
151
 *
 
152
 */