reSIProcate/stack  9694
Message.hxx
Go to the documentation of this file.
00001 #ifndef RESIP_Message_hxx
00002 #define RESIP_Message_hxx 
00003 
00004 #ifdef HAVE_CONFIG_H
00005 #include "config.h"
00006 #endif
00007 
00008 #include "rutil/Data.hxx"
00009 #include <iosfwd>
00010 #include "rutil/resipfaststreams.hxx"
00011 
00012 namespace resip
00013 {
00014 class TransactionUser;
00015 
00020 class Message 
00021 {
00022    public:
00023       Message();
00024       virtual ~Message() {}
00025 
00027       class Brief
00028       {
00029          public:
00030             Brief(const Message& src);
00031             const Message& mSource;
00032       };
00033 
00035       Brief brief() const;
00036       virtual Message* clone() const = 0;
00038       virtual EncodeStream& encode(EncodeStream& strm) const = 0;
00040       virtual EncodeStream& encodeBrief(EncodeStream& str) const = 0; 
00041 
00042    protected:
00043       friend class TuSelector;
00044       friend class TransactionController;
00045       friend class TransactionState;
00046       friend class SipStack;
00047       bool hasTransactionUser() const { return mTu != 0; }
00048       void setTransactionUser(TransactionUser* t) { mTu = t; }
00049       TransactionUser* getTransactionUser() { return mTu; }
00050       TransactionUser* mTu;      
00051 };
00052 
00053 //always need std streams where things are encoded to cout, cerr, MD5Stream, etc...
00054 #ifndef  RESIP_USE_STL_STREAMS
00055 EncodeStream& 
00056 operator<<(EncodeStream& strm, const Message& msg);
00057 
00058 EncodeStream& 
00059 operator<<(EncodeStream& strm, const Message::Brief& brief);
00060 #endif
00061 
00062 std::ostream& 
00063 operator<<(std::ostream& strm, const Message& msg);
00064 
00065 std::ostream& 
00066 operator<<(std::ostream& strm, const Message::Brief& brief);
00067 
00068 }
00069 
00070 #endif
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  */
00119