reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SdpCandidatePair.cxx
Go to the documentation of this file.
2
3using namespace sdpcontainer;
4
6{
7 "FROZEN",
8 "WAITING",
9 "INPROGRESS",
10 "SUCCEEDED",
11 "FAILED"
12};
13
15{
16 "LOCAL",
17 "REMOTE"
18};
19
20// Constructor
24: mLocalCandidate(localCandidate)
25, mRemoteCandidate(remoteCandidate)
26, mOfferer(offerer)
27{
28 resetPriority();
29 mCheckState = CHECK_STATE_FROZEN;
30}
31
32// Copy constructor
37
38// Destructor
42
43// Assignment operator
46{
47 if (this == &rhs) // handle the assignment to self case
48 return *this;
49
50 // Assign values
51 mLocalCandidate = rhs.mLocalCandidate;
52 mRemoteCandidate = rhs.mRemoteCandidate;
53 mOfferer = rhs.mOfferer;
54 mPriority = rhs.mPriority;
55 mCheckState = rhs.mCheckState;
56
57 return *this;
58}
59
61{
62 bool stateChangeSuccess=false;
63 switch(mCheckState)
64 {
66 switch(checkState)
67 {
70 mCheckState = checkState;
71 stateChangeSuccess = true;
72 break;
73 default:
74 resip_assert(false);
75 }
76 break;
78 switch(checkState)
79 {
81 mCheckState = checkState;
82 stateChangeSuccess = true;
83 break;
84 default:
85 resip_assert(false);
86 }
87 break;
89 switch(checkState)
90 {
93 mCheckState = checkState;
94 stateChangeSuccess = true;
95 break;
96 default:
97 resip_assert(false);
98 }
99 break;
102 default:
103 resip_assert(false);
104 break;
105 }
106 return stateChangeSuccess;
107}
108
110{
111 if(mPriority != rhs.mPriority)
112 {
113 return mPriority > rhs.mPriority; // We want to order a list of these from highest priority to lowest - so condition is reversed
114 }
115
116 if(mCheckState != rhs.mCheckState)
117 {
118 return mCheckState < rhs.mCheckState;
119 }
120
121 if(mLocalCandidate != rhs.mLocalCandidate)
122 {
123 return mLocalCandidate < rhs.mLocalCandidate;
124 }
125
126 if(mRemoteCandidate != rhs.mRemoteCandidate)
127 {
128 return mRemoteCandidate < rhs.mRemoteCandidate;
129 }
130
131 return false; // equal
132}
133
134#define sdpMin(a,b) (a < b ? a : a > b ? b : a)
135#define sdpMax(a,b) (a > b ? a : a < b ? b : a)
136void SdpCandidatePair::resetPriority()
137{
138 uint64_t offererPriority = mOfferer == OFFERER_LOCAL ? mLocalCandidate.getPriority() : mRemoteCandidate.getPriority();
139 uint64_t answererPriority = mOfferer == OFFERER_LOCAL ? mRemoteCandidate.getPriority() : mLocalCandidate.getPriority();
140 mPriority = (sdpMin(offererPriority, answererPriority)<<32) +
143}
144
147{
148 strm << "SdpCandidatePair:" << std::endl
149 << " Priority: " << sdpCandidatePair.mPriority << std::endl
150 << " State: " << SdpCandidatePair::SdpCandidatePairCheckStateString[sdpCandidatePair.mCheckState] << std::endl
151 << " Offerer: " << SdpCandidatePair::SdpCandidatePairOffererTypeString[sdpCandidatePair.mOfferer] << std::endl
152 << " " << sdpCandidatePair.mLocalCandidate
153 << " " << sdpCandidatePair.mRemoteCandidate;
154
155 return strm;
156}
157
158
159/* ====================================================================
160
161 Copyright (c) 2007-2008, Plantronics, Inc.
162 All rights reserved.
163
164 Redistribution and use in source and binary forms, with or without
165 modification, are permitted provided that the following conditions are
166 met:
167
168 1. Redistributions of source code must retain the above copyright
169 notice, this list of conditions and the following disclaimer.
170
171 2. Redistributions in binary form must reproduce the above copyright
172 notice, this list of conditions and the following disclaimer in the
173 documentation and/or other materials provided with the distribution.
174
175 3. Neither the name of Plantronics nor the names of its contributors
176 may be used to endorse or promote products derived from this
177 software without specific prior written permission.
178
179 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
180 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
182 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
183 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
184 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
185 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
186 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
187 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
188 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
189 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
190
191 ==================================================================== */
192
#define resip_assert(x)
This file needs to work for both C and C++ code.
#define sdpMax(a, b)
#define sdpMin(a, b)
SdpCandidatePair & operator=(const SdpCandidatePair &rhs)
static const char * SdpCandidatePairOffererTypeString[]
SdpCandidatePair(const SdpCandidate &localCandidate, const SdpCandidate &remoteCandidate, SdpCandidatePairOffererType offerer)
bool operator<(const SdpCandidatePair &rhs) const
bool setCheckState(const SdpCandidatePairCheckState checkState)
static const char * SdpCandidatePairCheckStateString[]
EncodeStream & operator<<(EncodeStream &strm, const Sdp &)
Definition Sdp.cxx:304
#define EncodeStream
unsigned __int64 uint64_t
Definition stdint.h:95
void list()
Definition userAdmin.cxx:66