reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
InvalidContents.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
6#include "rutil/Logger.hxx"
9
10using namespace resip;
11using namespace std;
12
13#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
14
15InvalidContents::InvalidContents(const Data& txt, const Mime& originalType)
16 : Contents(getStaticType()),
17 mOriginalType(originalType),
18 mText(txt)
19{}
20
21InvalidContents::InvalidContents(const HeaderFieldValue& hfv, const Mime& contentsType, const Mime& originalType)
22 : Contents(hfv, contentsType),
23 mOriginalType(originalType),
24 mText()
25{
26}
27
28InvalidContents::InvalidContents(const Data& txt, const Mime& contentsType, const Mime& originalType)
29 : Contents(contentsType),
30 mOriginalType(originalType),
31 mText(txt)
32{
33}
34
36 : Contents(rhs),
37 mOriginalType(rhs.mOriginalType),
38 mText(rhs.mText)
39{
40}
41
45
48{
49 if (this != &rhs)
50 {
52 mOriginalType = rhs.mOriginalType;
53 mText = rhs.mText;
54 }
55 return *this;
56}
57
60{
61 return new InvalidContents(*this);
62}
63
64const Mime&
66{
67 static Mime type("Invalid","Invalid");
68 return type;
69}
70
72InvalidContents::encodeParsed(EncodeStream& str) const
73{
74 str << mText;
75 return str;
76}
77
78void
80{
81 const char* anchor = pb.position();
82 pb.skipToEnd();
83 pb.data(mText, anchor);
84}
85
86const Mime&
88{
89 return mOriginalType;
90}
91
92/* ====================================================================
93 * The Vovida Software License, Version 1.0
94 *
95 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
96 *
97 * Redistribution and use in source and binary forms, with or without
98 * modification, are permitted provided that the following conditions
99 * are met:
100 *
101 * 1. Redistributions of source code must retain the above copyright
102 * notice, this list of conditions and the following disclaimer.
103 *
104 * 2. Redistributions in binary form must reproduce the above copyright
105 * notice, this list of conditions and the following disclaimer in
106 * the documentation and/or other materials provided with the
107 * distribution.
108 *
109 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
110 * and "Vovida Open Communication Application Library (VOCAL)" must
111 * not be used to endorse or promote products derived from this
112 * software without prior written permission. For written
113 * permission, please contact vocal@vovida.org.
114 *
115 * 4. Products derived from this software may not be called "VOCAL", nor
116 * may "VOCAL" appear in their name, without prior written
117 * permission of Vovida Networks, Inc.
118 *
119 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
120 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
121 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
122 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
123 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
124 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
125 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
126 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
127 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
128 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
129 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
130 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
131 * DAMAGE.
132 *
133 * ====================================================================
134 *
135 * This software consists of voluntary contributions made by Vovida
136 * Networks, Inc. and many individuals on behalf of Vovida Networks,
137 * Inc. For more information on Vovida Networks, Inc., please see
138 * <http://www.vovida.org/>.
139 *
140 */
Base class for all SIP body types.
Definition Contents.hxx:51
Contents & operator=(const Contents &rhs)
Assignment operator.
Definition Contents.cxx:71
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
SIP body type to represent an invalid content type (MIME content-type Invalid/Invalid).
virtual EncodeStream & encodeParsed(EncodeStream &str) const
static const Mime & getStaticType()
const Mime & getOriginalType() const
Gets the MIME content-type used in the constructor of InvalidContents.
virtual void parse(ParseBuffer &pb)
InvalidContents & operator=(const InvalidContents &rhs)
virtual Contents * clone() const
duplicate an InvalidContents object
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipToEnd()
CurrentPosition position() const
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream