|
1 /* |
|
2 * Copyright (c) 2002-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: Header file for supl response message |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <e32def.h> |
|
22 |
|
23 #include "epos_comasuplresponse.h" |
|
24 #include "epos_comasuplsessionid.h" |
|
25 #include "lbs/epos_eomasuplposerrors.h" |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS of COMASuplSessionID=============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // COMASuplResponse::NewL() |
|
32 // (other items were commented in a header). |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C COMASuplResponse* COMASuplResponse::NewL() |
|
36 { |
|
37 COMASuplResponse* self = new( ELeave ) COMASuplResponse; |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL(); |
|
40 CleanupStack::Pop(self); |
|
41 return self; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // COMASuplResponse::~COMASuplResponse() |
|
46 // (other items were commented in a header). |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C COMASuplResponse::~COMASuplResponse() |
|
50 { |
|
51 |
|
52 if(iSLPAddress) |
|
53 { |
|
54 delete iSLPAddress; |
|
55 iSLPAddress = NULL; |
|
56 } |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // COMASuplResponse::SuplResponse() |
|
61 // (other items were commented in a header). |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C TOMASuplPosMethod COMASuplResponse::SuplResponse()const |
|
65 { |
|
66 return iPosMethod; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // COMASuplResponse::SetSuplResponse() |
|
71 // (other items were commented in a header). |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 EXPORT_C void COMASuplResponse::SetSuplResponse(TOMASuplPosMethod aPosMethod) |
|
75 { |
|
76 iPosMethod = aPosMethod; |
|
77 iPosMethodSet = ETrue; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // COMASuplResponse::SLPAddress() |
|
82 // (other items were commented in a header). |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 EXPORT_C TInt COMASuplResponse::SLPAddress(COMASuplSLPAddress*& aAddress)const |
|
86 { |
|
87 if(iOptionalMask & (1<<(1))) |
|
88 { |
|
89 aAddress = iSLPAddress; |
|
90 return KErrNone; |
|
91 } |
|
92 else |
|
93 { |
|
94 return KErrOMASuplParamNotSet; |
|
95 } |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // COMASuplResponse::SetSLPAddress() |
|
100 // (other items were commented in a header). |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C void COMASuplResponse::SetSLPAddress(COMASuplSLPAddress* aAddress) |
|
104 { |
|
105 delete iSLPAddress; |
|
106 iSLPAddress = NULL; |
|
107 iSLPAddress = aAddress; |
|
108 if(iSLPAddress) |
|
109 { |
|
110 iOptionalMask |= LEFTSHIFT(1); |
|
111 } |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // COMASuplResponse::CloneL() |
|
116 // (other items were commented in a header). |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C void COMASuplResponse::Clone(const COMASuplAsnMessageBase* aResponse,TInt& aErrorCode) |
|
120 { |
|
121 TRAP(aErrorCode, CloneBaseL(aResponse,aErrorCode)); |
|
122 if(aErrorCode) |
|
123 return; |
|
124 COMASuplResponse* response = (COMASuplResponse*)aResponse; |
|
125 iPosMethod = response->iPosMethod; |
|
126 iOptionalMask = response->iOptionalMask; |
|
127 |
|
128 if(iOptionalMask & (1<<(1))) |
|
129 { |
|
130 TRAP(aErrorCode,CloneSLPAddressL(response)); |
|
131 } |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // COMASuplResponse::COMASuplResponse() |
|
136 // (other items were commented in a header). |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 EXPORT_C COMASuplResponse::COMASuplResponse() |
|
140 { |
|
141 |
|
142 } |
|
143 // ----------------------------------------------------------------------------- |
|
144 // COMASuplResponse::ConstructL() |
|
145 // (other items were commented in a header). |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C void COMASuplResponse::ConstructL() |
|
149 { |
|
150 SetMessageType(COMASuplAsnMessageBase::ESUPL_RESPONSE); |
|
151 iPosMethodSet = EFalse; |
|
152 iOptionalMask = 0; |
|
153 } |
|
154 // ----------------------------------------------------------------------------- |
|
155 // COMASuplResponse::CloneSLPAddress() |
|
156 // (other items were commented in a header). |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 void COMASuplResponse::CloneSLPAddressL(const COMASuplResponse* aSuplResponse) |
|
160 { |
|
161 TBuf8<KIPv6Address> lIPvAddress; |
|
162 |
|
163 COMASuplSLPAddress* cloneSLPAddress = NULL; |
|
164 |
|
165 delete iSLPAddress; |
|
166 iSLPAddress = NULL; |
|
167 iSLPAddress = COMASuplSLPAddress::NewL(); |
|
168 |
|
169 aSuplResponse->SLPAddress(cloneSLPAddress); |
|
170 COMASuplSLPAddress::TSuplSLPAddressType lChoice = cloneSLPAddress->SLPAddressType(); |
|
171 |
|
172 switch(lChoice) |
|
173 { |
|
174 case COMASuplSLPAddress::EIPv4Address: |
|
175 { |
|
176 cloneSLPAddress->IPvAddress(lIPvAddress); |
|
177 iSLPAddress->SetIPv4Address(lIPvAddress); |
|
178 break; |
|
179 } |
|
180 case COMASuplSLPAddress::EIPv6Address: |
|
181 { |
|
182 cloneSLPAddress->IPvAddress(lIPvAddress); |
|
183 |
|
184 iSLPAddress->SetIPv6Address(lIPvAddress); |
|
185 break; |
|
186 } |
|
187 case COMASuplSLPAddress::EFqdn: |
|
188 { |
|
189 HBufC8* cloneFqdn = NULL; |
|
190 cloneSLPAddress->Fqdn(cloneFqdn); |
|
191 |
|
192 HBufC8* fqdn = HBufC8::NewL(cloneFqdn->Length()); |
|
193 |
|
194 *fqdn = *cloneFqdn; |
|
195 iSLPAddress->SetFqdn(fqdn); |
|
196 |
|
197 break; |
|
198 } |
|
199 } |
|
200 } |
|
201 |
|
202 |