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