|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Assigns default values to various packet context related structures |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include "DefaultContextParameters.h" |
|
24 |
|
25 _LIT(KTxtSimTsy,"SIM"); |
|
26 TName KSimTsyName(KTxtSimTsy); |
|
27 TName& SimTsyName() |
|
28 { |
|
29 return KSimTsyName; |
|
30 } |
|
31 |
|
32 _LIT(apn, "ACME INTERNET PROVIDERS LTD"); |
|
33 _LIT(protocolAddress, "i-MODE GATEWAY"); |
|
34 _LIT(username, "USER1"); |
|
35 _LIT(password, "PASSWORD1"); |
|
36 _LIT(challenge, "CHALLENGE1"); |
|
37 _LIT(response, "RESPONSE1"); |
|
38 _LIT(primaryDNS, "PRIMARYSERVER1"); |
|
39 _LIT(secondaryDNS, "SECONDARYSERVER1"); |
|
40 |
|
41 void DefaultContextConfigGPRS(RPacketContext::TContextConfigGPRS& aParam) |
|
42 { |
|
43 aParam.iPdpType = static_cast<RPacketContext::TProtocolType>(1); |
|
44 aParam.iAccessPointName.Copy(apn); |
|
45 aParam.iPdpAddress.Copy(protocolAddress); |
|
46 aParam.iPdpCompression = 1; |
|
47 aParam.iAnonymousAccessReqd = static_cast<RPacketContext::TAnonymousAccess>(1); |
|
48 aParam.iUseEdge = ETrue; |
|
49 aParam.iProtocolConfigOption.iAuthInfo.iProtocol = static_cast<RPacketContext::TAuthProtocol>(1); |
|
50 aParam.iProtocolConfigOption.iAuthInfo.iUsername.Copy(username); |
|
51 aParam.iProtocolConfigOption.iAuthInfo.iPassword.Copy(password); |
|
52 aParam.iProtocolConfigOption.iChallenge.Copy(challenge); |
|
53 aParam.iProtocolConfigOption.iResponse.Copy(response); |
|
54 aParam.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(primaryDNS); |
|
55 aParam.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(secondaryDNS); |
|
56 aParam.iProtocolConfigOption.iId = 1; |
|
57 } |
|
58 |
|
59 void DefaultQoSR99_R4Requested(RPacketQoS::TQoSR99_R4Requested& aQosRequested) |
|
60 { |
|
61 aQosRequested.iReqTrafficClass = static_cast<RPacketQoS::TTrafficClass>(2); |
|
62 aQosRequested.iMinTrafficClass = static_cast<RPacketQoS::TTrafficClass>(2); |
|
63 aQosRequested.iReqDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(2); |
|
64 aQosRequested.iMinDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(2); |
|
65 aQosRequested.iReqDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(2); |
|
66 aQosRequested.iMinDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(2); |
|
67 aQosRequested.iReqMaxSDUSize = 2; |
|
68 aQosRequested.iMinAcceptableMaxSDUSize = 2; |
|
69 aQosRequested.iReqMaxRate.iUplinkRate = 2; |
|
70 aQosRequested.iReqMaxRate.iDownlinkRate = 2; |
|
71 aQosRequested.iMinGuaranteedRate.iUplinkRate = 2; |
|
72 aQosRequested.iMinGuaranteedRate.iDownlinkRate = 2; |
|
73 aQosRequested.iReqBER = static_cast<RPacketQoS::TBitErrorRatio>(2); |
|
74 aQosRequested.iMaxBER = static_cast<RPacketQoS::TBitErrorRatio>(2); |
|
75 aQosRequested.iReqSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(2); |
|
76 aQosRequested.iMaxSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(2); |
|
77 aQosRequested.iReqTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(2); |
|
78 aQosRequested.iMinTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(2); |
|
79 aQosRequested.iReqTransferDelay = 2; |
|
80 aQosRequested.iMaxTransferDelay = 2; |
|
81 aQosRequested.iReqGuaranteedRate.iUplinkRate = 2; |
|
82 aQosRequested.iReqGuaranteedRate.iDownlinkRate = 2; |
|
83 aQosRequested.iMinGuaranteedRate.iUplinkRate = 2; |
|
84 aQosRequested.iMinGuaranteedRate.iDownlinkRate = 2; |
|
85 } |
|
86 |
|
87 void SecondQoSR99_R4Requested(RPacketQoS::TQoSR99_R4Requested& aQosRequested) |
|
88 { |
|
89 aQosRequested.iReqTrafficClass = static_cast<RPacketQoS::TTrafficClass>(1); |
|
90 aQosRequested.iMinTrafficClass = static_cast<RPacketQoS::TTrafficClass>(1); |
|
91 aQosRequested.iReqDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(1); |
|
92 aQosRequested.iMinDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(1); |
|
93 aQosRequested.iReqDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(1); |
|
94 aQosRequested.iMinDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(1); |
|
95 aQosRequested.iReqMaxSDUSize = 1; |
|
96 aQosRequested.iMinAcceptableMaxSDUSize = 1; |
|
97 aQosRequested.iReqMaxRate.iUplinkRate = 1; |
|
98 aQosRequested.iReqMaxRate.iDownlinkRate = 1; |
|
99 aQosRequested.iMinGuaranteedRate.iUplinkRate = 1; |
|
100 aQosRequested.iMinGuaranteedRate.iDownlinkRate = 1; |
|
101 aQosRequested.iReqBER = static_cast<RPacketQoS::TBitErrorRatio>(1); |
|
102 aQosRequested.iMaxBER = static_cast<RPacketQoS::TBitErrorRatio>(1); |
|
103 aQosRequested.iReqSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(1); |
|
104 aQosRequested.iMaxSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(1); |
|
105 aQosRequested.iReqTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(1); |
|
106 aQosRequested.iMinTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(1); |
|
107 aQosRequested.iReqTransferDelay = 1; |
|
108 aQosRequested.iMaxTransferDelay = 1; |
|
109 aQosRequested.iReqGuaranteedRate.iUplinkRate = 1; |
|
110 aQosRequested.iReqGuaranteedRate.iDownlinkRate = 1; |
|
111 aQosRequested.iMinGuaranteedRate.iUplinkRate = 1; |
|
112 aQosRequested.iMinGuaranteedRate.iDownlinkRate = 1; |
|
113 } |
|
114 |
|
115 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
116 void DefaultQoSR5Requested(RPacketQoS::TQoSR5Requested& aQosRequested) |
|
117 { |
|
118 DefaultQoSR99_R4Requested (aQosRequested); |
|
119 aQosRequested.iSignallingIndication = EFalse; |
|
120 aQosRequested.iSignallingIndication = RPacketQoS::ESourceStatisticsDescriptorUnknown; |
|
121 } |
|
122 |
|
123 void SecondQoSR5Requested(RPacketQoS::TQoSR5Requested& aQosRequested) |
|
124 { |
|
125 SecondQoSR99_R4Requested (aQosRequested); |
|
126 aQosRequested.iSignallingIndication = EFalse; |
|
127 aQosRequested.iSignallingIndication = RPacketQoS::ESourceStatisticsDescriptorUnknown; |
|
128 } |
|
129 |
|
130 #endif |
|
131 |
|
132 void DefaultQoSR99_R4Negotiated(RPacketQoS::TQoSR99_R4Negotiated& aQosNegotiated) |
|
133 { |
|
134 aQosNegotiated.iTrafficClass = static_cast<RPacketQoS::TTrafficClass>(1); |
|
135 aQosNegotiated.iDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(1); |
|
136 aQosNegotiated.iDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(1); |
|
137 aQosNegotiated.iMaxSDUSize = 1; |
|
138 aQosNegotiated.iBER = static_cast<RPacketQoS::TBitErrorRatio>(1); |
|
139 aQosNegotiated.iSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(1); |
|
140 aQosNegotiated.iTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(1); |
|
141 aQosNegotiated.iTransferDelay = 1; |
|
142 aQosNegotiated.iGuaranteedRate.iUplinkRate = 1; |
|
143 aQosNegotiated.iGuaranteedRate.iDownlinkRate = 1; |
|
144 aQosNegotiated.iMaxRate.iUplinkRate = 1; |
|
145 aQosNegotiated.iMaxRate.iDownlinkRate = 1; |
|
146 } |
|
147 |
|
148 void SecondQoSR99_R4Negotiated(RPacketQoS::TQoSR99_R4Negotiated& aQosNegotiated) |
|
149 { |
|
150 aQosNegotiated.iTrafficClass = static_cast<RPacketQoS::TTrafficClass>(2); |
|
151 aQosNegotiated.iDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(2); |
|
152 aQosNegotiated.iDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(2); |
|
153 aQosNegotiated.iMaxSDUSize = 2; |
|
154 aQosNegotiated.iBER = static_cast<RPacketQoS::TBitErrorRatio>(2); |
|
155 aQosNegotiated.iSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(2); |
|
156 aQosNegotiated.iTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(2); |
|
157 aQosNegotiated.iTransferDelay = 2; |
|
158 aQosNegotiated.iGuaranteedRate.iUplinkRate = 2; |
|
159 aQosNegotiated.iGuaranteedRate.iDownlinkRate = 2; |
|
160 aQosNegotiated.iMaxRate.iUplinkRate = 2; |
|
161 aQosNegotiated.iMaxRate.iDownlinkRate = 2; |
|
162 } |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 TUint8 defaultSrcAddr[RPacketContext::KIPAddressSize] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 1, 1, 1, 1}; |
|
169 TUint8 defaultSrcAddrSubnetMask[RPacketContext::KIPAddressSize] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255}; |
|
170 |
|
171 static void DefaultPacketFilter1(RPacketContext::TPacketFilterV2& entry) |
|
172 { |
|
173 entry.iId = 0; |
|
174 entry.iEvaluationPrecedenceIndex = 1; |
|
175 |
|
176 for (TUint i = 0; i < RPacketContext::KIPAddressSize; i++) |
|
177 { |
|
178 entry.iSrcAddr[i] = defaultSrcAddr[i]; |
|
179 entry.iSrcAddrSubnetMask[i] = defaultSrcAddrSubnetMask[i]; |
|
180 } |
|
181 entry.iProtocolNumberOrNextHeader = 1; |
|
182 entry.iSrcPortMin = 1; |
|
183 entry.iSrcPortMax = 1; |
|
184 entry.iDestPortMin = 1; |
|
185 entry.iDestPortMax = 1; |
|
186 entry.iIPSecSPI = 1; |
|
187 entry.iTOSorTrafficClass = 1; |
|
188 entry.iFlowLabel = 1; |
|
189 } |
|
190 |
|
191 static void DefaultPacketFilter2(RPacketContext::TPacketFilterV2& entry) |
|
192 { |
|
193 entry.iId = 1; |
|
194 entry.iEvaluationPrecedenceIndex = 2; |
|
195 |
|
196 for (TUint i = 0; i < RPacketContext::KIPAddressSize; i++) |
|
197 { |
|
198 entry.iSrcAddr[i] = defaultSrcAddr[i]; |
|
199 entry.iSrcAddrSubnetMask[i] = defaultSrcAddrSubnetMask[i]; |
|
200 } |
|
201 entry.iProtocolNumberOrNextHeader = 2; |
|
202 entry.iSrcPortMin = 2; |
|
203 entry.iSrcPortMax = 2; |
|
204 entry.iDestPortMin = 2; |
|
205 entry.iDestPortMax = 2; |
|
206 entry.iIPSecSPI = 2; |
|
207 entry.iTOSorTrafficClass = 2; |
|
208 entry.iFlowLabel = 2; |
|
209 } |
|
210 |
|
211 static void DefaultPacketFilter3(RPacketContext::TPacketFilterV2& entry) |
|
212 { |
|
213 entry.iId = 2; |
|
214 entry.iEvaluationPrecedenceIndex = 3; |
|
215 |
|
216 for (TUint i = 0; i < RPacketContext::KIPAddressSize; i++) |
|
217 { |
|
218 entry.iSrcAddr[i] = defaultSrcAddr[i]; |
|
219 entry.iSrcAddrSubnetMask[i] = defaultSrcAddrSubnetMask[i]; |
|
220 } |
|
221 entry.iProtocolNumberOrNextHeader = 3; |
|
222 entry.iSrcPortMin = 3; |
|
223 entry.iSrcPortMax = 3; |
|
224 entry.iDestPortMin = 3; |
|
225 entry.iDestPortMax = 3; |
|
226 entry.iIPSecSPI = 3; |
|
227 entry.iTOSorTrafficClass = 3; |
|
228 entry.iFlowLabel = 3; |
|
229 } |
|
230 |
|
231 void DefaultTftInfo(TTFTInfo& aTTFTInfo) |
|
232 { |
|
233 RPacketContext::TPacketFilterV2 entry1, entry2; |
|
234 |
|
235 DefaultPacketFilter1(entry1); |
|
236 DefaultPacketFilter2(entry2); |
|
237 |
|
238 aTTFTInfo.AddPacketFilter(entry1); |
|
239 aTTFTInfo.AddPacketFilter(entry2); |
|
240 } |
|
241 |
|
242 void SecondDefaultTftInfo(TTFTInfo& aTTFTInfo) |
|
243 { |
|
244 RPacketContext::TPacketFilterV2 entry; |
|
245 |
|
246 DefaultPacketFilter3(entry); |
|
247 |
|
248 aTTFTInfo.AddPacketFilter(entry); |
|
249 } |
|
250 |
|
251 void CombinedDefaultTftInfo(TTFTInfo& aTTFTInfo) |
|
252 { |
|
253 RPacketContext::TPacketFilterV2 entry1, entry2, entry3; |
|
254 |
|
255 DefaultPacketFilter1(entry1); |
|
256 DefaultPacketFilter2(entry2); |
|
257 DefaultPacketFilter3(entry3); |
|
258 |
|
259 aTTFTInfo.AddPacketFilter(entry1); |
|
260 aTTFTInfo.AddPacketFilter(entry2); |
|
261 aTTFTInfo.AddPacketFilter(entry3); |
|
262 } |
|
263 |
|
264 void DefaultContextStatus(RPacketContext::TContextStatus& aStatus) |
|
265 { |
|
266 aStatus = RPacketContext::EStatusInactive; |
|
267 } |
|
268 |
|
269 void DefaultServiceStatus(RPacketService::TStatus& aStatus) |
|
270 { |
|
271 aStatus = RPacketService::EStatusAttached; |
|
272 } |
|
273 |
|
274 _LIT(csy, "SIMTSYLOOPBACK.CSY"); |
|
275 _LIT(port, "SIMTSYLOOPBACK::0"); |
|
276 void DefaultDataChannel(RPacketContext::TDataChannelV2& aDataChannel) |
|
277 { |
|
278 aDataChannel.iCsy = csy; |
|
279 aDataChannel.iPort = port; |
|
280 aDataChannel.iChannelId = port; |
|
281 } |