/src/resiprocate/resip/stack/ConnectionTerminated.hxx
Line | Count | Source |
1 | | #if !defined(RESIP_CONNECTIONTERMINATED_HXX) |
2 | | #define RESIP_CONNECTIONTERMINATED_HXX |
3 | | |
4 | | #include "rutil/HeapInstanceCounter.hxx" |
5 | | #include "resip/stack/TransactionMessage.hxx" |
6 | | #include "resip/stack/TransportFailure.hxx" |
7 | | #include "resip/stack/Tuple.hxx" |
8 | | |
9 | | #include <list> |
10 | | |
11 | | namespace resip |
12 | | { |
13 | | |
14 | | class ConnectionTerminated : public TransactionMessage |
15 | | { |
16 | | public: |
17 | | RESIP_HeapCount(ConnectionTerminated); |
18 | | |
19 | | ConnectionTerminated(const Tuple& flow, |
20 | | TransportFailure::FailureReason failureReason, |
21 | | int failureSubCode, |
22 | | const Data& failureString, |
23 | | const std::list<Data>& additionalFailureStrings) : |
24 | 0 | mFlow(flow), |
25 | 0 | mFailureReason(failureReason), |
26 | 0 | mFailureSubCode(failureSubCode), |
27 | 0 | mFailureString(failureString), |
28 | 0 | mAdditionalFailureStrings(additionalFailureStrings) |
29 | 0 | { |
30 | 0 | } |
31 | 0 | virtual const Data& getTransactionId() const { resip_assert(0); return Data::Empty; } |
32 | 0 | virtual bool isClientTransaction() const { resip_assert(0); return false; } |
33 | 0 | virtual Message* clone() const { return new ConnectionTerminated(mFlow, mFailureReason, mFailureSubCode, mFailureString, mAdditionalFailureStrings); } |
34 | | virtual EncodeStream& encode(EncodeStream& strm) const |
35 | 0 | { |
36 | 0 | encodeBrief(strm); |
37 | 0 | strm << ", failureString=" << mFailureString; |
38 | 0 | for (std::list<Data>::const_iterator it = mAdditionalFailureStrings.begin(); it != mAdditionalFailureStrings.end(); ++it) |
39 | 0 | { |
40 | 0 | strm << std::endl << " " << *it; |
41 | 0 | } |
42 | 0 | return strm; |
43 | 0 | } |
44 | | virtual EncodeStream& encodeBrief(EncodeStream& strm) const |
45 | 0 | { |
46 | 0 | strm << "ConnectionTerminated: flow=" << mFlow |
47 | 0 | << ", failureReason=" << TransportFailure::failureReasonToString(mFailureReason) |
48 | 0 | << ", failureSubCode=" << mFailureSubCode; |
49 | 0 | return strm; |
50 | 0 | } |
51 | | |
52 | 0 | FlowKey getFlowKey() const { return mFlow.mFlowKey; } |
53 | 0 | const Tuple& getFlow() const { return mFlow; } |
54 | 0 | TransportFailure::FailureReason getFailureReason() const { return mFailureReason; } |
55 | 0 | int getFailureSubCode() const { return mFailureSubCode; } |
56 | 0 | const Data& getFailureString() const { return mFailureString; } |
57 | 0 | const std::list<Data>& getAdditionalFailureStrings() const { return mAdditionalFailureStrings; } |
58 | | |
59 | | private: |
60 | | const Tuple mFlow; |
61 | | TransportFailure::FailureReason mFailureReason; |
62 | | int mFailureSubCode; |
63 | | const Data mFailureString; |
64 | | const std::list<Data> mAdditionalFailureStrings; // Note: SSL certificate validation callback errors end up here |
65 | | }; |
66 | | |
67 | | } |
68 | | |
69 | | #endif |
70 | | /* ==================================================================== |
71 | | * The Vovida Software License, Version 1.0 |
72 | | * |
73 | | * Redistribution and use in source and binary forms, with or without |
74 | | * modification, are permitted provided that the following conditions |
75 | | * are met: |
76 | | * |
77 | | * 1. Redistributions of source code must retain the above copyright |
78 | | * notice, this list of conditions and the following disclaimer. |
79 | | * |
80 | | * 2. Redistributions in binary form must reproduce the above copyright |
81 | | * notice, this list of conditions and the following disclaimer in |
82 | | * the documentation and/or other materials provided with the |
83 | | * distribution. |
84 | | * |
85 | | * 3. The names "VOCAL", "Vovida Open Communication Application Library", |
86 | | * and "Vovida Open Communication Application Library (VOCAL)" must |
87 | | * not be used to endorse or promote products derived from this |
88 | | * software without prior written permission. For written |
89 | | * permission, please contact vocal@vovida.org. |
90 | | * |
91 | | * 4. Products derived from this software may not be called "VOCAL", nor |
92 | | * may "VOCAL" appear in their name, without prior written |
93 | | * permission of Vovida Networks, Inc. |
94 | | * |
95 | | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
96 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
97 | | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND |
98 | | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA |
99 | | * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES |
100 | | * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, |
101 | | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
102 | | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
103 | | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
104 | | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
105 | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
106 | | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
107 | | * DAMAGE. |
108 | | * |
109 | | * ==================================================================== |
110 | | * |
111 | | * This software consists of voluntary contributions made by Vovida |
112 | | * Networks, Inc. and many individuals on behalf of Vovida Networks, |
113 | | * Inc. For more information on Vovida Networks, Inc., please see |
114 | | * <http://www.vovida.org/>. |
115 | | * |
116 | | */ |