|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Session Sdp related storage, class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <sdpdocument.h> |
|
19 #include <sdpconnectionfield.h> |
|
20 #include <sdpmediafield.h> |
|
21 #include "natfwcandidate.h" |
|
22 #include "natfwcandidatepair.h" |
|
23 #include "natfwcredentials.h" |
|
24 #include "nspsessiondata.h" |
|
25 #include "nspmediastream.h" |
|
26 #include "nspmediastreamcomponent.h" |
|
27 #include "nspcontentparser.h" |
|
28 #include "nspcontrollerif.h" |
|
29 #include "nspdefs.h" |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 // --------------------------------------------------------------------------- |
|
33 // CNSPSessionData::CNSPSessionData |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CNSPSessionData::CNSPSessionData() |
|
37 { |
|
38 } |
|
39 |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CNSPSessionData::ConstructL |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 void CNSPSessionData::ConstructL() |
|
46 { |
|
47 iCredentials = CNATFWCredentials::NewL(); |
|
48 } |
|
49 |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CNSPSessionData::NewL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CNSPSessionData* CNSPSessionData::NewL() |
|
56 { |
|
57 CNSPSessionData* self = CNSPSessionData::NewLC(); |
|
58 CleanupStack::Pop( self ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CNSPSessionData::NewLC |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CNSPSessionData* CNSPSessionData::NewLC() |
|
68 { |
|
69 CNSPSessionData* self = new ( ELeave ) CNSPSessionData(); |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL(); |
|
72 return self; |
|
73 } |
|
74 |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CNSPSessionData::~CNSPSessionData |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 CNSPSessionData::~CNSPSessionData() |
|
81 { |
|
82 delete iOffer; |
|
83 delete iAnswer; |
|
84 delete iCredentials; |
|
85 delete iUpdatedSdp; |
|
86 iRemoteCandidates.ResetAndDestroy(); |
|
87 iRemoteCandidates.Close(); |
|
88 } |
|
89 |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CNSPSessionData::SetOffer |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CNSPSessionData::SetOffer( CSdpDocument* aOffer ) |
|
96 { |
|
97 if ( iOffer != aOffer ) |
|
98 { |
|
99 delete iOffer; |
|
100 iOffer = aOffer; |
|
101 } |
|
102 } |
|
103 |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CNSPSessionData::Offer |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 CSdpDocument& CNSPSessionData::Offer() |
|
110 { |
|
111 return (*iOffer); |
|
112 } |
|
113 |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CNSPSessionData::ReleaseOffer |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 CSdpDocument* CNSPSessionData::ReleaseOffer() |
|
120 { |
|
121 CSdpDocument* offer = iOffer; |
|
122 iOffer = NULL; |
|
123 return offer; |
|
124 } |
|
125 |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CNSPSessionData::SetAnswer |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 void CNSPSessionData::SetAnswer( CSdpDocument* aAnswer ) |
|
132 { |
|
133 if ( iAnswer != aAnswer ) |
|
134 { |
|
135 delete iAnswer; |
|
136 iAnswer = aAnswer; |
|
137 } |
|
138 } |
|
139 |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // CNSPSessionData::Answer |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 CSdpDocument& CNSPSessionData::Answer() |
|
146 { |
|
147 return (*iAnswer); |
|
148 } |
|
149 |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // CNSPSessionData::ReleaseAnswer |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 CSdpDocument* CNSPSessionData::ReleaseAnswer() |
|
156 { |
|
157 CSdpDocument* answer = iAnswer; |
|
158 iAnswer = NULL; |
|
159 return answer; |
|
160 } |
|
161 |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // CNSPSessionData::SetRole |
|
165 // --------------------------------------------------------------------------- |
|
166 // |
|
167 void CNSPSessionData::SetRole( TNATFWIceRole aRole ) |
|
168 { |
|
169 iRole = aRole; |
|
170 } |
|
171 |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // CNSPSessionData::OperationMode |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 TNATFWIceRole CNSPSessionData::Role() const |
|
178 { |
|
179 return iRole; |
|
180 } |
|
181 |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CNSPSessionData::SetUseIce |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 void CNSPSessionData::SetUseIce( TBool aUseIce ) |
|
188 { |
|
189 iUseIce = aUseIce; |
|
190 } |
|
191 |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // CNSPSessionData::UseIce |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 TBool CNSPSessionData::UseIce() const |
|
198 { |
|
199 return iUseIce; |
|
200 } |
|
201 |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // CNSPSessionData::SetSubState |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 void CNSPSessionData::SetSubState( CNSPSessionData::TSubState aSubState ) |
|
208 { |
|
209 switch ( aSubState ) |
|
210 { |
|
211 case CNSPSessionData::ESubMismatch: |
|
212 { |
|
213 iSubState = ( iSubState == CNSPSessionData::ESubRemoteLite ) ? |
|
214 ESubAll : |
|
215 aSubState; |
|
216 break; |
|
217 } |
|
218 case CNSPSessionData::ESubRemoteLite: |
|
219 { |
|
220 iSubState = ( iSubState == CNSPSessionData::ESubMismatch ) ? |
|
221 ESubAll : |
|
222 aSubState; |
|
223 break; |
|
224 } |
|
225 default: |
|
226 { |
|
227 iSubState = aSubState; |
|
228 break; |
|
229 } |
|
230 } |
|
231 } |
|
232 |
|
233 |
|
234 // --------------------------------------------------------------------------- |
|
235 // CNSPSessionData::SubState |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 CNSPSessionData::TSubState CNSPSessionData::SubState() const |
|
239 { |
|
240 return iSubState; |
|
241 } |
|
242 |
|
243 |
|
244 // --------------------------------------------------------------------------- |
|
245 // CNSPSessionData::RemoteCandidates |
|
246 // --------------------------------------------------------------------------- |
|
247 // |
|
248 RPointerArray<CNATFWCandidate>& CNSPSessionData::RemoteCandidates() |
|
249 { |
|
250 return iRemoteCandidates; |
|
251 } |
|
252 |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // CNSPSessionData::Credentials |
|
256 // --------------------------------------------------------------------------- |
|
257 // |
|
258 CNATFWCredentials& CNSPSessionData::Credentials() |
|
259 { |
|
260 return (*iCredentials); |
|
261 } |
|
262 |
|
263 |
|
264 // --------------------------------------------------------------------------- |
|
265 // CNSPSessionData::UpdatedSdp |
|
266 // --------------------------------------------------------------------------- |
|
267 // |
|
268 CSdpDocument& CNSPSessionData::UpdatedSdp() |
|
269 { |
|
270 return (*iUpdatedSdp); |
|
271 } |
|
272 |
|
273 |
|
274 // --------------------------------------------------------------------------- |
|
275 // CNSPSessionData::SetUpdatedSdp |
|
276 // --------------------------------------------------------------------------- |
|
277 // |
|
278 void CNSPSessionData::SetUpdatedSdp( CSdpDocument* aDocument ) |
|
279 { |
|
280 if ( iUpdatedSdp != aDocument ) |
|
281 { |
|
282 delete iUpdatedSdp; |
|
283 iUpdatedSdp = aDocument; |
|
284 } |
|
285 } |
|
286 |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // CNSPSessionData::ReleaseUpdatedSdp |
|
290 // --------------------------------------------------------------------------- |
|
291 // |
|
292 CSdpDocument* CNSPSessionData::ReleaseUpdatedSdp() |
|
293 { |
|
294 CSdpDocument* update = iUpdatedSdp; |
|
295 iUpdatedSdp = NULL; |
|
296 return update; |
|
297 } |
|
298 |
|
299 |
|
300 // end of file |