|
1 /* |
|
2 * Copyright (c) 2005 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: base class for all the supl messages |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "epos_comasuplasnmessagebase.h" |
|
22 #include "epos_comasuplsessionid.h" |
|
23 #include "epos_suplconstants.h" |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS OF TOMASuplVersion =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // TOMASuplVersion::TOMASuplVersion,constuctor |
|
29 // (other items were commented in a header). |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 |
|
33 EXPORT_C TOMASuplVersion::TOMASuplVersion() |
|
34 { |
|
35 iMajor = -1; |
|
36 iMinor = -1; |
|
37 iServInd = -1; |
|
38 } |
|
39 // ----------------------------------------------------------------------------- |
|
40 // TOMASuplVersion::SuplVersion() |
|
41 // (other items were commented in a header). |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C void TOMASuplVersion::SuplVersion(TInt& aMajor, |
|
45 TInt& aMinor, |
|
46 TInt& aServInd) const |
|
47 { |
|
48 aMajor = iMajor; |
|
49 aMinor = iMinor; |
|
50 aServInd = iServInd; |
|
51 } |
|
52 // ----------------------------------------------------------------------------- |
|
53 // TOMASuplVersion::SuplVersion() |
|
54 // (other items were commented in a header). |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C void TOMASuplVersion::SetSuplVersion(TInt aMajor, |
|
58 TInt aMinor, |
|
59 TInt aServInd) |
|
60 { |
|
61 iMajor = aMajor; |
|
62 iMinor = aMinor; |
|
63 iServInd = aServInd; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // COMASuplAsnMessageBase::Destructor() |
|
68 // (other items were commented in a header). |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C COMASuplAsnMessageBase::~COMASuplAsnMessageBase() |
|
72 { |
|
73 if(iSessionId) |
|
74 { |
|
75 // delete iSessionId; |
|
76 // iSessionId = NULL; |
|
77 } |
|
78 } |
|
79 // ----------------------------------------------------------------------------- |
|
80 // COMASuplAsnMessageBase::MessageBase() |
|
81 // (other items were commented in a header). |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C void COMASuplAsnMessageBase::MessageBase(TOMASuplVersion& aVersion, |
|
85 COMASuplSessionID*& aSessionId) const |
|
86 { |
|
87 aVersion = iVersion ; |
|
88 aSessionId = iSessionId; |
|
89 } |
|
90 // ----------------------------------------------------------------------------- |
|
91 // COMASuplAsnMessageBase::SessionId() |
|
92 // (other items were commented in a header). |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C void COMASuplAsnMessageBase::SessionId(COMASuplSessionID*& aSessionId) const |
|
96 { |
|
97 aSessionId = iSessionId; |
|
98 } |
|
99 // ----------------------------------------------------------------------------- |
|
100 // COMASuplAsnMessageBase::MessageType() |
|
101 // (other items were commented in a header). |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C COMASuplAsnMessageBase::TSuplMessageType COMASuplAsnMessageBase::MessageType()const |
|
105 { |
|
106 return iMessageType; |
|
107 } |
|
108 // ----------------------------------------------------------------------------- |
|
109 // COMASuplAsnMessageBase::MessageLength() |
|
110 // (other items were commented in a header). |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 EXPORT_C TInt COMASuplAsnMessageBase::MessageLength() const |
|
114 { |
|
115 return iMessageLength; |
|
116 } |
|
117 // ----------------------------------------------------------------------------- |
|
118 // COMASuplAsnMessageBase::SetMessageBase() |
|
119 // (other items were commented in a header). |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C void COMASuplAsnMessageBase::SetMessageBase(const TOMASuplVersion& aVersion, |
|
123 COMASuplSessionID* aSessionId) |
|
124 { |
|
125 iVersion = aVersion ; |
|
126 iSessionId = aSessionId; |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // COMASuplAsnMessageBase::SetMessageLength() |
|
131 // (other items were commented in a header). |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C void COMASuplAsnMessageBase::SetMessageLength(TInt aMessageLength) |
|
135 { |
|
136 iMessageLength = aMessageLength; |
|
137 } |
|
138 // ----------------------------------------------------------------------------- |
|
139 // COMASuplAsnMessageBase::EncodeL() |
|
140 // (other items were commented in a header). |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 EXPORT_C HBufC8* COMASuplAsnMessageBase::EncodeL(TInt& /*aErrorCode*/) |
|
144 { |
|
145 return NULL; |
|
146 } |
|
147 |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // COMASuplAsnMessageBase::InitializeBase() |
|
151 // (other items were commented in a header). |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 EXPORT_C void COMASuplAsnMessageBase::CloneBaseL(const COMASuplAsnMessageBase* aBase,TInt& aErrorCode) |
|
155 { |
|
156 aErrorCode = KErrNone; |
|
157 iVersion = aBase->iVersion; |
|
158 |
|
159 delete iSessionId; |
|
160 iSessionId = NULL; |
|
161 iSessionId = COMASuplSessionID::NewL(); |
|
162 |
|
163 iSessionId->iOptionalMask = aBase->iSessionId->iOptionalMask; |
|
164 |
|
165 if(aBase->iSessionId->iOptionalMask & (1<<(0))) |
|
166 { |
|
167 COMASuplSETSessionID* lSuplSETSessionID = NULL; |
|
168 |
|
169 COMASuplSETSessionID* lSETId = COMASuplSETSessionID::NewL(); |
|
170 |
|
171 aBase->iSessionId->SETSessionID(lSuplSETSessionID); |
|
172 COMASuplSETSessionID::TSuplSETIDType lChoice = lSuplSETSessionID->SuplSETIDType(); |
|
173 |
|
174 TInt lSETSessionID; |
|
175 TBuf8<KIPv6Address> lIPvAddress; |
|
176 lSuplSETSessionID->SuplSETSessionID(lSETSessionID,lIPvAddress); |
|
177 |
|
178 if(COMASuplSETSessionID::EIPv4Address == lChoice) |
|
179 { |
|
180 lSETId->SetSuplSETSessionIDIPv4(lSETSessionID,lIPvAddress); |
|
181 } |
|
182 else if(COMASuplSETSessionID::EIPv6Address == lChoice) |
|
183 { |
|
184 lSETId->SetSuplSETSessionIDIPv6(lSETSessionID,lIPvAddress); |
|
185 } |
|
186 else |
|
187 { |
|
188 lSETId->SetSuplSETSessionIDIMSI(lSETSessionID,lIPvAddress); |
|
189 } |
|
190 |
|
191 iSessionId->SetSETSessionID(lSETId); |
|
192 } |
|
193 |
|
194 if(aBase->iSessionId->iOptionalMask & (1<<(1))) |
|
195 { |
|
196 TBuf8<KIPv6Address> lIPvAddress; |
|
197 TBuf8<KSLPSessionID> lSLPSessionID; |
|
198 |
|
199 COMASuplSLPSessionID* lSuplSLPSessionID = NULL; |
|
200 COMASuplSLPSessionID* lSLPSession = COMASuplSLPSessionID::NewL(); |
|
201 CleanupStack::PushL(lSLPSession); |
|
202 |
|
203 COMASuplSLPAddress* lSLPAddress = NULL; |
|
204 COMASuplSLPAddress* lSLPAddr = COMASuplSLPAddress::NewL(); |
|
205 CleanupStack::PushL(lSLPAddr); |
|
206 |
|
207 aBase->iSessionId->SLPSessionID(lSuplSLPSessionID); |
|
208 lSuplSLPSessionID->SuplSLPSessionID(lSLPSessionID,lSLPAddress); |
|
209 |
|
210 COMASuplSLPAddress::TSuplSLPAddressType lChoice = lSLPAddress->SLPAddressType(); |
|
211 |
|
212 switch(lChoice) |
|
213 { |
|
214 case COMASuplSLPAddress::EIPv4Address: |
|
215 { |
|
216 lSLPAddress->IPvAddress(lIPvAddress); |
|
217 lSLPAddr->SetIPv4Address(lIPvAddress); |
|
218 break; |
|
219 } |
|
220 case COMASuplSLPAddress::EIPv6Address: |
|
221 { |
|
222 lSLPAddress->IPvAddress(lIPvAddress); |
|
223 |
|
224 lSLPAddr->SetIPv6Address(lIPvAddress); |
|
225 break; |
|
226 } |
|
227 case COMASuplSLPAddress::EFqdn: |
|
228 { |
|
229 HBufC8* lFqdn = NULL; |
|
230 lSLPAddress->Fqdn(lFqdn); |
|
231 /* Copy data from tempsessionId to iSessionId*/ |
|
232 HBufC8* lSLPFqdn = HBufC8::NewL(lFqdn->Length()); |
|
233 |
|
234 *lSLPFqdn = *lFqdn; |
|
235 lSLPAddr->SetFqdn(lSLPFqdn); |
|
236 break; |
|
237 } |
|
238 |
|
239 } |
|
240 lSLPSession->SetSuplSLPSessionID(lSLPSessionID,lSLPAddr); |
|
241 iSessionId->SetSLPSessionID(lSLPSession); |
|
242 CleanupStack::Pop(lSLPAddr); |
|
243 CleanupStack::Pop(lSLPSession); |
|
244 } |
|
245 } |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
|
248 // COMASuplAsnMessageBase::SetMessageType() |
|
249 // (other items were commented in a header). |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 EXPORT_C void COMASuplAsnMessageBase::SetMessageType(TSuplMessageType aMessageType) |
|
253 { |
|
254 iMessageType = aMessageType; |
|
255 } |
|
256 |
|
257 // end of file |