networkingtestandutils/networkingunittest/dummynif/dummynif.cpp
changeset 0 af10295192d8
child 5 1422c6cd3f0c
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2002-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 // Implementation of dummyNif.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21 */
       
    22 
       
    23 #include <comms-infras/nifif.h>
       
    24 #include <nifvar.h>
       
    25 #include <nifutl.h>
       
    26 #include <es_mbuf.h>
       
    27 #include <nifmbuf.h>
       
    28 #include <in_iface.h>
       
    29 #include <comms-infras/commsdebugutility.h>
       
    30 #include <connectprog.h>
       
    31 
       
    32 #include <in_chk.h>
       
    33 #include <in_sock.h>
       
    34 #include <tcp_hdr.h>
       
    35 
       
    36 #include "dummynifvar.h"
       
    37 #include "dummynif.h"
       
    38 
       
    39 /*
       
    40  * This sections defines a whole load of constants etc... not very exciting
       
    41  */
       
    42 
       
    43 _LIT(KDummyIfLogFolder, "dummynif");
       
    44 _LIT(KDummyIfLogFile, "dummynif.txt");
       
    45 _LIT(KEndOfLine, "\n");
       
    46 
       
    47 /*
       
    48  * The Link class
       
    49  */
       
    50 
       
    51 CDummyIfLink::CDummyIfLink(CNifIfFactory& aFactory)
       
    52 	: CNifIfLink(aFactory),
       
    53 	  iFactory(&aFactory)
       
    54 	{
       
    55 	CDummyIfLog::Printf(_L("CDummyIfLink::CDummyIfLink()"));
       
    56 	}
       
    57 
       
    58 CDummyIfLink::~CDummyIfLink()
       
    59 	{
       
    60 	TimerDelete();
       
    61 	}
       
    62 	
       
    63 CDummyIfFactory& CDummyIfLink::Factory()
       
    64 	{
       
    65 	return static_cast<CDummyIfFactory&>(*iFactory);
       
    66 	}
       
    67 
       
    68 void CDummyIfLink::Info(TNifIfInfo& aInfo) const
       
    69 	{
       
    70 	FillInInfo(aInfo, (TAny*) this);
       
    71 	}
       
    72 
       
    73 void CDummyIfLink::FillInInfo(TNifIfInfo& aInfo, TAny* aPtr)
       
    74 	{
       
    75 	aInfo.iProtocolSupported=0;
       
    76 	aInfo.iVersion = TVersion(1,1,1);
       
    77 	aInfo.iFlags = KNifIfIsBase | KNifIfIsLink | KNifIfUsesNotify | KNifIfCreatedByFactory;
       
    78     aInfo.iName = _L("dummyiflink");
       
    79 	aInfo.iName.AppendFormat(_L("[0x%08x]"), aPtr);
       
    80 	aInfo.iFlags |= KNifIfCreatesBinder;
       
    81 	}
       
    82 
       
    83 TInt CDummyIfLink::Send(RMBufChain& /*aPdu*/, TAny* /*aSource*/)
       
    84 	{
       
    85 	// Not used - just for satisfying pure virtual
       
    86 	return KDummyNifSendOkay;
       
    87 	}
       
    88 
       
    89 TInt CDummyIfLink::Start()
       
    90 	{
       
    91 	// NOTE: according to the NAF docs the sequence should really be StartSending(), then LinkLayerUp() then Progress()
       
    92 	// for DNS to work.  However, as this dummy NIF doesn't support DNS, the sequence is okay as it stands.
       
    93 	// 
       
    94 	CDummyIfLog::Write(_L("CDummyIfLink::Start()"));
       
    95 
       
    96 	iNotify->IfProgress(KLinkLayerOpen, KErrNone);
       
    97 	iNotify->LinkLayerUp();
       
    98 	if (iNifIf4)
       
    99 		iNifIf4->iProtocol->StartSending((CProtocolBase*)iNifIf4);
       
   100 	if (iNifIf6)
       
   101 		{
       
   102 		// setup static DNS configuration if required
       
   103 		iNifIf6->StaticDnsConfiguration();
       
   104 
       
   105 		iNifIf6->iProtocol->StartSending((CProtocolBase*)iNifIf6);
       
   106 		}
       
   107 	return KErrNone;
       
   108 	}
       
   109 
       
   110 void CDummyIfLink::TimerComplete(TInt)
       
   111 	{
       
   112     iNotify->LinkLayerDown(KErrTimedOut, MNifIfNotify::EDisconnect);
       
   113 	}
       
   114 
       
   115 void CDummyIfLink::AuthenticateComplete(TInt aResult)
       
   116 	{
       
   117 	iNotify->IfProgress(5, aResult);
       
   118 	}
       
   119 
       
   120 void CDummyIfLink::Stop(TInt aError, MNifIfNotify::TAction aAction)		
       
   121 	{
       
   122 	CDummyIfLog::Printf(_L("CDummyIfLink::Stop(aError %d, TAction %d)"), aError, aAction);
       
   123 	iNotify->IfProgress(KLinkLayerClosed, aError);
       
   124 	iNotify->LinkLayerDown(aError, aAction);
       
   125 	}
       
   126 
       
   127 void CDummyIfLink::BindL(TAny *aId)
       
   128 	{
       
   129 	CDummyIfLog::Printf(_L("CDummyIfLink::BindL(aId %x)"), aId);
       
   130 	}
       
   131 
       
   132 CNifIfBase* CDummyIfLink::GetBinderL(const TDesC& aName)
       
   133 {
       
   134 	CDummyIfLog::Printf(_L("CDummyIfLink::GetBinderL(%S)"), &aName);
       
   135 
       
   136 	_LIT(KDescIp6, "ip6");
       
   137 	if (aName.CompareF(KDescIp6) == 0)
       
   138 	{
       
   139 		iNifIf6 = new(ELeave) CDummyIf6(*this);
       
   140 		return iNifIf6;
       
   141 	}
       
   142 	else
       
   143 	{	// ip4
       
   144 		iNifIf4 = new(ELeave) CDummyIf4(*this);
       
   145 		return iNifIf4;
       
   146 	}
       
   147 }
       
   148 
       
   149 TInt CDummyIfLink::Notification(TAgentToNifEventType aEvent,void* aInfo)
       
   150 	{
       
   151 	if (aEvent!=EAgentToNifEventTypeDisableTimers)
       
   152 		return KErrUnknown;
       
   153 	if (aInfo!=NULL)
       
   154 		return KErrUnknown;
       
   155 
       
   156 	return KErrNone;
       
   157 	}
       
   158 
       
   159 void CDummyIfLink::Restart(CNifIfBase*)
       
   160 	{}
       
   161 
       
   162 /**
       
   163 Sets the cached value of Nifman Idle timeout to the specified value.
       
   164 
       
   165 @param aTimeoutToSet the idle timeout to update. One of:
       
   166 	LastSessionClosedTimeout
       
   167 	LastSocketClosedTimeout
       
   168 	LastSocketActivityTimeout
       
   169 @param aTimeoutValueBuf a package buffer containing the new value for the timeout specified by aTimeoutToSet
       
   170 @return KErrNone on success, or a system wide error code. 
       
   171 */
       
   172 TInt CDummyIfLink::SetNifmanIdleTimeout(const TDesC& aTimeoutToSet, const TDes8& aTimeoutValueBuf)
       
   173 	{
       
   174     ASSERT(aTimeoutToSet.Compare(TPtrC(LAST_SESSION_CLOSED_TIMEOUT))  == 0 ||
       
   175 		   aTimeoutToSet.Compare(TPtrC(LAST_SOCKET_CLOSED_TIMEOUT))   == 0 ||
       
   176 		   aTimeoutToSet.Compare(TPtrC(LAST_SOCKET_ACTIVITY_TIMEOUT)) == 0);
       
   177 	
       
   178 	if(!aTimeoutValueBuf.Ptr()) // NULL pointer provided. 
       
   179 		{
       
   180 		CDummyIfLog::Printf(_L("CDummyIfLink::SetNifmanIdleTimeout timeoutToSet[%S]: NULL pointer provided where timeout value expected. Returning KErrAgument[-6]"), &aTimeoutToSet);
       
   181 		return KErrArgument;
       
   182 		}	
       
   183 	//
       
   184 	// Extract the argument value and set the appropriate timeout.	
       
   185 	//
       
   186 	const TInt KNewTimeoutValue = 
       
   187 	  *(
       
   188 	   reinterpret_cast<const TInt*>(aTimeoutValueBuf.Ptr())
       
   189 	   );
       
   190 	TInt setErr = iNotify->WriteInt(aTimeoutToSet, KNewTimeoutValue);
       
   191 	CDummyIfLog::Printf(_L("CDummyIfLink::SetNifmanIdleTimeout [%S] to [%d]. WriteInt Error [%d]"), &aTimeoutToSet, KNewTimeoutValue, setErr);
       
   192 	return setErr;
       
   193 	}
       
   194 
       
   195 /**
       
   196 Controls the Interface.
       
   197 Capability to change LastSocketActivityTimeout on the fly (in CDMA Mobile IP)
       
   198 
       
   199 @param aLevel option level. Must be KCOLInterface.
       
   200 @param aName  option name. One of:
       
   201 	KTestSoDummyNifSetLastSessionClosedTimeout  - updates the LastSessionClosed timeout
       
   202 	KTestSoDummyNifSetLastSocketClosedTimeout   - updates the LastSocketClosed timeout
       
   203 	KTestSoDummyNifSetLastSocketActivityTimeout - updates the LastSocketActivity timeout
       
   204 @param aOption package buffer containing the TInt value to set the timeout to.
       
   205 @return KErrNone on success, or a system-wide error code. Common errors are:
       
   206 	KErrNotSupported if the provided option level is not of the type KCOLInterface
       
   207 	KErrNotSupported if the provided option name is not supported (not implemented)
       
   208 	KErrArgument if the argument is unacceptable (e.g. aOption carries NULL)
       
   209 */
       
   210 TInt CDummyIfLink::Control(TUint aLevel,TUint aName,TDes8& aOption, TAny* /* aSource */)
       
   211 	{
       
   212 	TInt colErr(KErrNotSupported);	
       
   213 	
       
   214 	if(KCOLInterface == aLevel) // The only level supported.
       
   215 		{	
       
   216 		switch(aName)
       
   217 			{		
       
   218 			// Support for testing updating of Nifman Idle timeouts via CNifAgentRef::WriteInt
       
   219 			// When called, the specified timeout is set to the provided value		
       
   220 			case KTestSoDummyNifSetLastSessionClosedTimeout:
       
   221 				colErr = SetNifmanIdleTimeout(TPtrC(LAST_SESSION_CLOSED_TIMEOUT),  aOption);
       
   222 				break;	
       
   223 			case KTestSoDummyNifSetLastSocketClosedTimeout:
       
   224 				colErr = SetNifmanIdleTimeout(TPtrC(LAST_SOCKET_CLOSED_TIMEOUT),   aOption);	
       
   225 				break;
       
   226 			case KTestSoDummyNifSetLastSocketActivityTimeout: 
       
   227 				colErr = SetNifmanIdleTimeout(TPtrC(LAST_SOCKET_ACTIVITY_TIMEOUT), aOption);
       
   228 				break;
       
   229 			default:
       
   230 				;			
       
   231 			}
       
   232 		}
       
   233 	// Log Option Name in a readable form by removing User Read bit. 
       
   234 	const TInt KOptionName  = aName & ~KConnReadUserDataBit;		
       
   235 	CDummyIfLog::Printf(_L("CDummyIfLink::Control Level [%d], Name [%d], Raw Name [%d]. Error [%d]"), aLevel, KOptionName, aName, colErr);
       
   236 	return colErr;	
       
   237 	}
       
   238 
       
   239 
       
   240 /*
       
   241  * The IPv4 interface binder class
       
   242  */
       
   243 
       
   244 CDummyIf4::CDummyIf4(CDummyIfLink& aLink)
       
   245 	: CNifIfBase(aLink)
       
   246 	{
       
   247 	CDummyIfLog::Printf(_L("CDummyIf4::CDummyIf4()"));
       
   248 
       
   249 	iLink = &aLink;
       
   250 	iLink->Factory().SetDripReceiver(TCallBack(DrainNextDrips, this));
       
   251 
       
   252 	// generate my local ip address (ip4) - vals potentially will be overwritten by any derived classes
       
   253 	iLocalAddressBase = KDummyNifLocalAddressBase; // also used later in control method
       
   254 	iLocalAddress = iLocalAddressBase + ((TUint32)this)%255;
       
   255 
       
   256 	iIfName.Format(_L("dummynif[0x%08x]"), this);
       
   257 	}
       
   258 	
       
   259 CDummyIf4::~CDummyIf4()
       
   260 	{
       
   261 	iLink->Factory().SetDripReceiver(TCallBack());
       
   262 	}
       
   263 
       
   264 void CDummyIf4::BindL(TAny *aId)
       
   265 	{
       
   266 	CDummyIfLog::Printf(_L("CDummyIf4::BindL(aId %x)"), aId);
       
   267 	if(iProtocol)
       
   268 		User::Leave(KErrAlreadyExists);
       
   269 	iProtocol = (CProtocolBase*)aId;	
       
   270 	}
       
   271 
       
   272 TInt CDummyIf4::Send(RMBufChain& aPdu, TAny*)
       
   273 	{
       
   274 	Recv(aPdu);
       
   275 	return 1;
       
   276 	}
       
   277 
       
   278 TInt CDummyIf4::State()
       
   279     {
       
   280     return EIfUp;
       
   281     }
       
   282 
       
   283 void CDummyIf4::UpdateHeaders(TInet6HeaderIP4* aIp4, TInet6HeaderUDP* aUdp)
       
   284 /**
       
   285 Update the IPv4 and UDP headers to allow the packet to be looped back.
       
   286 */
       
   287 {
       
   288 	// swap over the destination and source addresses
       
   289 	TUint32 temp;
       
   290 	temp = aIp4->SrcAddr();
       
   291 	aIp4->SetSrcAddr(aIp4->DstAddr());
       
   292 	aIp4->SetDstAddr(temp);
       
   293 
       
   294 	// we've changed the ip hdr so need to recalculate the ip hdr checksum
       
   295 	aIp4->SetChecksum(0); 
       
   296 	aIp4->SetChecksum(TChecksum::ComplementedFold(TChecksum::Calculate((TUint16*)aIp4, aIp4->HeaderLength())));
       
   297 
       
   298 	// also want to set the udp checksum to zero cos it will be wrong now that we have 
       
   299 	// changed the ip hdr - just set to zero and it is ignored
       
   300 	aUdp->SetChecksum(0);
       
   301 
       
   302 }
       
   303 
       
   304 void CDummyIf4::Recv(RMBufChain& aPdu)
       
   305 	{
       
   306 
       
   307 	TInt res;
       
   308 	TBool drop = EFalse;
       
   309 	
       
   310 	// this received data has already been looped back...
       
   311 	// get the ip header from the RMBufChain
       
   312 	TInet6HeaderIP4* ip4 = (TInet6HeaderIP4*) aPdu.First()->Next()->Ptr();
       
   313     if(ip4->Protocol() == KProtocolInetUdp)
       
   314     	{
       
   315 		// get the udp header as well - assume only udp traffic here
       
   316 		TInet6HeaderUDP* udp = (TInet6HeaderUDP*) ip4->EndPtr();
       
   317 	
       
   318 		TUint8* subConn = udp->EndPtr()+1;
       
   319 	
       
   320 		CDummyIfLog::Printf(_L("CDummyIf4::Recv(...): UDP length %d, src port %d, dst port %d"),
       
   321 			udp->Length(), udp->SrcPort(), udp->DstPort());
       
   322 
       
   323 		// depending on the contents, pass it on up thru the stack 
       
   324 		// or maybe do something else
       
   325 
       
   326 		// use the destination port number to decide whether or not the payload is a command
       
   327 		TUint dstPort = udp->DstPort();
       
   328 		if (KDummyNifCmdPort == dstPort)
       
   329 		{	
       
   330 			// let's use the first payload byte as the command byte
       
   331 			switch (*(udp->EndPtr()))
       
   332 			{
       
   333 			case KForceDisconnect:
       
   334 				CDummyIfLog::Printf(_L("KForceDisconnect command"));
       
   335 				// do some action
       
   336 				iNotify->IfProgress(KLinkLayerClosed, KErrCommsLineFail);
       
   337 				iNotify->LinkLayerDown(KErrCommsLineFail, MNifIfNotify::EDisconnect);
       
   338 				// no return code so all we can do is respond with what we got
       
   339 				UpdateHeaders(ip4, udp);
       
   340 				break;
       
   341 
       
   342 			case KForceReconnect:
       
   343 				CDummyIfLog::Printf(_L("KForceReconnect command"));
       
   344 				// do some action
       
   345 				iNotify->IfProgress(KLinkLayerClosed, KErrCommsLineFail);
       
   346 				iNotify->LinkLayerDown(KErrCommsLineFail, MNifIfNotify::EReconnect);
       
   347 				// no return code so all we can do is respond with what we got
       
   348 				UpdateHeaders(ip4, udp);
       
   349 				break;
       
   350 
       
   351 			case KSendNotification:
       
   352 				CDummyIfLog::Printf(_L("KSendNotification command"));
       
   353 				res = iNotify->Notification(ENifToAgentEventTypeQueryIsDialIn);
       
   354 				//let's write the result in the next byte of the reply
       
   355 				if (res == KErrNotSupported)
       
   356 					udp->EndPtr()[1] = (unsigned char) KErrNone;
       
   357 				else
       
   358 					udp->EndPtr()[1] = (unsigned char) KErrGeneral; // this will lose it's sign :-(
       
   359 				
       
   360 				UpdateHeaders(ip4, udp);
       
   361 				break;
       
   362 			case KForceFinishedSelection:
       
   363 				CDummyIfLog::Printf(_L("KForceFinishedSelection command"));
       
   364 				// force subConn into KFinishedSelection State
       
   365 				iNotify->IfProgress(*subConn, KFinishedSelection, KErrNone);
       
   366 
       
   367 				UpdateHeaders(ip4, udp);
       
   368 				break;
       
   369 			default:
       
   370 				CDummyIfLog::Printf(_L("Unknown command - ignoring it"));
       
   371 				drop = ETrue;
       
   372 				// unknown command, just ignore this packet???
       
   373 			}
       
   374 		}
       
   375 		else
       
   376 			{	// just echo the packet back to the original sender
       
   377 			
       
   378 			// update the headers (addresses, checksums etc)
       
   379 			UpdateHeaders(ip4, udp);
       
   380 			// now process it (pass up the stack)
       
   381 			}
       
   382     	}
       
   383     else if(ip4->Protocol() == KProtocolInetTcp)
       
   384     	{
       
   385 		// swap over the destination and source addresses
       
   386 		TUint32 origSrc = ip4->SrcAddr();
       
   387 		TUint32 origDst = ip4->DstAddr();
       
   388 		ip4->SetSrcAddr(origDst);
       
   389 		ip4->SetDstAddr(origSrc);
       
   390 		ip4->SetChecksum(0); 
       
   391 		ip4->SetChecksum(TChecksum::ComplementedFold(TChecksum::Calculate((TUint16*)ip4, ip4->HeaderLength())));
       
   392     	}
       
   393     else
       
   394     	{
       
   395 		CDummyIfLog::Printf(_L("CDummyIf4::Recv(...): IPv4 length %d, protocol %d [passing through]"), ip4->TotalLength(), ip4->Protocol());
       
   396     	}
       
   397     if(drop)
       
   398     	{
       
   399     	aPdu.Free();
       
   400     	}
       
   401     else
       
   402     	{
       
   403     	if(KDelaySlots > 0)
       
   404     		{
       
   405 	    	iLink->Factory().AddDrip(aPdu.First());
       
   406 	    	aPdu.Init();
       
   407     		}
       
   408     	else
       
   409     		{
       
   410 			iProtocol->Process(aPdu, (CProtocolBase*)this);
       
   411     		}
       
   412     	}
       
   413 	}
       
   414 	
       
   415 TInt CDummyIf4::DrainNextDrips(TAny* aSelf)
       
   416 	{
       
   417 	CDummyIf4* self = (CDummyIf4*) aSelf;
       
   418 	RMBuf* next;
       
   419 	while((next = self->iLink->Factory().GetDrip()) != NULL)
       
   420 		{
       
   421 		RMBufChain pdu(next);
       
   422 		self->iProtocol->Process(pdu, (CProtocolBase*)self);
       
   423 		}
       
   424 	return 0;
       
   425 	}
       
   426 	
       
   427 
       
   428 void CDummyIf4::Info(TNifIfInfo& aInfo) const
       
   429 	{
       
   430 	aInfo.iVersion = TVersion(1,1,1);
       
   431 	aInfo.iFlags = KNifIfIsBase | KNifIfUsesNotify | KNifIfCreatedByLink;
       
   432 	aInfo.iName.Copy(iIfName);
       
   433 	aInfo.iProtocolSupported = 0;
       
   434 	}
       
   435 
       
   436 TInt CDummyIf4::Control(TUint aLevel, TUint aName, TDes8& aOption, TAny* /* aSource */)
       
   437 	{
       
   438 	CDummyIfLog::Printf(_L("CDummyIf::Control(aLevel %x, aName %x, ...)"), aLevel, aName);
       
   439 
       
   440 	if (aLevel==KSOLInterface)
       
   441 		{
       
   442 		switch (aName)
       
   443 			{
       
   444 		case KSoIfInfo:
       
   445 			{
       
   446 			TSoIfInfo& opt = *(TSoIfInfo*)aOption.Ptr();
       
   447 
       
   448 			_LIT(KName, "MyName");
       
   449 			opt.iName.Copy(KName);
       
   450 			opt.iFeatures = KIfCanBroadcast | KIfCanMulticast;
       
   451 			opt.iMtu = 1500;
       
   452 			opt.iSpeedMetric = 0;
       
   453 			return KErrNone;
       
   454 			}
       
   455 
       
   456 		case KSoIfHardwareAddr:
       
   457 			return KErrNotSupported;
       
   458 
       
   459 		case KSoIfConfig:
       
   460 			{
       
   461 			TSoInetIfConfig& opt = *(TSoInetIfConfig*)aOption.Ptr();
       
   462 			if (opt.iFamily!=KAfInet)
       
   463 				return KErrNotSupported;
       
   464 
       
   465 			TUint32 address;
       
   466 			const TInt KPort = 65;
       
   467 
       
   468 			opt.iConfig.iAddress.SetAddress(iLocalAddress);
       
   469 			opt.iConfig.iAddress.SetPort(KPort);
       
   470 
       
   471 			// network mask
       
   472 			opt.iConfig.iNetMask.Input(KNetworkMask);
       
   473 			opt.iConfig.iNetMask.SetPort(KPort);
       
   474 
       
   475 			// broadcast address
       
   476 			address = iLocalAddressBase + KBroadcastAddressSuffix;
       
   477 			opt.iConfig.iBrdAddr.SetAddress(address);
       
   478 			opt.iConfig.iBrdAddr.SetPort(KPort);
       
   479 
       
   480 			// default gateway
       
   481 			address = iLocalAddressBase + KDefaultGatewayAddressSuffix;
       
   482 			opt.iConfig.iDefGate.SetAddress(address);
       
   483 			opt.iConfig.iDefGate.SetPort(KPort);
       
   484 
       
   485 			// primary DNS, just make same as default gateway
       
   486 			opt.iConfig.iNameSer1.SetAddress(address);
       
   487 			opt.iConfig.iNameSer1.SetPort(KPort);
       
   488 
       
   489 			// secondary DNS
       
   490 			address = iLocalAddressBase + KSecondaryDnsAddressSuffix;
       
   491 			opt.iConfig.iNameSer2.SetAddress(address);
       
   492 			opt.iConfig.iNameSer2.SetPort(KPort);
       
   493 
       
   494 			return KErrNone;
       
   495 			}
       
   496 
       
   497 		case KSoIfCompareAddr:
       
   498 			if(((TInetAddr&)aOption).Address()!=iLocalAddress)
       
   499 				return KErrBadName;
       
   500 			return KErrNone;
       
   501 
       
   502 		case KSoIfGetConnectionInfo:
       
   503 			TSoIfConnectionInfo& opt = *(TSoIfConnectionInfo*)aOption.Ptr();
       
   504 			TInt err = KErrNone;
       
   505 			TBuf<2*KCommsDbSvrMaxColumnNameLength+1> fieldName;
       
   506 			_LIT(KSlashChar, "\\");
       
   507 
       
   508 			fieldName.Copy(TPtrC(IAP));
       
   509 			fieldName.Append(KSlashChar);
       
   510 			fieldName.Append(TPtrC(COMMDB_ID));
       
   511 			if ((err = iNotify->ReadInt(fieldName, opt.iIAPId)) != KErrNone)
       
   512 				return err;
       
   513 
       
   514 			fieldName.Copy(TPtrC(IAP));
       
   515 			fieldName.Append(KSlashChar);
       
   516 			fieldName.Append(TPtrC(IAP_NETWORK));
       
   517 			if ((err = iNotify->ReadInt(fieldName, opt.iNetworkId)) != KErrNone)
       
   518 				return err;
       
   519 			
       
   520 			return KErrNone;				
       
   521 			}		
       
   522 		}
       
   523 	return KErrNotSupported;
       
   524 	}
       
   525 
       
   526 TInt CDummyIf4::Notification(TAgentToNifEventType /*aEvent*/, void * /*aInfo*/)
       
   527 	{
       
   528 	return KErrNone;
       
   529 	}
       
   530 
       
   531 void CDummyIfLog::Write(const TDesC& aDes)
       
   532 //
       
   533 // Write aText to the log
       
   534 //
       
   535 	{
       
   536 
       
   537 	RFileLogger::Write(KDummyIfLogFolder(), KDummyIfLogFile(), EFileLoggingModeAppend, aDes);
       
   538 	}
       
   539 
       
   540 void CDummyIfLog::Printf(TRefByValue<const TDesC> aFmt,...)
       
   541 //
       
   542 // Write a mulitple argument list to the log, trapping and ignoring any leave
       
   543 //
       
   544 	{
       
   545 
       
   546 	VA_LIST list;
       
   547 	VA_START(list,aFmt);
       
   548 	RFileLogger::WriteFormat(KDummyIfLogFolder(), KDummyIfLogFile(), EFileLoggingModeAppend, aFmt, list);
       
   549 	}
       
   550 
       
   551 void CDummyIfLog::HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen, TInt aWidth)
       
   552 	{
       
   553 
       
   554 	TBuf<0x100> buf;
       
   555 	TInt i = 0;
       
   556 	const TText* p = aHeader;
       
   557 	while (aLen>0)
       
   558 		{
       
   559 		TInt n = aLen>aWidth ? aWidth : aLen;
       
   560 		if (p!=NULL)
       
   561 			{
       
   562 			_LIT(string1,"%s%04x : ");
       
   563 			buf.AppendFormat(string1, p, i);
       
   564 			}
       
   565 		TInt j;
       
   566 		_LIT(string2,"%02x ");
       
   567 		for (j=0; j<n; j++)
       
   568 			buf.AppendFormat(string2, aPtr[i+j]);
       
   569 		_LIT(string3,"   ");
       
   570 		while (j++<KHexDumpWidth)
       
   571 			buf.Append(string3);
       
   572 		_LIT(string4," ");
       
   573 		buf.Append(string4);
       
   574 		_LIT(string5,"%c");
       
   575 		for (j=0; j<n; j++)
       
   576 			buf.AppendFormat(string5, aPtr[i+j]<32 || aPtr[i+j]>126 ? '.' : aPtr[i+j]);
       
   577 		buf.Append(KEndOfLine);
       
   578 		Write(buf);
       
   579 		buf.SetLength(0);
       
   580 		aLen -= n;
       
   581 		i += n;
       
   582 		p = aMargin;
       
   583 		}
       
   584 	}
       
   585 
       
   586