reSIProcate/stack  9694
Message.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/Message.hxx"
00006 #include "rutil/DataStream.hxx"
00007 #include <cassert>
00008 
00009 using namespace resip;
00010 
00011 
00012 Message::Message() : mTu(0) 
00013 {}
00014 
00015 Message::Brief
00016 Message::brief() const
00017 {
00018    return Message::Brief(*this);
00019 }
00020 
00021 Message::Brief::Brief(const Message& source) :
00022    mSource(source)
00023 {
00024 }
00025 
00026 #ifndef  RESIP_USE_STL_STREAMS
00027 std::ostream& 
00028 resip::operator<<(std::ostream& strm, 
00029                   const resip::Message& msg)
00030 {
00031    Data encoded;
00032 
00033    DataStream encodeStream(encoded);
00034    msg.encode(encodeStream);
00035    encodeStream.flush();
00036 
00037    strm << encoded.c_str();
00038 
00039    return strm;
00040 }
00041 
00042 std::ostream& 
00043 resip::operator<<(std::ostream& strm, 
00044                   const resip::Message::Brief& brief)
00045 {
00046    Data encoded;
00047 
00048    DataStream encodeStream(encoded);
00049    brief.mSource.encodeBrief(encodeStream);
00050    encodeStream.flush();
00051 
00052    strm << encoded.c_str();
00053 
00054    return strm;
00055 }
00056 #endif
00057 
00058 EncodeStream& 
00059 resip::operator<<(EncodeStream& strm, 
00060                   const resip::Message& msg)
00061 {
00062    return msg.encode(strm);
00063 }
00064 
00065 EncodeStream& 
00066 resip::operator<<(EncodeStream& strm, 
00067                   const resip::Message::Brief& brief)
00068 {
00069    return brief.mSource.encodeBrief(strm);
00070 }
00071 
00072 /* ====================================================================
00073  * The Vovida Software License, Version 1.0 
00074  * 
00075  * Redistribution and use in source and binary forms, with or without
00076  * modification, are permitted provided that the following conditions
00077  * are met:
00078  * 
00079  * 1. Redistributions of source code must retain the above copyright
00080  *    notice, this list of conditions and the following disclaimer.
00081  * 
00082  * 2. Redistributions in binary form must reproduce the above copyright
00083  *    notice, this list of conditions and the following disclaimer in
00084  *    the documentation and/or other materials provided with the
00085  *    distribution.
00086  * 
00087  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00088  *    and "Vovida Open Communication Application Library (VOCAL)" must
00089  *    not be used to endorse or promote products derived from this
00090  *    software without prior written permission. For written
00091  *    permission, please contact vocal@vovida.org.
00092  *
00093  * 4. Products derived from this software may not be called "VOCAL", nor
00094  *    may "VOCAL" appear in their name, without prior written
00095  *    permission of Vovida Networks, Inc.
00096  * 
00097  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00098  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00099  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00100  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00101  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00102  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00103  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00104  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00105  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00106  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00107  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00108  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00109  * DAMAGE.
00110  * 
00111  * ====================================================================
00112  * 
00113  * This software consists of voluntary contributions made by Vovida
00114  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00115  * Inc.  For more information on Vovida Networks, Inc., please see
00116  * <http://www.vovida.org/>.
00117  *
00118  */