|
reSIProcate/stack
9694
|
00001 #if defined(HAVE_CONFIG_H) 00002 #include "config.h" 00003 #endif 00004 00005 #include "resip/stack/OctetContents.hxx" 00006 #include "resip/stack/SipMessage.hxx" 00007 #include "rutil/Logger.hxx" 00008 #include "rutil/ParseBuffer.hxx" 00009 #include "rutil/WinLeakCheck.hxx" 00010 00011 00012 using namespace resip; 00013 using namespace std; 00014 00015 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP 00016 00017 const OctetContents OctetContents::Empty; 00018 00019 bool 00020 OctetContents::init() 00021 { 00022 static ContentsFactory<OctetContents> factory; 00023 (void)factory; 00024 return true; 00025 } 00026 00027 OctetContents::OctetContents() 00028 : Contents(getStaticType()), 00029 mOctets() 00030 {} 00031 00032 OctetContents::OctetContents(const Data& octets) 00033 : Contents(getStaticType()), 00034 mOctets(octets) 00035 {} 00036 00037 OctetContents::OctetContents(const HeaderFieldValue& hfv, const Mime& contentsType) 00038 : Contents(hfv, contentsType), 00039 mOctets() 00040 { 00041 } 00042 00043 OctetContents::OctetContents(const Data& octets, const Mime& contentsType) 00044 : Contents(contentsType), 00045 mOctets(octets) 00046 { 00047 } 00048 00049 OctetContents::OctetContents(const OctetContents& rhs) 00050 : Contents(rhs), 00051 mOctets(rhs.mOctets) 00052 { 00053 } 00054 00055 OctetContents::~OctetContents() 00056 { 00057 } 00058 00059 OctetContents& 00060 OctetContents::operator=(const OctetContents& rhs) 00061 { 00062 if (this != &rhs) 00063 { 00064 Contents::operator=(rhs); 00065 mOctets = rhs.mOctets; 00066 } 00067 return *this; 00068 } 00069 00070 Contents* 00071 OctetContents::clone() const 00072 { 00073 return new OctetContents(*this); 00074 } 00075 00076 const Mime& 00077 OctetContents::getStaticType() 00078 { 00079 static Mime type("application","octet-stream"); 00080 return type; 00081 } 00082 00083 EncodeStream& 00084 OctetContents::encodeParsed(EncodeStream& str) const 00085 { 00086 //DebugLog(<< "OctetContents::encodeParsed " << mOctets); 00087 str << mOctets; 00088 return str; 00089 } 00090 00091 void 00092 OctetContents::parse(ParseBuffer& pb) 00093 { 00094 //DebugLog(<< "OctetContents::parse: " << pb.position()); 00095 00096 const char* anchor = pb.position(); 00097 pb.skipToEnd(); 00098 pb.data(mOctets, anchor); 00099 00100 //DebugLog("OctetContents::parsed <" << mOctets << ">" ); 00101 } 00102 00103 00104 /* ==================================================================== 00105 * The Vovida Software License, Version 1.0 00106 * 00107 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00108 * 00109 * Redistribution and use in source and binary forms, with or without 00110 * modification, are permitted provided that the following conditions 00111 * are met: 00112 * 00113 * 1. Redistributions of source code must retain the above copyright 00114 * notice, this list of conditions and the following disclaimer. 00115 * 00116 * 2. Redistributions in binary form must reproduce the above copyright 00117 * notice, this list of conditions and the following disclaimer in 00118 * the documentation and/or other materials provided with the 00119 * distribution. 00120 * 00121 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00122 * and "Vovida Open Communication Application Library (VOCAL)" must 00123 * not be used to endorse or promote products derived from this 00124 * software without prior written permission. For written 00125 * permission, please contact vocal@vovida.org. 00126 * 00127 * 4. Products derived from this software may not be called "VOCAL", nor 00128 * may "VOCAL" appear in their name, without prior written 00129 * permission of Vovida Networks, Inc. 00130 * 00131 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00132 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00133 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00134 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00135 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00136 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00137 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00138 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00139 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00140 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00141 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00142 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00143 * DAMAGE. 00144 * 00145 * ==================================================================== 00146 * 00147 * This software consists of voluntary contributions made by Vovida 00148 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00149 * Inc. For more information on Vovida Networks, Inc., please see 00150 * <http://www.vovida.org/>. 00151 * 00152 */
1.7.5.1