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