linklayercontrol/networkinterfacemgr/src/CAgentBase.cpp
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 1997-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 // CAgentBase implementation.
       
    15 // CAgentBase is the base class for an agent that accesses CommDb and uses overrides
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file CAgentBase.cpp
       
    21  @publishedPartner
       
    22  @deprecated since v9.5. Use MCPR/CPR/SCPRs instead of agents. 
       
    23 */
       
    24 
       
    25 #include <cdbcols.h>
       
    26 #include "CAgentBase.h"
       
    27 #include "AgentPanic.h"
       
    28 #include "Ni_Log.h"
       
    29 #include "IF_DEF.H"
       
    30 #include "cagentdlgproc.h"
       
    31 
       
    32 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    33 #include <networking/cfbearers.h>
       
    34 #endif //SYMBIAN_ADAPTIVE_TCP_WINDOW_RECEIVE
       
    35 
       
    36 
       
    37 /**
       
    38 Agent Panic
       
    39 @internalComponent
       
    40 */
       
    41 _LIT(KAgentPanic, "CAgentBase");
       
    42 
       
    43 /**
       
    44 Panic - programming error!
       
    45 @internalComponent 
       
    46 */
       
    47 GLDEF_C void AgentPanic(Agent::TAgentPanic aPanic)
       
    48 /**
       
    49  * Global panic function for agent base classes.
       
    50  * A global helper function for agent base classes to log the panic number before triggering the panic itself
       
    51  * @internalComponent
       
    52  */
       
    53 	{
       
    54 	LOG( NifmanLog::Printf(_L("CAgentBase Panic %d"), aPanic); )
       
    55 	User::Panic(KAgentPanic, aPanic);
       
    56 	}
       
    57 
       
    58 
       
    59 //
       
    60 //  Construction and Destruction
       
    61 //
       
    62 
       
    63 EXPORT_C CAgentBase::~CAgentBase()
       
    64 /**
       
    65 Destructor
       
    66 Releases resources used by CAgentBase
       
    67 
       
    68 */
       
    69 	{
       
    70 	if (iOverrides)
       
    71 		{
       
    72 		LOG_DETAILED( NifmanLog::Printf(_L("Agent %x:\t\tDeleting overrides at %x"), this, iOverrides); )
       
    73 
       
    74 		delete iOverrides;
       
    75 		}
       
    76 
       
    77 	if (iDlgPrc)
       
    78 		{
       
    79 		iDlgPrc->CancelEverything();
       
    80 		delete iDlgPrc;
       
    81 		}
       
    82 
       
    83 	if (iDatabase)
       
    84 		{
       
    85 		iDatabase->CancelRequestNotificationOfServiceChange(this);
       
    86 		iServiceChangeNotification.Reset();
       
    87 		delete iDatabase;
       
    88 		}
       
    89 
       
    90 	if(iAuthenticateCallback)
       
    91 		delete iAuthenticateCallback;
       
    92 
       
    93 	}
       
    94 
       
    95 EXPORT_C CAgentBase::CAgentBase()
       
    96 : iAuthenticateError(KErrNone)
       
    97 /**
       
    98 Default Constructor
       
    99 */
       
   100 	{ }
       
   101 
       
   102 EXPORT_C void CAgentBase::ConstructL()
       
   103 /**
       
   104 2nd Phase of construction.
       
   105 Instantiate Member variables.
       
   106 The derived class' ConstructL() should also call this one.
       
   107 
       
   108 @exception Leaves if construction of either the database or 
       
   109 the dialog processor leaves
       
   110 */
       
   111 	{
       
   112 	// construct the database
       
   113 	iDatabase = CCommsDbAccess::NewL(ETrue);
       
   114 	
       
   115 	iDatabase->RequestNotificationOfServiceChangeL(this);
       
   116 
       
   117 	// construct the dialog processor
       
   118 	iDlgPrc = CDialogProcessor::NewL();
       
   119 
       
   120 	// create the callback for authentication
       
   121 	TCallBack authCallback(AuthenticateCb, this);
       
   122 	iAuthenticateCallback = new (ELeave) CAsyncCallBack(authCallback, CActive::EPriorityStandard);
       
   123 	}
       
   124 
       
   125 
       
   126 //
       
   127 //  Partial implementation of the CNifAgentBase interface
       
   128 //
       
   129 
       
   130 EXPORT_C void CAgentBase::SetConnectionSettingsL(const TConnectionSettings& aSettings)
       
   131 /**
       
   132 SetConnectionSettings
       
   133 
       
   134 Used by Network Controller to set the database to
       
   135 reflect the settings selected by the user
       
   136 
       
   137 @param aSettings contains the connection settings selected by the user
       
   138 @exception leaves if there is a problem with access to the database
       
   139 */
       
   140 	{
       
   141 	LOG_DETAILED( NifmanLog::Printf(_L("Agent %x:\t\tSetConnectionSettingsL(aSettings = 0x%08x)"), this, &aSettings); )
       
   142 
       
   143 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   144 
       
   145 	iSettings = aSettings;
       
   146 	iDatabase->GetCurrentSettingsL(iSettings, iSettings.iDirection, iSettings.iRank);
       
   147 	iDatabase->GetServiceSettingsL(iSettings);
       
   148 	iDatabase->SetCurrentSettingsL(iSettings);
       
   149 
       
   150 	LOG_DETAILED(
       
   151 				NifmanLog::Printf(_L("Agent %x:\t\tNew Connection Settings:"), this);
       
   152 				NifmanLog::Printf(_L("Agent %x:\t\t\tiRank = %d"), this, aSettings.iRank);
       
   153 				NifmanLog::Printf(_L("Agent %x:\t\t\tiDirection = %d"), this, aSettings.iDirection);
       
   154 				NifmanLog::Printf(_L("Agent %x:\t\t\tiDialogPref = %d"), this, aSettings.iDialogPref);
       
   155 				NifmanLog::Printf(_L("Agent %x:\t\t\tiBearerSet = %d"), this, aSettings.iBearerSet);
       
   156 				NifmanLog::Printf(_L("Agent %x:\t\t\tiIAPId = %d"), this, aSettings.iIAPId);
       
   157 				NifmanLog::Printf(_L("Agent %x:\t\t\tiServiceId = %d"), this, aSettings.iServiceId);
       
   158 				NifmanLog::Printf(_L("Agent %x:\t\t\tiServiceType = '%S'"), this, &(aSettings.iServiceType));
       
   159 				NifmanLog::Printf(_L("Agent %x:\t\t\tiBearerId = %d"), this, aSettings.iBearerId);
       
   160 				NifmanLog::Printf(_L("Agent %x:\t\t\tiLocationId = %d"), this, aSettings.iLocationId);
       
   161 				NifmanLog::Printf(_L("Agent %x:\t\t\tiChargeCardId = %d"), this, aSettings.iChargeCardId);
       
   162 				)
       
   163 	}
       
   164 
       
   165 EXPORT_C TConnectionSettings& CAgentBase::ConnectionSettingsL()
       
   166 /**
       
   167 @return iSettings containing the connection settings selected by the user
       
   168 */
       
   169 	{
       
   170 	return iSettings;
       
   171 	}
       
   172 
       
   173 EXPORT_C void CAgentBase::SetOverridesL(CStoreableOverrideSettings* aOverrideSettings)
       
   174 /**
       
   175 Transfer ownership of storeable override settings to this agent
       
   176 @param aOverrideSettings 
       
   177 @note that since ownership of the override settings is transfered
       
   178 to this agent and they must be deleted in the d'tor
       
   179 */
       
   180 	{
       
   181 	LOG_DETAILED( NifmanLog::Printf(_L("Agent %x:\t\tSetOverridesL(aOverrideSettings = 0x%08x)"), this, aOverrideSettings); )
       
   182 
       
   183 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   184 
       
   185 	if(iOverrides)
       
   186 		{
       
   187 		// we already have some overrides so free them before setting the new ones
       
   188 		delete iOverrides;
       
   189 		iOverrides = NULL;
       
   190 		}
       
   191 
       
   192 	iOverrides = aOverrideSettings;
       
   193 	iDatabase->SetOverridesL(aOverrideSettings);
       
   194 
       
   195 	// refresh settings
       
   196 //	iDatabase->GetCurrentSettingsL(iSettings, iSettings.iDirection, iSettings.iRank);
       
   197 //	iDatabase->SetCurrentSettingsL(iSettings);
       
   198 	}
       
   199 
       
   200 EXPORT_C CStoreableOverrideSettings* CAgentBase::OverridesL()
       
   201 /**
       
   202 Retrieve a pointer to the override settings owned by this agent
       
   203 
       
   204 @return aOverrideSettings
       
   205 @note that ownership of the override settings remains
       
   206 with this agent and they must not be deleted elsewhere
       
   207 */
       
   208 	{
       
   209 	return iOverrides;
       
   210 	}
       
   211 
       
   212 EXPORT_C void CAgentBase::Reconnect()
       
   213 /**
       
   214 Request that the State Machine re-establishes a connection.
       
   215 */
       
   216 	{
       
   217 	CNifMan::Global()->AgentDialogProcessor()->PromptForReconnect(*this);
       
   218 	}
       
   219 
       
   220 EXPORT_C void CAgentBase::CancelReconnect()
       
   221 /**
       
   222 Cancel a previous request to Reconnect.
       
   223 */
       
   224 	{
       
   225 	CNifMan::Global()->AgentDialogProcessor()->CancelPromptForReconnect(*this);
       
   226 	}
       
   227 
       
   228 EXPORT_C void CAgentBase::Authenticate(TDes& aUsername, TDes& aPassword)
       
   229 /**
       
   230 A request from the NIF to Authenticate the User
       
   231 
       
   232 @param aUserName on return will contain the User Name
       
   233 @param aPassword on return will contain the Password
       
   234 @note Although the username and password are returned by this
       
   235 function the NIF should not use either parameter until it receives
       
   236 the AuthenticateComplete() signal.
       
   237 */
       
   238 	{
       
   239 	__ASSERT_DEBUG(iDlgPrc, AgentPanic(Agent::ENullDialogProcessor));
       
   240 	
       
   241 	iAuthenticateError = ReadDes(TPtrC(SERVICE_IF_AUTH_NAME), aUsername);
       
   242 	if (iAuthenticateError!=KErrNone)
       
   243 		{
       
   244 		iAuthenticateCallback->CallBack();
       
   245 		return;
       
   246 		}
       
   247 
       
   248 	iAuthenticateError = ReadDes(TPtrC(SERVICE_IF_AUTH_PASS), aPassword);
       
   249 	if (iAuthenticateError!=KErrNone)
       
   250 		{
       
   251 		iAuthenticateCallback->CallBack();
       
   252 		return;
       
   253 		}
       
   254 
       
   255 	TBool promptForAuth(EFalse);
       
   256 	iAuthenticateError = ReadBool(TPtrC(SERVICE_IF_PROMPT_FOR_AUTH), promptForAuth);
       
   257 	if (iAuthenticateError!=KErrNone)
       
   258 		{
       
   259 		iAuthenticateCallback->CallBack();
       
   260 		return;
       
   261 		}
       
   262 
       
   263 	// at this point all of the authentication parameters have been successfully read from the database
       
   264 	if (promptForAuth)
       
   265 	    {
       
   266 		iDlgPrc->Authenticate(*this, aUsername, aPassword, IsReconnect());
       
   267 	    }
       
   268     else
       
   269         {
       
   270     	iAuthenticateCallback->CallBack();
       
   271         }
       
   272 	}
       
   273 
       
   274 EXPORT_C void CAgentBase::CancelAuthenticate()
       
   275 /**
       
   276 A request from the NIF to cancel authentication
       
   277 */
       
   278 	{
       
   279 	__ASSERT_DEBUG(iDlgPrc, AgentPanic(Agent::ENullDialogProcessor));
       
   280 
       
   281 	iDlgPrc->Cancel();
       
   282 	iAuthenticateCallback->Cancel();
       
   283 	}
       
   284 
       
   285 EXPORT_C TBool CAgentBase::IsActive() const
       
   286 /**
       
   287 Is this Agent in use?
       
   288 
       
   289 @return ETrue always
       
   290 @todo RC to investigate use of IsActive()
       
   291 */
       
   292 	{
       
   293 	return ETrue;
       
   294 	}
       
   295 
       
   296 //
       
   297 //  Access to database settings
       
   298 //
       
   299 
       
   300 EXPORT_C TInt CAgentBase::DoReadInt(const TDesC& aField, TUint32& aValue,const RMessagePtr2* aMessage)
       
   301 /**
       
   302 Read an integer value from the database
       
   303 
       
   304 @param   aField the name of the field to read from
       
   305 @param   aValue on return, contains the value of the field
       
   306 @return KErrNotFound if the field is not present
       
   307 */
       
   308 	{
       
   309 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   310 
       
   311 	TInt ret = CheckReadCapability( aField, aMessage );
       
   312 	if( KErrNone == ret )
       
   313 		{
       
   314 		ret = iDatabase->ReadInt( aField, aValue );
       
   315 		}
       
   316 
       
   317 #if defined (__FLOG_ACTIVE)
       
   318 
       
   319 	if (ret==KErrNone)
       
   320 		NifmanLog::Printf(_L("Agent %x:\t\tReadInt(aField = '%S', aValue = %d)"), this, &aField, aValue);
       
   321 	else
       
   322 		NifmanLog::Printf(_L("Agent %x:\t\tReadInt(aField = '%S', aValue) returning error %d"), this, &aField, ret);
       
   323 
       
   324 #endif
       
   325 
       
   326 	return ret;
       
   327 	}
       
   328 
       
   329 EXPORT_C TInt CAgentBase::DoWriteInt(const TDesC& aField, TUint32 aValue,const RMessagePtr2* aMessage)
       
   330 /**
       
   331 Write an integer value to the database
       
   332 
       
   333 @param   aField the name of the field to write to
       
   334 @param   aValue contains the value of the field
       
   335 @return KErrNotFound if the field is not present
       
   336         KErrNotSupported if the operation is not available
       
   337 */
       
   338 	{
       
   339 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   340 
       
   341 	TInt ret = CheckWriteCapability( aField, aMessage );
       
   342 	if( KErrNone == ret )
       
   343 		{
       
   344 		ret = iDatabase->WriteInt( aField, aValue );
       
   345 		}
       
   346 	return ret;
       
   347 	}
       
   348 
       
   349 EXPORT_C TInt CAgentBase::DoReadDes(const TDesC& aField, TDes8& aValue,const RMessagePtr2* aMessage)
       
   350 /**
       
   351 Read a descriptor value from the database
       
   352 
       
   353 @param   aField the name of the field to read from
       
   354 @param   aValue on return, contains the value of the field
       
   355 @return KErrNotFound if the field is not present
       
   356 */
       
   357 	{
       
   358 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   359 
       
   360 	TInt ret = CheckReadCapability( aField, aMessage );
       
   361 	if( KErrNone == ret )
       
   362 		{
       
   363 		ret = iDatabase->ReadDes(aField, aValue);
       
   364 		}
       
   365 
       
   366 
       
   367 #if defined (__FLOG_ACTIVE)
       
   368 
       
   369 	if (ret==KErrNone)
       
   370 		NifmanLog::Printf(_L("Agent %x:\t\tReadDes(aField = '%S', aValue = %S)"), this, &aField, &aValue);
       
   371 	else
       
   372 		NifmanLog::Printf(_L("Agent %x:\t\tReadDes(aField = '%S', aValue) returning error %d"), this, &aField, ret);
       
   373 
       
   374 #endif
       
   375 
       
   376 	return ret;
       
   377 	}
       
   378 
       
   379 EXPORT_C TInt CAgentBase::DoWriteDes(const TDesC& aField, const TDesC8& aValue,const RMessagePtr2* aMessage)
       
   380 /**
       
   381 Write a descriptor value to the database
       
   382 
       
   383 @param   aField the name of the field to write to
       
   384 @param   aValue contains the value of the field
       
   385 @return KErrNotFound if the field is not present
       
   386          KErrNotSupported if the operation is not available
       
   387 */
       
   388 	{
       
   389 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   390 
       
   391 	TInt ret = CheckWriteCapability( aField, aMessage );
       
   392 	if( KErrNone == ret )
       
   393 		{
       
   394 		ret = iDatabase->WriteDes(aField, aValue);
       
   395 		}
       
   396 	return ret;
       
   397 	}
       
   398 
       
   399 EXPORT_C TInt CAgentBase::DoReadDes(const TDesC& aField, TDes16& aValue,const RMessagePtr2* aMessage)
       
   400 
       
   401 /**
       
   402 Read a descriptor value from the database
       
   403 
       
   404 @param   aField the name of the field to read from
       
   405 @param   aValue on return, contains the value of the field
       
   406 @return KErrNotFound if the field is not present
       
   407 */
       
   408 	{
       
   409 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   410 
       
   411 	TInt ret = CheckReadCapability( aField, aMessage );
       
   412 	if( KErrNone == ret )
       
   413 		{
       
   414 		ret = iDatabase->ReadDes(aField, aValue);
       
   415 		}
       
   416 
       
   417 
       
   418 #if defined (__FLOG_ACTIVE)
       
   419 
       
   420 	if (ret==KErrNone)
       
   421 		NifmanLog::Printf(_L("Agent %x:\t\tReadDes(aField = '%S', aValue = '%S')"), this, &aField, &aValue);
       
   422 	else
       
   423 		NifmanLog::Printf(_L("Agent %x:\t\tReadDes(aField = '%S', aValue) returning error %d"), this, &aField, ret);
       
   424 
       
   425 #endif
       
   426 
       
   427 	return ret;
       
   428 	}
       
   429 
       
   430 EXPORT_C TInt CAgentBase::DoWriteDes(const TDesC& aField, const TDesC16& aValue,const RMessagePtr2* aMessage)
       
   431 /**
       
   432 Write a descriptor value to the database
       
   433 
       
   434 @param   aField the name of the field to write to
       
   435 @param   aValue contains the value of the field
       
   436 @return KErrNotFound if the field is not present
       
   437          KErrNotSupported if the operation is not available
       
   438 */
       
   439 	{
       
   440 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   441 
       
   442 	TInt ret = CheckWriteCapability( aField, aMessage );
       
   443 	if( KErrNone == ret )
       
   444 		{
       
   445 		ret = iDatabase->WriteDes(aField, aValue);
       
   446 		}
       
   447 	return ret;
       
   448 	}
       
   449 
       
   450 EXPORT_C TInt CAgentBase::DoReadBool(const TDesC& aField, TBool& aValue,const RMessagePtr2* aMessage)
       
   451 /**
       
   452 Read a Boolean value from the database
       
   453 
       
   454 @param   aField the name of the field to read from
       
   455 @param   aValue on return, contains the value of the field
       
   456 @return KErrNotFound if the field is not present
       
   457 */
       
   458 	{
       
   459 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   460 
       
   461 	TInt ret = CheckReadCapability( aField, aMessage );
       
   462 	if( KErrNone == ret )
       
   463 		{
       
   464 		ret = iDatabase->ReadBool(aField, aValue);
       
   465 		}
       
   466 
       
   467 
       
   468 #if defined (__FLOG_ACTIVE)
       
   469 
       
   470 	if (ret==KErrNone)
       
   471 		NifmanLog::Printf(_L("Agent %x:\t\tReadBool(aField = '%S', aValue = %d)"), this, &aField, (TInt)aValue);
       
   472 	else
       
   473 		NifmanLog::Printf(_L("Agent %x:\t\tReadBool(aField = '%S', aValue) returning error %d"), this, &aField, ret);
       
   474 
       
   475 #endif
       
   476 
       
   477 	return ret;
       
   478 	}
       
   479 
       
   480 EXPORT_C TInt CAgentBase::DoWriteBool(const TDesC& aField, TBool aValue,const RMessagePtr2* aMessage)
       
   481 /**
       
   482 Write a Boolean value to the database
       
   483 
       
   484 @param   aField the name of the field to write to
       
   485 @param   aValue contains the value of the field
       
   486 @return KErrNotFound if the field is not present
       
   487          KErrNotSupported if the operation is not available
       
   488 */
       
   489 	{
       
   490 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   491 
       
   492 	TInt ret = CheckWriteCapability( aField, aMessage );
       
   493 	if( KErrNone == ret )
       
   494 		{
       
   495 		ret = iDatabase->WriteBool(aField, aValue);
       
   496 		}
       
   497 	return ret;
       
   498 
       
   499 	}
       
   500 
       
   501 EXPORT_C HBufC* CAgentBase::DoReadLongDesLC(const TDesC& aField,const RMessagePtr2* aMessage)
       
   502 /**
       
   503 Read a long descriptor value from the database
       
   504 
       
   505 Leaves if the allocation of the HBufC fails
       
   506 
       
   507 @param   aField the name of the field to read from
       
   508 @return a pointer to the HBufC containing the data
       
   509 */
       
   510 	{
       
   511 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   512 
       
   513 	LOG_DETAILED( NifmanLog::Printf(_L("Agent %x:\t\tReadLongDesLC(aField = '%S')"), this, &aField); )
       
   514 
       
   515 	User::LeaveIfError( CheckReadCapability( aField, aMessage ) );
       
   516 	return iDatabase->ReadLongDesLC(aField);
       
   517 
       
   518 	}
       
   519 
       
   520 
       
   521 //
       
   522 //  Service Change Notification
       
   523 //
       
   524 
       
   525 EXPORT_C void CAgentBase::RequestNotificationOfServiceChangeL(MAgentSessionNotify* aSession)
       
   526 /**
       
   527 A request for service change notification
       
   528 
       
   529 @param aSession the session interested in the notification
       
   530 @exception Leaves if aSession cannot be added to the container
       
   531 */
       
   532 	{
       
   533 	// Storing who asked to be Notified for ServiceChangeNotification
       
   534 	User::LeaveIfError(iServiceChangeNotification.Append(aSession));
       
   535 	}
       
   536 
       
   537 EXPORT_C void CAgentBase::CancelRequestNotificationOfServiceChange(MAgentSessionNotify* aSession)
       
   538 /**
       
   539 Cancel a previous request for service change notification
       
   540 
       
   541 @param aSession the session wishing to cancel the notification
       
   542 */
       
   543 	{
       
   544 	const TInt result = iServiceChangeNotification.Find(aSession);
       
   545 
       
   546 	if (result != KErrNotFound)
       
   547 		{
       
   548 		iServiceChangeNotification.Remove(result);
       
   549 		}
       
   550 	}
       
   551 
       
   552 EXPORT_C void CAgentBase::ServiceChangeNotification(TUint32 aId, const TDesC& aType)
       
   553 /**
       
   554 Notification of service change.
       
   555 This is the method through which the Agent receive notification about
       
   556 Service Change events and Notify about it who asked for that.
       
   557 
       
   558 @param aId New ISP
       
   559 @param aType New Service Type
       
   560 */
       
   561 	{
       
   562 	const TInt count = iServiceChangeNotification.Count();
       
   563 
       
   564 	for (TInt i = 0; i < count; ++i)
       
   565 		{
       
   566 		iServiceChangeNotification[0]->ServiceChangeNotification(aId, aType);
       
   567 		iServiceChangeNotification.Remove(0);
       
   568 		}
       
   569 	}
       
   570 
       
   571 
       
   572 //
       
   573 //  Callbacks used for authentication
       
   574 //
       
   575 
       
   576 TInt CAgentBase::AuthenticateCb(TAny* aThisPtr)
       
   577 /**
       
   578 AuthenticateCb
       
   579 
       
   580 @param aThisPtr pointer to the instance object that triggered the callback
       
   581 @return KErrNone
       
   582 */
       
   583 	{
       
   584 	CAgentBase* self = (CAgentBase*)aThisPtr;
       
   585 
       
   586 	__ASSERT_DEBUG(self->iNotify, AgentPanic(Agent::ENullNifmanNotifyPointer));
       
   587 	
       
   588 	LOG( NifmanLog::Printf(_L("Agent %x:\t\tAuthenticate callback complete"), self); )
       
   589 
       
   590 	self->iNotify->AuthenticateComplete(self->iAuthenticateError);
       
   591 	return KErrNone;
       
   592 	}
       
   593 
       
   594 EXPORT_C void CAgentBase::MDPOAuthenticateComplete(TInt aError)
       
   595 /**
       
   596 Authenticate dialog box has completed
       
   597 
       
   598 @param   aError 
       
   599 */
       
   600 	{
       
   601 	__ASSERT_DEBUG(iNotify, AgentPanic(Agent::ENullNifmanNotifyPointer));
       
   602 
       
   603 	iNotify->AuthenticateComplete(aError);
       
   604 	}
       
   605 
       
   606 
       
   607 //
       
   608 //  Implementation of MNetworkControllerObserver interface
       
   609 //
       
   610 
       
   611 EXPORT_C void CAgentBase::SelectComplete(const TDesC&)
       
   612 /**
       
   613 Panics the current thread with a USER 0 panic. Typically, this is called 
       
   614 when a test for a class invariant fails, i.e. when a test which checks 
       
   615 that the internal data of an object is self-consistent, fails.
       
   616 
       
   617 */
       
   618 	{
       
   619 	User::Invariant();
       
   620 	}
       
   621 
       
   622 EXPORT_C void CAgentBase::SelectComplete(TInt)
       
   623 /**
       
   624 @see EXPORT_C void CAgentBase::SelectComplete(const TDesC&)
       
   625 */
       
   626 	{
       
   627 	User::Invariant();
       
   628 	}
       
   629 
       
   630 EXPORT_C void CAgentBase::ReconnectComplete(const TInt aError)
       
   631 /**
       
   632 Reconnect dialog box has completed
       
   633 
       
   634 */
       
   635 	{
       
   636 	__ASSERT_DEBUG(iNotify, AgentPanic(Agent::ENullNifmanNotifyPointer));
       
   637 
       
   638 	iNotify->ReconnectComplete(aError);
       
   639 	}
       
   640 
       
   641 EXPORT_C TInt CAgentBase::DoCheckReadCapability( const TDesC& aField, const RMessagePtr2* aMessage )
       
   642 	{
       
   643 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   644 	return iDatabase->CheckReadCapability( aField, aMessage );
       
   645 	}
       
   646 
       
   647 EXPORT_C TInt CAgentBase::DoCheckWriteCapability( const TDesC& aField, const RMessagePtr2* aMessage )
       
   648 	{
       
   649 	__ASSERT_DEBUG(iDatabase, AgentPanic(Agent::ENullDatabase));
       
   650 	return iDatabase->CheckWriteCapability( aField, aMessage );
       
   651 	}
       
   652 	
       
   653 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   654 /*
       
   655 Retrieve the default bearer information to the Agent CPR
       
   656 @return default bearer information to the Agent CPR.
       
   657 */
       
   658 EXPORT_C TUint32 CAgentBase::GetBearerInfo() const
       
   659 	{
       
   660 	//Return the default value, if the agent
       
   661 	//has not overridden this function
       
   662 	return  KDefaultBearer;
       
   663 	}
       
   664 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   665