40 // COMASuplFallBackHandler::COMASuplFallBackHandler |
40 // COMASuplFallBackHandler::COMASuplFallBackHandler |
41 // C++ constructor can NOT contain any code, that might leave. |
41 // C++ constructor can NOT contain any code, that might leave. |
42 // ----------------------------------------------------------------------------- |
42 // ----------------------------------------------------------------------------- |
43 // |
43 // |
44 COMASuplFallBackHandler::COMASuplFallBackHandler(CSuplSettingsInternal& aSettings): |
44 COMASuplFallBackHandler::COMASuplFallBackHandler(CSuplSettingsInternal& aSettings): |
45 iSuplSettings(aSettings) |
45 iSuplSettings(aSettings), |
|
46 iAttemptedBackupServer(EFalse) |
46 { |
47 { |
47 |
48 |
48 } |
49 } |
49 |
50 |
50 // ----------------------------------------------------------------------------- |
51 // ----------------------------------------------------------------------------- |
110 // ----------------------------------------------------------------------------- |
111 // ----------------------------------------------------------------------------- |
111 // TODO: Merge if conditions... |
112 // TODO: Merge if conditions... |
112 TInt COMASuplFallBackHandler::GetNextSLPAddressL(TInt64& aSLPId, TDes& aHslpToBeUsedAddress,TDes& aIAPName,TBool& aTls, |
113 TInt COMASuplFallBackHandler::GetNextSLPAddressL(TInt64& aSLPId, TDes& aHslpToBeUsedAddress,TDes& aIAPName,TBool& aTls, |
113 TBool& aPskTls,TInt aLastErrorCode,TBool& aIsIapDialogShown) |
114 TBool& aPskTls,TInt aLastErrorCode,TBool& aIsIapDialogShown) |
114 { |
115 { |
|
116 iTrace->Trace(_L("COMASuplFallBackHandler::GetNextSLPAddressL"),KTraceFileName, __LINE__); |
|
117 |
115 _LIT(KFormatTxt,"%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); |
118 _LIT(KFormatTxt,"%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); |
116 |
119 |
117 TBuf<256> LogBuffer; |
120 TBuf<256> LogBuffer; |
118 |
121 |
119 if( aLastErrorCode != KErrNone)// If its KErrNone then its means server name is asked first time and no need for Tls failure check |
122 if( aLastErrorCode != KErrNone)// If its KErrNone then its means server name is asked first time and no need for Tls failure check |
157 |
160 |
158 else |
161 else |
159 { |
162 { |
160 return KErrNotFound; |
163 return KErrNotFound; |
161 } |
164 } |
162 } |
165 } |
|
166 |
|
167 //Check to see if the server list is empty. If it is create the HSLP Address from the IMSI and use that |
|
168 // as the server address. This does not add the server to the list and this functionality should only |
|
169 // be tried once |
|
170 if(iSLPList->Count() <= 0 && (!iAttemptedBackupServer)) |
|
171 { |
|
172 iTrace->Trace(_L("Going to create and use alternative HSLP Address from IMSI"),KTraceFileName, __LINE__); |
|
173 |
|
174 iAttemptedBackupServer = ETrue; |
|
175 |
|
176 //Generate the HSLP Address |
|
177 GenerateHslpAddressFromIMSIL(); |
|
178 |
|
179 //Copy the generated address into the supplied function arguments |
|
180 aHslpToBeUsedAddress.Copy(iGenratedHslpAddress); |
|
181 aIAPName.Zero(); |
|
182 aIAPName.Copy(iDefaultIAPName); |
|
183 aTls = ETrue; |
|
184 aPskTls = EFalse; |
|
185 aIsIapDialogShown = ETrue; |
|
186 |
|
187 iTrace->Trace(_L("Server being used:"),KTraceFileName, __LINE__); |
|
188 LogBuffer.Copy(aHslpToBeUsedAddress); |
|
189 iTrace->Trace(LogBuffer,KTraceFileName, __LINE__); |
|
190 |
|
191 iTrace->Trace(_L("iap being used:"),KTraceFileName, __LINE__); |
|
192 LogBuffer.Copy(aIAPName); |
|
193 iTrace->Trace(LogBuffer,KTraceFileName, __LINE__); |
|
194 |
|
195 return KErrNone; |
|
196 } |
163 |
197 |
164 if( iSLPList->Count() <= 0 || iCurrentServerCounter >= iSLPList->Count() ) |
198 if( iSLPList->Count() <= 0 || iCurrentServerCounter >= iSLPList->Count() ) |
165 { |
199 { |
166 LogBuffer.Copy(_L("No more servers available...")); |
200 LogBuffer.Copy(_L("No more servers available...")); |
167 iTrace->Trace(LogBuffer,KTraceFileName, __LINE__); |
201 iTrace->Trace(LogBuffer,KTraceFileName, __LINE__); |