/src/resiprocate/resip/stack/Message.cxx
Line | Count | Source (jump to first uncovered line) |
1 | | #if defined(HAVE_CONFIG_H) |
2 | | #include "config.h" |
3 | | #endif |
4 | | |
5 | | #include "resip/stack/Message.hxx" |
6 | | #include "rutil/DataStream.hxx" |
7 | | #include "rutil/ResipAssert.h" |
8 | | |
9 | | using namespace resip; |
10 | | |
11 | | |
12 | | Message::Message() : mTu(0) |
13 | 9.98k | {} |
14 | | |
15 | | Message::Brief |
16 | | Message::brief() const |
17 | 0 | { |
18 | 0 | return Message::Brief(*this); |
19 | 0 | } |
20 | | |
21 | | Message::Brief::Brief(const Message& source) : |
22 | | mSource(source) |
23 | 0 | { |
24 | 0 | } |
25 | | |
26 | | std::ostream& |
27 | | resip::operator<<(std::ostream& strm, |
28 | | const resip::Message& msg) |
29 | 0 | { |
30 | 0 | Data encoded; |
31 | |
|
32 | 0 | DataStream encodeStream(encoded); |
33 | 0 | msg.encode(encodeStream); |
34 | 0 | encodeStream.flush(); |
35 | |
|
36 | 0 | strm << encoded.c_str(); |
37 | |
|
38 | 0 | return strm; |
39 | 0 | } |
40 | | |
41 | | std::ostream& |
42 | | resip::operator<<(std::ostream& strm, |
43 | | const resip::Message::Brief& brief) |
44 | 0 | { |
45 | 0 | Data encoded; |
46 | |
|
47 | 0 | DataStream encodeStream(encoded); |
48 | 0 | brief.mSource.encodeBrief(encodeStream); |
49 | 0 | encodeStream.flush(); |
50 | |
|
51 | 0 | strm << encoded.c_str(); |
52 | |
|
53 | 0 | return strm; |
54 | 0 | } |
55 | | |
56 | | #ifndef RESIP_USE_STL_STREAMS |
57 | | EncodeStream& |
58 | | resip::operator<<(EncodeStream& strm, |
59 | | const resip::Message& msg) |
60 | | { |
61 | | return msg.encode(strm); |
62 | | } |
63 | | |
64 | | EncodeStream& |
65 | | resip::operator<<(EncodeStream& strm, |
66 | | const resip::Message::Brief& brief) |
67 | | { |
68 | | return brief.mSource.encodeBrief(strm); |
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 | | */ |