/src/resiprocate/resip/stack/Message.hxx
Line | Count | Source |
1 | | #ifndef RESIP_Message_hxx |
2 | | #define RESIP_Message_hxx |
3 | | |
4 | | #ifdef HAVE_CONFIG_H |
5 | | #include "config.h" |
6 | | #endif |
7 | | |
8 | | #include "rutil/Data.hxx" |
9 | | #include <iosfwd> |
10 | | #include "rutil/resipfaststreams.hxx" |
11 | | |
12 | | namespace resip |
13 | | { |
14 | | class TransactionUser; |
15 | | |
16 | | /** |
17 | | @ingroup resip_crit |
18 | | @brief The base-class used for message-passing. |
19 | | */ |
20 | | class Message |
21 | | { |
22 | | public: |
23 | | Message(); |
24 | 9.38k | virtual ~Message() {} |
25 | | |
26 | | /// facet for brief output to streams |
27 | | class Brief |
28 | | { |
29 | | public: |
30 | | Brief(const Message& src); |
31 | | const Message& mSource; |
32 | | }; |
33 | | |
34 | | /// return a facet for brief encoding of message |
35 | | virtual Brief brief() const; |
36 | | virtual Message* clone() const = 0; |
37 | | /// output the entire message to stream |
38 | | virtual EncodeStream& encode(EncodeStream& strm) const = 0; |
39 | | /// output a brief description to stream |
40 | | virtual EncodeStream& encodeBrief(EncodeStream& str) const = 0; |
41 | | |
42 | | protected: |
43 | | friend class TuSelector; |
44 | | friend class TransactionController; |
45 | | friend class TransactionState; |
46 | | friend class SipStack; |
47 | 0 | bool hasTransactionUser() const { return mTu != 0; } |
48 | 0 | void setTransactionUser(TransactionUser* t) { mTu = t; } |
49 | 0 | TransactionUser* getTransactionUser() { return mTu; } |
50 | | TransactionUser* mTu; |
51 | | }; |
52 | | |
53 | | //always need std streams where things are encoded to cout, cerr, DigestStream, etc... |
54 | | #ifndef RESIP_USE_STL_STREAMS |
55 | | EncodeStream& |
56 | | operator<<(EncodeStream& strm, const Message& msg); |
57 | | |
58 | | EncodeStream& |
59 | | operator<<(EncodeStream& strm, const Message::Brief& brief); |
60 | | #endif |
61 | | |
62 | | std::ostream& |
63 | | operator<<(std::ostream& strm, const Message& msg); |
64 | | |
65 | | std::ostream& |
66 | | operator<<(std::ostream& strm, const Message::Brief& brief); |
67 | | |
68 | | } |
69 | | |
70 | | #endif |
71 | | |
72 | | /* ==================================================================== |
73 | | * The Vovida Software License, Version 1.0 |
74 | | * |
75 | | * Redistribution and use in source and binary forms, with or without |
76 | | * modification, are permitted provided that the following conditions |
77 | | * are met: |
78 | | * |
79 | | * 1. Redistributions of source code must retain the above copyright |
80 | | * notice, this list of conditions and the following disclaimer. |
81 | | * |
82 | | * 2. Redistributions in binary form must reproduce the above copyright |
83 | | * notice, this list of conditions and the following disclaimer in |
84 | | * the documentation and/or other materials provided with the |
85 | | * distribution. |
86 | | * |
87 | | * 3. The names "VOCAL", "Vovida Open Communication Application Library", |
88 | | * and "Vovida Open Communication Application Library (VOCAL)" must |
89 | | * not be used to endorse or promote products derived from this |
90 | | * software without prior written permission. For written |
91 | | * permission, please contact vocal@vovida.org. |
92 | | * |
93 | | * 4. Products derived from this software may not be called "VOCAL", nor |
94 | | * may "VOCAL" appear in their name, without prior written |
95 | | * permission of Vovida Networks, Inc. |
96 | | * |
97 | | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
98 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
99 | | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND |
100 | | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA |
101 | | * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES |
102 | | * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, |
103 | | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
104 | | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
105 | | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
106 | | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
107 | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
108 | | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
109 | | * DAMAGE. |
110 | | * |
111 | | * ==================================================================== |
112 | | * |
113 | | * This software consists of voluntary contributions made by Vovida |
114 | | * Networks, Inc. and many individuals on behalf of Vovida Networks, |
115 | | * Inc. For more information on Vovida Networks, Inc., please see |
116 | | * <http://www.vovida.org/>. |
117 | | * |
118 | | */ |
119 | | |