/src/resiprocate/resip/stack/BranchParameter.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | #if !defined(RESIP_BRANCHPARAMETER_HXX) |
2 | | #define RESIP_BRANCHPARAMETER_HXX |
3 | | |
4 | | #include <iosfwd> |
5 | | |
6 | | #include "resip/stack/Parameter.hxx" |
7 | | #include "resip/stack/ParameterTypeEnums.hxx" |
8 | | #include "rutil/Data.hxx" |
9 | | #include "rutil/PoolBase.hxx" |
10 | | |
11 | | namespace resip |
12 | | { |
13 | | |
14 | | class ParseBuffer; |
15 | | |
16 | | // BranchParameter of the form: |
17 | | // rfc3261cookie-sip2cookie-tid-transportseq-clientdata-sip2cookie |
18 | | // Notably, the tid MAY contain dashes by the clientdata MUST NOT. |
19 | | // |
20 | | |
21 | | /** |
22 | | @ingroup sip_grammar |
23 | | @brief Represents the "via-branch" parameter of the RFC 3261 grammar. |
24 | | */ |
25 | | |
26 | | class BranchParameter : public Parameter |
27 | | { |
28 | | public: |
29 | | typedef BranchParameter Type; |
30 | | |
31 | | BranchParameter(ParameterTypes::Type, ParseBuffer& pb, const std::bitset<256>& terminators); |
32 | | explicit BranchParameter(ParameterTypes::Type); |
33 | | |
34 | | ~BranchParameter(); |
35 | | |
36 | | // contains z9hG4bK |
37 | | bool hasMagicCookie() const; |
38 | | |
39 | | // returns tid |
40 | | const Data& getTransactionId() const; |
41 | | |
42 | | // increments the transport sequence component - not part of tid |
43 | | void incrementTransportSequence(); |
44 | | |
45 | | // pseudo-random tid if none specified, zero sequences either way |
46 | | void reset(const Data& transactionId = Data::Empty); |
47 | | |
48 | | // access the client specific portion of the branch - not part of tid |
49 | | Data& clientData(); |
50 | | const Data& clientData() const; |
51 | | |
52 | | // access sigcomp id -- we do pre- and post-processing on this, |
53 | | // so we need "normal" setters and getters |
54 | | void setSigcompCompartment(const Data &); |
55 | | Data getSigcompCompartment() const; |
56 | | |
57 | | static Parameter* decode(ParameterTypes::Type type, |
58 | | ParseBuffer& pb, |
59 | | const std::bitset<256>& terminators, |
60 | | PoolBase* pool) |
61 | 0 | { |
62 | 0 | return new (pool) BranchParameter(type, pb, terminators); |
63 | 0 | } |
64 | | |
65 | | virtual Parameter* clone() const; |
66 | | virtual EncodeStream& encode(EncodeStream& stream) const; |
67 | | |
68 | | BranchParameter(const BranchParameter& other); |
69 | | BranchParameter& operator=(const BranchParameter& other); |
70 | | bool operator==(const BranchParameter& other); |
71 | | |
72 | 0 | Type& value() {return *this;} |
73 | | |
74 | | private: |
75 | | bool mHasMagicCookie; |
76 | | bool mIsMyBranch; |
77 | | Data mTransactionId; |
78 | | unsigned int mTransportSeq; |
79 | | Data mClientData; |
80 | | //magic cookie for interop; if case is different some proxies will treat this as a different tid |
81 | | const Data* mInteropMagicCookie; |
82 | | |
83 | | // If we're compressing, this will hold the compartment ID |
84 | | // for the host that the request was sent to. |
85 | | Data mSigcompCompartment; |
86 | | |
87 | | }; |
88 | | |
89 | | } |
90 | | |
91 | | #endif |
92 | | |
93 | | /* ==================================================================== |
94 | | * The Vovida Software License, Version 1.0 |
95 | | * |
96 | | * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. |
97 | | * |
98 | | * Redistribution and use in source and binary forms, with or without |
99 | | * modification, are permitted provided that the following conditions |
100 | | * are met: |
101 | | * |
102 | | * 1. Redistributions of source code must retain the above copyright |
103 | | * notice, this list of conditions and the following disclaimer. |
104 | | * |
105 | | * 2. Redistributions in binary form must reproduce the above copyright |
106 | | * notice, this list of conditions and the following disclaimer in |
107 | | * the documentation and/or other materials provided with the |
108 | | * distribution. |
109 | | * |
110 | | * 3. The names "VOCAL", "Vovida Open Communication Application Library", |
111 | | * and "Vovida Open Communication Application Library (VOCAL)" must |
112 | | * not be used to endorse or promote products derived from this |
113 | | * software without prior written permission. For written |
114 | | * permission, please contact vocal@vovida.org. |
115 | | * |
116 | | * 4. Products derived from this software may not be called "VOCAL", nor |
117 | | * may "VOCAL" appear in their name, without prior written |
118 | | * permission of Vovida Networks, Inc. |
119 | | * |
120 | | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
121 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
122 | | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND |
123 | | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA |
124 | | * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES |
125 | | * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, |
126 | | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
127 | | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
128 | | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
129 | | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
130 | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
131 | | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
132 | | * DAMAGE. |
133 | | * |
134 | | * ==================================================================== |
135 | | * |
136 | | * This software consists of voluntary contributions made by Vovida |
137 | | * Networks, Inc. and many individuals on behalf of Vovida Networks, |
138 | | * Inc. For more information on Vovida Networks, Inc., please see |
139 | | * <http://www.vovida.org/>. |
140 | | * |
141 | | */ |