smsprotocols/smsstack/wapprot/Src/ws_prtcl.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
       
    15 
       
    16 
       
    17 #include "OstTraceDefinitions.h"
       
    18 #ifdef OST_TRACE_COMPILER_IN_USE
       
    19 #include "ws_prtclTraces.h"
       
    20 #endif
    15 
    21 
    16 #include <e32base.h>
    22 #include <e32base.h>
    17 #include <f32file.h>
    23 #include <f32file.h>
    18 #include "smsprot.h"
    24 #include "smsprot.h"
    19 #include "WAPDGRM.H"
    25 #include "WAPDGRM.H"
    46 //
    52 //
    47 // Factory
    53 // Factory
    48 //
    54 //
    49 CWapSmsProtocol* CWapSmsProtocol::NewL()
    55 CWapSmsProtocol* CWapSmsProtocol::NewL()
    50 	{
    56 	{
    51 	LOGWAPPROT1("CWapSmsProtocol::NewL()");
    57 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_NEWL_1, "CWapSmsProtocol::NewL()");
    52 
    58 
    53 	CWapSmsProtocol* p=new(ELeave) CWapSmsProtocol;
    59 	CWapSmsProtocol* p=new(ELeave) CWapSmsProtocol;
    54 	CleanupStack::PushL(p);
    60 	CleanupStack::PushL(p);
    55 	User::LeaveIfError(p->iFs.Connect());
    61 	User::LeaveIfError(p->iFs.Connect());
    56 	p->iObserver[0]=CWapProtocolObserver::NewL(p);
    62 	p->iObserver[0]=CWapProtocolObserver::NewL(p);
    64 	} // CWapSmsProtocol::NewL
    70 	} // CWapSmsProtocol::NewL
    65 
    71 
    66 
    72 
    67 void CWapSmsProtocol::HandleBackupOrRestoreStartingL()
    73 void CWapSmsProtocol::HandleBackupOrRestoreStartingL()
    68 	{
    74 	{
    69 	LOGWAPPROT1("CWapSmsProtocol::HandleBackupOrRestoreStartingL");
    75 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_HANDLEBACKUPORRESTORESTARTINGL_1, "CWapSmsProtocol::HandleBackupOrRestoreStartingL");
    70 	iWapStore->Close();
    76 	iWapStore->Close();
    71 	} // CWapSmsProtocol::HandleBackupOrRestoreStartingL
    77 	} // CWapSmsProtocol::HandleBackupOrRestoreStartingL
    72 
    78 
    73 
    79 
    74 void CWapSmsProtocol::HandleBackupOrRestoreCompleteL()
    80 void CWapSmsProtocol::HandleBackupOrRestoreCompleteL()
    75 	{
    81 	{
    76 	LOGWAPPROT1("CWapSmsProtocol::HandleBackupOrRestoreCompleteL ");
    82 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_HANDLEBACKUPORRESTORECOMPLETEL_1, "CWapSmsProtocol::HandleBackupOrRestoreCompleteL ");
    77 	iWapStore->DoOpenL();
    83 	iWapStore->DoOpenL();
    78 	} // CWapSmsProtocol::HandleBackupOrRestoreCompleteL
    84 	} // CWapSmsProtocol::HandleBackupOrRestoreCompleteL
    79 
    85 
    80 
    86 
    81 /**
    87 /**
   103 //
   109 //
   104 // Socket server asking for a new sap
   110 // Socket server asking for a new sap
   105 //
   111 //
   106 CServProviderBase *CWapSmsProtocol::NewSAPL(TUint aSocketType)
   112 CServProviderBase *CWapSmsProtocol::NewSAPL(TUint aSocketType)
   107 	{
   113 	{
   108         LOGWAPPROT1("*CWapSmsProtocol::NewSAPL");
   114         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_NEWSAPL_1, "*CWapSmsProtocol::NewSAPL");
   109 
   115 
   110 	if (aSocketType!=KSockDatagram)
   116 	if (aSocketType!=KSockDatagram)
   111 		User::Leave(KErrNotSupported);
   117 		User::Leave(KErrNotSupported);
   112 	CWapSmsProvider *pSAP = CWapSmsProvider::NewL(this);
   118 	CWapSmsProvider *pSAP = CWapSmsProvider::NewL(this);
   113 	AddSAP(pSAP, aSocketType);
   119 	AddSAP(pSAP, aSocketType);
   128 //
   134 //
   129 void CWapSmsProtocol::BindL(CProtocolBase* /*aProtocol*/, TUint /*aId*/)
   135 void CWapSmsProtocol::BindL(CProtocolBase* /*aProtocol*/, TUint /*aId*/)
   130     {
   136     {
   131     // Ignore in code coverage - not intended to be used
   137     // Ignore in code coverage - not intended to be used
   132     BULLSEYE_OFF
   138     BULLSEYE_OFF
   133     LOGWAPPROT1("CWapSmsProtocol::BindL");
   139     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_BINDL_1, "CWapSmsProtocol::BindL");
   134     Panic(EWapSmsCantBind);
   140     Panic(EWapSmsCantBind);
   135     BULLSEYE_RESTORE
   141     BULLSEYE_RESTORE
   136     }
   142     }
   137 
   143 
   138 //
   144 //
   147 //
   153 //
   148 // Identify request from SOCKET server
   154 // Identify request from SOCKET server
   149 //
   155 //
   150 void CWapSmsProtocol::Identify(TServerProtocolDesc *aDes) const
   156 void CWapSmsProtocol::Identify(TServerProtocolDesc *aDes) const
   151 	{
   157 	{
   152     LOGWAPPROT1("CWapSmsProtocol::Identify");
   158     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_IDENTIFY_1, "CWapSmsProtocol::Identify");
   153 
   159 
   154 	aDes->iName=KWAPSMSProtocolId;
   160 	aDes->iName=KWAPSMSProtocolId;
   155 	aDes->iAddrFamily=KWAPSMSAddrFamily;
   161 	aDes->iAddrFamily=KWAPSMSAddrFamily;
   156 	aDes->iSockType=KSockDatagram;
   162 	aDes->iSockType=KSockDatagram;
   157 	aDes->iProtocol=KWAPSMSDatagramProtocol;
   163 	aDes->iProtocol=KWAPSMSDatagramProtocol;
   170 //
   176 //
   171 // Called by socket server to initiate bind to SMS protocol
   177 // Called by socket server to initiate bind to SMS protocol
   172 //
   178 //
   173 void CWapSmsProtocol::BindToL(CProtocolBase* aProtocol)
   179 void CWapSmsProtocol::BindToL(CProtocolBase* aProtocol)
   174 	{
   180 	{
   175     LOGWAPPROT1("CWapSmsProtocol::BindToL");
   181     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_BINDTOL_1, "CWapSmsProtocol::BindToL");
   176 
   182 
   177 	TServerProtocolDesc info;
   183 	TServerProtocolDesc info;
   178 	aProtocol->Identify(&info);
   184 	aProtocol->Identify(&info);
   179 	TUint theirId = info.iProtocol;
   185 	TUint theirId = info.iProtocol;
   180 	Identify(&info);
   186 	Identify(&info);
   196 //
   202 //
   197 // Register the observers with sms.prt
   203 // Register the observers with sms.prt
   198 //
   204 //
   199 void CWapSmsProtocol::BindObserversToSmsL()
   205 void CWapSmsProtocol::BindObserversToSmsL()
   200 	{
   206 	{
   201     LOGWAPPROT1("CWapSmsProtocol::BindObserversToSmsL");
   207     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_BINDOBSERVERSTOSMSL_1, "CWapSmsProtocol::BindObserversToSmsL");
   202 
   208 
   203 	iNextSapPort=KMinWapPortNumber;
   209 	iNextSapPort=KMinWapPortNumber;
   204 	TSmsAddr addr0;
   210 	TSmsAddr addr0;
   205 	TSmsAddr addr1;
   211 	TSmsAddr addr1;
   206 	TSmsAddr addr2;
   212 	TSmsAddr addr2;
   229 //
   235 //
   230 // Deregister the observers
   236 // Deregister the observers
   231 //
   237 //
   232 void CWapSmsProtocol::RemoveObserversFromSmsProtocol()
   238 void CWapSmsProtocol::RemoveObserversFromSmsProtocol()
   233 	{
   239 	{
   234         LOGWAPPROT1("CWapSmsProtocol::RemoveObserversFromSmsProtocol");
   240         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_REMOVEOBSERVERSFROMSMSPROTOCOL_1, "CWapSmsProtocol::RemoveObserversFromSmsProtocol");
   235 
   241 
   236 	if (iSmsProtocol==NULL)
   242 	if (iSmsProtocol==NULL)
   237 		return;
   243 		return;
   238 	iSmsProtocol->RemoveSmsMessageObserver(*iObserver[0]);
   244 	iSmsProtocol->RemoveSmsMessageObserver(*iObserver[0]);
   239 	iSmsProtocol->RemoveSmsMessageObserver(*iObserver[1]);
   245 	iSmsProtocol->RemoveSmsMessageObserver(*iObserver[1]);
   248 //
   254 //
   249 TInt CWapSmsProtocol::Send(TDes8 &, TSockAddr* /*to*/,TSockAddr* /*from*/,CProtocolBase* /*aSourceProtocol*/)
   255 TInt CWapSmsProtocol::Send(TDes8 &, TSockAddr* /*to*/,TSockAddr* /*from*/,CProtocolBase* /*aSourceProtocol*/)
   250     {
   256     {
   251     // Ignore in code coverage - not intended to be used
   257     // Ignore in code coverage - not intended to be used
   252     BULLSEYE_OFF
   258     BULLSEYE_OFF
   253     LOGWAPPROT1("CWapSmsProtocol::Send");
   259     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_SEND_1, "CWapSmsProtocol::Send");
   254     Panic(EWapSmsSendCallCantBind);
   260     Panic(EWapSmsSendCallCantBind);
   255     return KErrNone;
   261     return KErrNone;
   256     BULLSEYE_RESTORE
   262     BULLSEYE_RESTORE
   257     }
   263     }
   258 
   264 
   259 //
   265 //
   260 // Receive an SMS
   266 // Receive an SMS
   261 //
   267 //
   262 void CWapSmsProtocol::ProcessSmsL(const CSmsMessage& aSmsMessage)
   268 void CWapSmsProtocol::ProcessSmsL(const CSmsMessage& aSmsMessage)
   263 	{
   269 	{
   264     LOGWAPPROT1("CWapSmsProtocol::ProcessSmsL");
   270     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_PROCESSSMSL_1, "CWapSmsProtocol::ProcessSmsL");
   265 	TInt index=0;
   271 	TInt index=0;
   266 	TBool storeDatagramComplete = EFalse;
   272 	TBool storeDatagramComplete = EFalse;
   267 	TBool isNewStyleClient = EFalse;
   273 	TBool isNewStyleClient = EFalse;
   268 
   274 
   269 	__ASSERT_DEBUG(aSmsMessage.IsComplete(),Panic(EWapSmsIncompleteSms));
   275 	__ASSERT_DEBUG(aSmsMessage.IsComplete(),Panic(EWapSmsIncompleteSms));
   324 // Get Wap Protocol options
   330 // Get Wap Protocol options
   325 // If none match the level/name pass the query on to SMS
   331 // If none match the level/name pass the query on to SMS
   326 //
   332 //
   327 TInt CWapSmsProtocol::GetOption(TUint aLevel, TUint aName, TDes8& aOption, CProtocolBase* /*aSourceProtocol*/)
   333 TInt CWapSmsProtocol::GetOption(TUint aLevel, TUint aName, TDes8& aOption, CProtocolBase* /*aSourceProtocol*/)
   328 	{
   334 	{
   329     LOGWAPPROT1("CWapSmsProtocol::GetOption");
   335     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_GETOPTION_1, "CWapSmsProtocol::GetOption");
   330 
   336 
   331 	TInt ret = iSmsProtocol->GetOption(aLevel, aName, aOption,this);
   337 	TInt ret = iSmsProtocol->GetOption(aLevel, aName, aOption,this);
   332 	return ret;
   338 	return ret;
   333 	} // CWapSmsProtocol::GetOption
   339 	} // CWapSmsProtocol::GetOption
   334 
   340 
   337 // Set Wap Protocol options
   343 // Set Wap Protocol options
   338 // If none match the level/name pass the query on to SMS
   344 // If none match the level/name pass the query on to SMS
   339 //
   345 //
   340 TInt CWapSmsProtocol::SetOption(TUint aLevel, TUint aName, const TDesC8& aOption, CProtocolBase* /*aSourceProtocol*/)
   346 TInt CWapSmsProtocol::SetOption(TUint aLevel, TUint aName, const TDesC8& aOption, CProtocolBase* /*aSourceProtocol*/)
   341     {
   347     {
   342     LOGWAPPROT1("CWapSmsProtocol::SetOption");
   348     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_SETOPTION_1, "CWapSmsProtocol::SetOption");
   343     
   349     
   344     TInt ret= iSmsProtocol->SetOption(aLevel,aName,aOption,this);
   350     TInt ret= iSmsProtocol->SetOption(aLevel,aName,aOption,this);
   345     return ret;
   351     return ret;
   346     } // CWapSmsProtocol::SetOption
   352     } // CWapSmsProtocol::SetOption
   347 
   353 
   349 //
   355 //
   350 // Inform all SAPs of error.
   356 // Inform all SAPs of error.
   351 //
   357 //
   352 void CWapSmsProtocol::Error(TInt aError, CProtocolBase* /*aSourceProtocol*/)
   358 void CWapSmsProtocol::Error(TInt aError, CProtocolBase* /*aSourceProtocol*/)
   353     {
   359     {
   354     LOGWAPPROT1("CWapSmsProtocol::Error");
   360     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_ERROR_1, "CWapSmsProtocol::Error");
   355     
   361     
   356     TDblQueIter<CWapSmsProvider> iter(iSAPList);
   362     TDblQueIter<CWapSmsProvider> iter(iSAPList);
   357     CWapSmsProvider* sap;
   363     CWapSmsProvider* sap;
   358     while (sap = iter++, sap!=NULL)
   364     while (sap = iter++, sap!=NULL)
   359         sap->Error(aError,MSocketNotify::EErrorAllOperations);
   365         sap->Error(aError,MSocketNotify::EErrorAllOperations);
   364 //
   370 //
   365 CHostResolvProvdBase *CWapSmsProtocol::NewHostResolverL()
   371 CHostResolvProvdBase *CWapSmsProtocol::NewHostResolverL()
   366     {
   372     {
   367     // Ignore in code coverage - not intended to be used
   373     // Ignore in code coverage - not intended to be used
   368     BULLSEYE_OFF
   374     BULLSEYE_OFF
   369     LOGWAPPROT1("*CWapSmsProtocol::NewHostResolverL");
   375     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_NEWHOSTRESOLVERL_1, "*CWapSmsProtocol::NewHostResolverL");
   370     Panic(EWapSmsCantCreateHostResolver);
   376     Panic(EWapSmsCantCreateHostResolver);
   371     return NULL;
   377     return NULL;
   372     BULLSEYE_RESTORE
   378     BULLSEYE_RESTORE
   373     }
   379     }
   374 
   380 
   377 //
   383 //
   378 CServiceResolvProvdBase *CWapSmsProtocol::NewServiceResolverL()
   384 CServiceResolvProvdBase *CWapSmsProtocol::NewServiceResolverL()
   379     {
   385     {
   380     // Ignore in code coverage - not intended to be used
   386     // Ignore in code coverage - not intended to be used
   381     BULLSEYE_OFF
   387     BULLSEYE_OFF
   382     LOGWAPPROT1("*CWapSmsProtocol::NewServiceResolverL");
   388     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_NEWSERVICERESOLVERL_1, "*CWapSmsProtocol::NewServiceResolverL");
   383     Panic(EWapSmsCantCreateServiceResolver);
   389     Panic(EWapSmsCantCreateServiceResolver);
   384     return NULL;
   390     return NULL;
   385     BULLSEYE_RESTORE
   391     BULLSEYE_RESTORE
   386     }
   392     }
   387 
   393 
   390 //
   396 //
   391 CNetDBProvdBase* CWapSmsProtocol::NewNetDatabaseL()
   397 CNetDBProvdBase* CWapSmsProtocol::NewNetDatabaseL()
   392     {
   398     {
   393     // Ignore in code coverage - not intended to be used
   399     // Ignore in code coverage - not intended to be used
   394     BULLSEYE_OFF
   400     BULLSEYE_OFF
   395     LOGWAPPROT1("CWapSmsProtocol::NewNetDatabaseL");
   401     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_NEWNETDATABASEL_1, "CWapSmsProtocol::NewNetDatabaseL");
   396     Panic(EWapSmsCantCreateNetDatabase);
   402     Panic(EWapSmsCantCreateNetDatabase);
   397     return NULL;
   403     return NULL;
   398     BULLSEYE_RESTORE
   404     BULLSEYE_RESTORE
   399     }
   405     }
   400 
   406 
   401 //
   407 //
   402 // Add a SAP to the SAP list and checks the SAR store for this SAP's entries
   408 // Add a SAP to the SAP list and checks the SAR store for this SAP's entries
   403 //
   409 //
   404 void CWapSmsProtocol::AddSAP(CWapSmsProvider* aSAP, TUint /*aSockType*/)
   410 void CWapSmsProtocol::AddSAP(CWapSmsProvider* aSAP, TUint /*aSockType*/)
   405 	{
   411 	{
   406     LOGWAPPROT1("CWapSmsProtocol::AddSAP");
   412     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_ADDSAP_1, "CWapSmsProtocol::AddSAP");
   407 
   413 
   408 	iSAPList.AddLast(*aSAP);
   414 	iSAPList.AddLast(*aSAP);
   409 	} // CWapSmsProtocol::AddSAP
   415 	} // CWapSmsProtocol::AddSAP
   410 
   416 
   411 
   417 
   412 //
   418 //
   413 // Set the sap port number
   419 // Set the sap port number
   414 //
   420 //
   415 TBool CWapSmsProtocol::AllocateLocalAddress(TWapAddr& aAddr)
   421 TBool CWapSmsProtocol::AllocateLocalAddress(TWapAddr& aAddr)
   416 	{
   422 	{
   417     LOGWAPPROT1("CWapSmsProtocol::AllocateLocalAddressL");
   423     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_ALLOCATELOCALADDRESS_1, "CWapSmsProtocol::AllocateLocalAddressL");
   418 	//
   424 	//
   419 	TBool found=EFalse;
   425 	TBool found=EFalse;
   420 	TUint count=0,attempts=0;
   426 	TUint count=0,attempts=0;
   421 	count =KMaxWapPortNumber-KMinWapPortNumber+1;
   427 	count =KMaxWapPortNumber-KMinWapPortNumber+1;
   422 
   428 
   439 //
   445 //
   440 // Find the provider who wants the message
   446 // Find the provider who wants the message
   441 //
   447 //
   442 CWapSmsProvider* CWapSmsProtocol::LookupSAP(CWapDatagram* aMsg)
   448 CWapSmsProvider* CWapSmsProtocol::LookupSAP(CWapDatagram* aMsg)
   443 	{
   449 	{
   444 	LOGWAPPROT1("CWapSmsProtocol::LookupSAP");
   450 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_LOOKUPSAP_1, "CWapSmsProtocol::LookupSAP");
   445 
   451 
   446 	TBuf8<KMaxSockAddrSize> addrBuf;
   452 	TBuf8<KMaxSockAddrSize> addrBuf;
   447 	addrBuf.Copy(aMsg->FromAddress());
   453 	addrBuf.Copy(aMsg->FromAddress());
   448 	TInt toPort=0;
   454 	TInt toPort=0;
   449 	TInt fromPort=0;
   455 	TInt fromPort=0;
   475 //
   481 //
   476 // Check for duplicate address
   482 // Check for duplicate address
   477 //
   483 //
   478 TInt CWapSmsProtocol::AddrAlreadyUsedByWAP(const TWapAddr &aAddr, const CWapSmsProvider* aSap)
   484 TInt CWapSmsProtocol::AddrAlreadyUsedByWAP(const TWapAddr &aAddr, const CWapSmsProvider* aSap)
   479 	{
   485 	{
   480     LOGWAPPROT1("CWapSmsProtocol::AddrAlreadyUsedByWAP");
   486     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_ADDRALREADYUSEDBYWAP_1, "CWapSmsProtocol::AddrAlreadyUsedByWAP");
   481 
   487 
   482 	TDblQueIter<CWapSmsProvider> iter(iSAPList);
   488 	TDblQueIter<CWapSmsProvider> iter(iSAPList);
   483 	CWapSmsProvider* sap;
   489 	CWapSmsProvider* sap;
   484 
   490 
   485 	while ((sap = iter++)!=NULL)
   491 	while ((sap = iter++)!=NULL)
   490 				return KErrAlreadyExists;
   496 				return KErrAlreadyExists;
   491 			else
   497 			else
   492 				return KErrInUse;
   498 				return KErrInUse;
   493 			}
   499 			}
   494 		}
   500 		}
   495 	LOGWAPPROT1("CWapSmsProtocol::AddrAlreadyUsedByWAP not used by WAP");
   501 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_ADDRALREADYUSEDBYWAP_2, "CWapSmsProtocol::AddrAlreadyUsedByWAP not used by WAP");
   496 	return KErrNone;
   502 	return KErrNone;
   497 	} // CWapSmsProtocol::AddrAlreadyUsedByWAP
   503 	} // CWapSmsProtocol::AddrAlreadyUsedByWAP
   498 
   504 
   499 
   505 
   500 //
   506 //
   501 // Return a pointer to the sms protocol
   507 // Return a pointer to the sms protocol
   502 //
   508 //
   503 CSmsProtocol* CWapSmsProtocol::SmsProtocol()
   509 CSmsProtocol* CWapSmsProtocol::SmsProtocol()
   504     {
   510     {
   505     LOGWAPPROT1("CWapSmsProtocol::SmsProtocol()");
   511     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_SMSPROTOCOL_1, "CWapSmsProtocol::SmsProtocol()");
   506 
   512 
   507     return iSmsProtocol;
   513     return iSmsProtocol;
   508     } // CWapSmsProtocol::SmsProtocol
   514     } // CWapSmsProtocol::SmsProtocol
   509 
   515 
   510 
   516 
   511 //
   517 //
   512 //	Search the store for particular datagram, if found the entry is deleted
   518 //	Search the store for particular datagram, if found the entry is deleted
   513 //
   519 //
   514 TBool CWapSmsProtocol::FindAndDeleteMsg(CWapDatagram& aDatagram)
   520 TBool CWapSmsProtocol::FindAndDeleteMsg(CWapDatagram& aDatagram)
   515 	{
   521 	{
   516 	LOGWAPPROT1("CWapSmsProtocol::FindAndDeleteMsg()");
   522 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_FINDANDDELETEMSG_1, "CWapSmsProtocol::FindAndDeleteMsg()");
   517 
   523 
   518 	TInt err;
   524 	TInt err;
   519 	TInt ret = EFalse;
   525 	TInt ret = EFalse;
   520 	TRAP(err,ret=iWapStore->FindAndDeleteDatagramL(aDatagram));
   526 	TRAP(err,ret=iWapStore->FindAndDeleteDatagramL(aDatagram));
   521 	__ASSERT_DEBUG(!err,Panic(EWapSmsNotFoundInStore));
   527 	__ASSERT_DEBUG(!err,Panic(EWapSmsNotFoundInStore));
   531 //	Note:	This retrieves stored but not acked messages for this SAP
   537 //	Note:	This retrieves stored but not acked messages for this SAP
   532 //			Is called when client's socket binds to address
   538 //			Is called when client's socket binds to address
   533 //
   539 //
   534 TInt CWapSmsProtocol::CheckSarL(const TWapAddr& aAddr,CWapSmsProvider* aSap)
   540 TInt CWapSmsProtocol::CheckSarL(const TWapAddr& aAddr,CWapSmsProvider* aSap)
   535 	{
   541 	{
   536 	LOGWAPPROT1("CWapSmsProtocol::CheckSarL()");
   542 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_CHECKSARL_1, "CWapSmsProtocol::CheckSarL()");
   537 
   543 
   538 	TInt count=0;
   544 	TInt count=0;
   539 	TInt err = KErrNone;
   545 	TInt err = KErrNone;
   540 	count = iWapStore->Entries().Count();
   546 	count = iWapStore->Entries().Count();
   541 	TWapReassemblyEntry entry;
   547 	TWapReassemblyEntry entry;