|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "defaultsettings.h" |
|
22 |
|
23 #include <unsafprotocolscrkeys.h> |
|
24 |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 /******************************************************/ |
|
29 //Settings |
|
30 //Domain spesific settings |
|
31 |
|
32 _LIT8( KSTUNServAddr, "isp1v.wipsl.com:3478" ); |
|
33 _LIT8( KPriorityOrder, "nokia.test" ); |
|
34 const TInt KNATRefreshTCP = 500; |
|
35 const TInt KNATRefreshUDP = 500; |
|
36 const TInt KEnableCRLFRefresh = 0; |
|
37 // none additional STUN server settings |
|
38 const TInt KSTUNUsed = 1; |
|
39 const TInt KSharedsecretNotSupported = 1; |
|
40 const TInt KPortPoolStartPort = 49152; |
|
41 const TInt KPortPoolEndPort = 49252; |
|
42 const TInt KPortFieldRange = 20; |
|
43 //const TInt KPlugInId = 0x10275446; // STUN plug-in implementation id |
|
44 const TInt KPlugInId = 0x10275401; // Test plug-in implementation id |
|
45 const TInt KPlugInServiceId = 1; |
|
46 //ICE spesific in the Domain settings |
|
47 const TInt KOfferICE = 0; |
|
48 const TInt KMode = 1; |
|
49 const TInt KAnotherCanditateTimer = 500; |
|
50 //TURN specific in the Domain settings |
|
51 const TInt KLifeTime = 500; |
|
52 const TInt KBandwith = 28800; |
|
53 _LIT8( KRemoteAddr, "40.0.0.4:404" ); |
|
54 _LIT8( KData, "Hello World" ); |
|
55 _LIT8( KRelayAddr, "20.0.0.2:202" ); |
|
56 const TInt KRequestedPortProps = 0x00000000; |
|
57 const TInt KRequestedTransport = 1; // 0 = UDP, 1 = TCP |
|
58 _LIT8( KRequestedAddr, "30.0.0.3:303" ); |
|
59 const TInt KTimerValue = 500; |
|
60 //IAP Spesific settings |
|
61 |
|
62 const TInt KIAPNATRefreshTCP = 100; |
|
63 const TInt KIAPNATRefreshUDP = 100; |
|
64 const TInt KIAPSTUNRetransmit = 400; |
|
65 |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CDefaultSettings::NewL |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C CDefaultSettings* CDefaultSettings::NewL( const TDesC8& aDomain, |
|
72 TUint aIapId ) |
|
73 { |
|
74 CDefaultSettings* self = CDefaultSettings::NewLC(aDomain, aIapId ); |
|
75 CleanupStack::Pop( self ); |
|
76 return self; |
|
77 } |
|
78 |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CDefaultSettings::NewL |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C CDefaultSettings* CDefaultSettings::NewLC( const TDesC8& aDomain, |
|
85 TUint aIapId ) |
|
86 { |
|
87 CDefaultSettings* self = new( ELeave ) CDefaultSettings( aIapId ); |
|
88 CleanupStack::PushL( self ); |
|
89 self->ConstructL( aDomain ); |
|
90 self->ConstructBaseL( KCRUidUNSAFProtocols ); |
|
91 return self; |
|
92 } |
|
93 |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CDefaultSettings::CDefaultSettings |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 CDefaultSettings::CDefaultSettings( TUint aIapId ) |
|
100 : iIapId( aIapId ) |
|
101 { |
|
102 } |
|
103 |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CDefaultSettings::~CDefaultSettings |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 CDefaultSettings::~CDefaultSettings( ) |
|
110 { |
|
111 EraseL( KUNSAFProtocolsDomainTableMask, 0xf0000000 ); |
|
112 EraseL( KUNSAFProtocolsIAPTableMask, 0xf0000000 ); |
|
113 delete iDomain; |
|
114 } |
|
115 |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CDefaultSettings::ConstructL |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CDefaultSettings::ConstructL( const TDesC8& aDomain ) |
|
122 { |
|
123 iDomain = aDomain.AllocL(); |
|
124 } |
|
125 |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CDefaultSettings::CreateSettingsL |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C void CDefaultSettings::CreateSettingsL() |
|
132 { |
|
133 //Create key for domain settings |
|
134 TUint32 domainKey = CreateNewTableKeyL( |
|
135 KUNSAFProtocolsDomainTableMask, KUNSAFProtocolsFieldTypeMask ); |
|
136 //create key for the stun server settings in the domain settings |
|
137 TUint32 STUNServerKey = CreateNewTableKeyL( |
|
138 KUNSAFProtocolsSTUNServerTableMask | domainKey, |
|
139 KUNSAFProtocolsSubTableFieldTypeMask ); |
|
140 //create key for the Iap settings |
|
141 TUint32 IapKey = CreateNewTableKeyL( |
|
142 KUNSAFProtocolsIAPTableMask, KUNSAFProtocolsFieldTypeMask ); |
|
143 |
|
144 //Settings |
|
145 /************************************************************************/ |
|
146 //Domain spesific settings |
|
147 StoreL( KUNSAFProtocolsUsedNATProtocolMask | domainKey, |
|
148 KPriorityOrder ); |
|
149 StoreL( KUNSAFProtocolsDomainMask | domainKey, *iDomain ); |
|
150 //StoreL( KUNSAFProtocolsSTUNUsedMask | domainKey, KSTUNUsed ); |
|
151 StoreL( KUNSAFProtocolsDomainSharedSecretNotSupported | |
|
152 domainKey, KSharedsecretNotSupported ); |
|
153 StoreL( KUNSAFProtocolsPortPoolStartPortMask | domainKey, |
|
154 KPortPoolStartPort ); |
|
155 StoreL( KUNSAFProtocolsPortPoolEndPortMask | domainKey, |
|
156 KPortPoolEndPort ); |
|
157 /*StoreL( KUNSAFProtocolsPortFieldLengthMask | domainKey, |
|
158 KPortFieldRange ); */ |
|
159 /*StoreL( KUNSAFProtocolsPlugInIdMask | domainKey, KPlugInId ); |
|
160 StoreL( KUNSAFProtocolsPlugInServiceIdMask | domainKey, |
|
161 KPlugInServiceId );*/ |
|
162 /************************************************************************/ |
|
163 //STUN-server settings in the domain |
|
164 StoreL( KUNSAFProtocolsSTUNAddressMask | domainKey | STUNServerKey, |
|
165 KSTUNServAddr ); |
|
166 /* |
|
167 StoreL( KUNSAFProtocolsSTUNTCPTimeoutMask | domainKey | |
|
168 STUNServerKey, KNATRefreshTCP ); |
|
169 StoreL( KUNSAFProtocolsSTUNUDPTimeoutMask | domainKey | |
|
170 STUNServerKey, KNATRefreshUDP ); |
|
171 StoreL( KUNSAFProtocolsSTUNEnableCRLFRefreshMask | domainKey | |
|
172 STUNServerKey, KEnableCRLFRefresh ); |
|
173 */ |
|
174 /************************************************************************/ |
|
175 //ICE spesific in the Domain settings |
|
176 /* |
|
177 StoreL( KUNSAFProtocolsOfferICEMask | domainKey, KOfferICE ); |
|
178 StoreL( KUNSAFProtocolsICECandidateTimerMask | domainKey, |
|
179 KAnotherCanditateTimer ); |
|
180 */ |
|
181 /************************************************************************/ |
|
182 //TURN specific in the Domain settings |
|
183 /* |
|
184 StoreL( KUNSAFProtocolsTURNLifeTimeMask | domainKey, KLifeTime ); |
|
185 StoreL( KUNSAFProtocolsTURNBandwidthMask | domainKey, KBandwith ); |
|
186 StoreL( KUNSAFProtocolsRequestedPortPropsMask | domainKey, |
|
187 KRequestedPortProps ); |
|
188 StoreL( KUNSAFProtocolsRequestedTransportMask | domainKey, |
|
189 KRequestedTransport ); |
|
190 StoreL( KUNSAFProtocolsRequestedAdressMask | domainKey, |
|
191 KRequestedAddr ); |
|
192 StoreL( KUNSAFProtocolsTURNTimerValueMask | domainKey, |
|
193 KTimerValue ); |
|
194 */ |
|
195 /************************************************************************/ |
|
196 //IAP Spesific settings |
|
197 StoreL( KUNSAFProtocolsIAPIdMask | IapKey, iIapId ); |
|
198 StoreL( KUNSAFProtocolsIntervalTCPMask | IapKey, |
|
199 KIAPNATRefreshTCP ); |
|
200 StoreL( KUNSAFProtocolsIntervalUDPMask | IapKey, |
|
201 KIAPNATRefreshUDP ); |
|
202 StoreL( KUNSAFProtocolsSTUNRetransmitTimerMask | IapKey, |
|
203 KIAPSTUNRetransmit ); |
|
204 } |
|
205 |
|
206 |