smsprotocols/smsstack/smsprot/Src/smsprov.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2001-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".
    18 
    18 
    19 /**
    19 /**
    20  @file
    20  @file
    21 */
    21 */
    22 
    22 
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "smsprovTraces.h"
       
    27 #endif
       
    28 
       
    29 #include "smsprot.h"
    23 #include "smsprot.h"
    30 
    24 
    31 #include <es_ver.h>
    25 #include <es_ver.h>
    32 #include <es_mbuf.h>
    26 #include <es_mbuf.h>
    33 
    27 
    36 #include "Gsmumsg.h"
    30 #include "Gsmumsg.h"
    37 
    31 
    38 #include "smsustrm.h"
    32 #include "smsustrm.h"
    39 #include "smspmain.h"
    33 #include "smspmain.h"
    40 #include "smspfacadestor.h"
    34 #include "smspfacadestor.h"
    41 
       
    42 #include "smsstacklog.h"
       
    43 
    35 
    44 // CSmsProvider policies
    36 // CSmsProvider policies
    45 //
    37 //
    46 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlDeleteSmsMessagePolicy,ECapabilityWriteUserData);
    38 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlDeleteSmsMessagePolicy,ECapabilityWriteUserData);
    47 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlEnumerateSmsMessagesPolicy,ECapabilityReadUserData );
    39 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlEnumerateSmsMessagesPolicy,ECapabilityReadUserData );
    67  *  @return a new CSmsProvider object.
    59  *  @return a new CSmsProvider object.
    68  *  
    60  *  
    69  */
    61  */
    70 CSmsProvider* CSmsProvider::NewL(CSmsProtocol& aProtocol)
    62 CSmsProvider* CSmsProvider::NewL(CSmsProtocol& aProtocol)
    71     {
    63     {
    72     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_NEWL_1, "CSmsProvider::NewL");
    64     LOGSMSPROT1("CSmsProvider::NewL");
    73     
    65     
    74     CSmsProvider* self =new(ELeave) CSmsProvider(aProtocol);
    66     CSmsProvider* self =new(ELeave) CSmsProvider(aProtocol);
    75     CleanupStack::PushL(self);
    67     CleanupStack::PushL(self);
    76     self->ConstructL();
    68     self->ConstructL();
    77     CleanupStack::Pop(self);
    69     CleanupStack::Pop(self);
    78 
    70 
    79     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_NEWL_2, "-> CSmsProvider::NewL - done");
    71     LOGSMSPROT1("-> CSmsProvider::NewL - done");
    80     
    72     
    81     return self;
    73     return self;
    82     }
    74     }
    83 
    75 
    84 /**
    76 /**
    97  *  receive buffers.
    89  *  receive buffers.
    98  *  
    90  *  
    99  */
    91  */
   100 void CSmsProvider::ConstructL()
    92 void CSmsProvider::ConstructL()
   101     {
    93     {
   102     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CONSTRUCTL_1, "CSmsProvider::ConstructL");
    94     LOGSMSPROT1("CSmsProvider::ConstructL");
   103     
    95     
   104     iProtocol.AddSmsMessageObserverL(*this);
    96     iProtocol.AddSmsMessageObserverL(*this);
   105     SetObserverAddedToProtocol(ETrue);
    97     SetObserverAddedToProtocol(ETrue);
   106     iRecvBufSegArray=new(ELeave) CArrayPtrFlat<CBufSeg>(8);
    98     iRecvBufSegArray=new(ELeave) CArrayPtrFlat<CBufSeg>(8);
   107     iSendBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength);
    99     iSendBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength);
   108     
   100     
   109     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CONSTRUCTL_2, "-> CSmsProvider::ConstructL - done");
   101     LOGSMSPROT1("-> CSmsProvider::ConstructL - done");
   110     }
   102     }
   111 
   103 
   112 /**
   104 /**
   113  *  D'tor
   105  *  D'tor
   114  *  
   106  *  
   134  *  Does nothing.  Implementation of pure virtual CServProviderBase::Start().
   126  *  Does nothing.  Implementation of pure virtual CServProviderBase::Start().
   135  *  
   127  *  
   136  */
   128  */
   137 void CSmsProvider::Start()
   129 void CSmsProvider::Start()
   138     {
   130     {
   139     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_START_1, "CSmsProvider::Start");
   131     LOGSMSPROT1("CSmsProvider::Start");
   140     }
   132     }
   141 
   133 
   142 /**
   134 /**
   143  *  Returns the local address of this SAP.  Implementation of
   135  *  Returns the local address of this SAP.  Implementation of
   144  *  pure virtual CServProviderBase::LocalName().
   136  *  pure virtual CServProviderBase::LocalName().
   145  *  
   137  *  
   146  */
   138  */
   147 void CSmsProvider::LocalName(TSockAddr& aAddr) const
   139 void CSmsProvider::LocalName(TSockAddr& aAddr) const
   148     {
   140     {
   149     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_LOCALNAME_1, "CSmsProvider::LocalName");
   141     LOGSMSPROT1("CSmsProvider::LocalName");
   150     aAddr = iLocalAddress;
   142     aAddr = iLocalAddress;
   151     }
   143     }
   152 
   144 
   153 /**
   145 /**
   154  *  Sets the local address of this SAP by binding it to the protocol.
   146  *  Sets the local address of this SAP by binding it to the protocol.
   160  *  
   152  *  
   161  *  @capability NetworkServices
   153  *  @capability NetworkServices
   162  */
   154  */
   163 TInt CSmsProvider::SetLocalName(TSockAddr& aAddr)
   155 TInt CSmsProvider::SetLocalName(TSockAddr& aAddr)
   164     {
   156     {
   165     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SETLOCALNAME_1, "CSmsProvider::SetLocalName");
   157     LOGSMSPROT1("CSmsProvider::SetLocalName");
   166     
   158     
   167     if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderSetLocalNamePolicy,"CSmsProvider SetLocal Name policy check") != KErrNone) )
   159     if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderSetLocalNamePolicy,"CSmsProvider SetLocal Name policy check") != KErrNone) )
   168         {
   160         {
   169         return KErrPermissionDenied;
   161         return KErrPermissionDenied;
   170         }
   162         }
   188  */
   180  */
   189 void CSmsProvider::RemName(TSockAddr& /*aAddr*/) const
   181 void CSmsProvider::RemName(TSockAddr& /*aAddr*/) const
   190     {
   182     {
   191     // Ignore in code coverage - not intended to be used
   183     // Ignore in code coverage - not intended to be used
   192     BULLSEYE_OFF    
   184     BULLSEYE_OFF    
   193     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_REMNAME_1, "CSmsProvider::RemName");
   185     LOGSMSPROT1("CSmsProvider::RemName");
   194     BULLSEYE_RESTORE
   186     BULLSEYE_RESTORE
   195     }
   187     }
   196 
   188 
   197 /**
   189 /**
   198  *  Called by the protocol to set the remote name of the connection.
   190  *  Called by the protocol to set the remote name of the connection.
   203  */
   195  */
   204 TInt CSmsProvider::SetRemName(TSockAddr& /*aAddr*/)
   196 TInt CSmsProvider::SetRemName(TSockAddr& /*aAddr*/)
   205     {
   197     {
   206     // Ignore in code coverage - not intended to be used
   198     // Ignore in code coverage - not intended to be used
   207     BULLSEYE_OFF    
   199     BULLSEYE_OFF    
   208     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SETREMNAME_1, "CSmsProvider::SetRemName");
   200     LOGSMSPROT1("CSmsProvider::SetRemName");
   209     return KErrNotSupported;
   201     return KErrNotSupported;
   210     BULLSEYE_RESTORE
   202     BULLSEYE_RESTORE
   211     }
   203     }
   212 
   204 
   213 /**
   205 /**
   218  */
   210  */
   219 TInt CSmsProvider::GetOption(TUint /*aLevel*/,TUint /*aName*/,TDes8& /*aOption*/) const
   211 TInt CSmsProvider::GetOption(TUint /*aLevel*/,TUint /*aName*/,TDes8& /*aOption*/) const
   220     {
   212     {
   221     // Ignore in code coverage - not intended to be used
   213     // Ignore in code coverage - not intended to be used
   222     BULLSEYE_OFF    
   214     BULLSEYE_OFF    
   223     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_GETOPTION_1, "CSmsProvider::GetOption");
   215     LOGSMSPROT1("CSmsProvider::GetOption");
   224     return 0;
   216     return 0;
   225     BULLSEYE_RESTORE
   217     BULLSEYE_RESTORE
   226     }
   218     }
   227 
   219 
   228 /**
   220 /**
   242  *  @param aOption the IOCTL option.
   234  *  @param aOption the IOCTL option.
   243  *  
   235  *  
   244  */
   236  */
   245 void CSmsProvider::Ioctl(TUint aLevel,TUint aName,TDes8* aOption)
   237 void CSmsProvider::Ioctl(TUint aLevel,TUint aName,TDes8* aOption)
   246     {
   238     {
   247     OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_1, "CSmsProvider::Ioctl [aLevel=%u, aName=%u provider=0x%08x]",  aLevel, aName, (TUint)this);
   239     LOGSMSPROT3("CSmsProvider::Ioctl [aLevel=%d, aName=%d]", aLevel, aName);
       
   240     LOGSMSPROT2("CSmsProvider::Ioctl [provider=0x%08x]",this);
   248     
   241     
   249     // Panic in debug mode if this call is invalid in this SAPs current state
   242     // Panic in debug mode if this call is invalid in this SAPs current state
   250     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   243     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   251     __ASSERT_DEBUG(!IoctlOutstanding(),SmspPanic(KSmspPanicIoctlAlreadyOutstanding));
   244     __ASSERT_DEBUG(!IoctlOutstanding(),SmspPanic(KSmspPanicIoctlAlreadyOutstanding));
   252     // Gracefully handle invalid calls in release build
   245     // Gracefully handle invalid calls in release build
   380                     // Read message from the socket
   373                     // Read message from the socket
   381                     CSmsMessage*smsmessage=NULL;
   374                     CSmsMessage*smsmessage=NULL;
   382                     TRAPD(ret,(smsmessage=InternalizeMessageL()));
   375                     TRAPD(ret,(smsmessage=InternalizeMessageL()));
   383                     if( ret!=KErrNone )
   376                     if( ret!=KErrNone )
   384                         {
   377                         {
   385                         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_3, "-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret);
   378                         LOGSMSPROT2("-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret);
   386                         iSendBufSeg->Reset();
   379                         iSendBufSeg->Reset();
   387                         iSocket->Error(ret, MSocketNotify::EErrorIoctl);
   380                         iSocket->Error(ret, MSocketNotify::EErrorIoctl);
   388                         }
   381                         }
   389                     else
   382                     else
   390                         {
   383                         {
   406                     CSmsMessage*smsmessage=NULL;
   399                     CSmsMessage*smsmessage=NULL;
   407                     TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(0))));
   400                     TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(0))));
   408                     if( ret==KErrNone )
   401                     if( ret==KErrNone )
   409                         {
   402                         {
   410                         TRAP(ret,(iProtocol.DeleteSMSFromReaStoreL( *smsmessage )));
   403                         TRAP(ret,(iProtocol.DeleteSMSFromReaStoreL( *smsmessage )));
   411                         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_4, "-> CSmsProvider::Ioctl - CSmsProvider::DeleteSMSFromReaStoreL [ret=%d]", ret);
   404                         LOGSMSPROT2("-> CSmsProvider::Ioctl - CSmsProvider::DeleteSMSFromReaStoreL [ret=%d]", ret);
   412                         }
   405                         }
   413                     else
   406                     else
   414                         {
   407                         {
   415                         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_5, "-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret);
   408                         LOGSMSPROT2("-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret);
   416                         }
   409                         }
   417                     delete smsmessage;
   410                     delete smsmessage;
   418                     // Looking for more sms left in the store
   411                     // Looking for more sms left in the store
   419                     // This is now done after finishing the readprocess
   412                     // This is now done after finishing the readprocess
   420                     iProtocol.MessageReadedSuccessfully();
   413                     iProtocol.MessageReadedSuccessfully();
   421                     if( iEnumSocket )
   414                     if( iEnumSocket )
   422                         {
   415                         {
   423                         --iNumOfEnumeratedMessages;
   416                         --iNumOfEnumeratedMessages;
   424                         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_6, "-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=%d]", iNumOfEnumeratedMessages);
   417                         LOGSMSPROT2("-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=%d]", iNumOfEnumeratedMessages);
   425                         if( iNumOfEnumeratedMessages <= 0 )
   418                         if( iNumOfEnumeratedMessages <= 0 )
   426                             {
   419                             {
   427                             iProtocol.iPhoneEnumerationObserver=NULL;
   420                             iProtocol.iPhoneEnumerationObserver=NULL;
   428                             iEnumSocket=EFalse;
   421                             iEnumSocket=EFalse;
   429                             iProtocol.MessageReadedSuccessfully();
   422                             iProtocol.MessageReadedSuccessfully();
   430                             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_7, "-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=NULL]");
   423                             LOGSMSPROT1("-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=NULL]");
   431                             }
   424                             }
   432                         }
   425                         }
   433                     // Remove the message from the receive buffer & complete
   426                     // Remove the message from the receive buffer & complete
   434                     delete iRecvBufSegArray->At(0);
   427                     delete iRecvBufSegArray->At(0);
   435                     iRecvBufSegArray->At(0) = NULL;
   428                     iRecvBufSegArray->At(0) = NULL;
   454                             {
   447                             {
   455                             --iNumOfEnumeratedMessages;
   448                             --iNumOfEnumeratedMessages;
   456                             if( iNumOfEnumeratedMessages <= 0 )
   449                             if( iNumOfEnumeratedMessages <= 0 )
   457                                 {
   450                                 {
   458                                 iProtocol.iPhoneEnumerationObserver=NULL;
   451                                 iProtocol.iPhoneEnumerationObserver=NULL;
   459                                 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_8, "-> CSmsProvider::Ioctl - fail [iNumOfEnumeratedMessages=NULL]");
   452                                 LOGSMSPROT1("-> CSmsProvider::Ioctl - fail [iNumOfEnumeratedMessages=NULL]");
   460                                 iEnumSocket=EFalse;
   453                                 iEnumSocket=EFalse;
   461                                 iProtocol.MessageReadedSuccessfully();
   454                                 iProtocol.MessageReadedSuccessfully();
   462                                 }
   455                                 }
   463                             }
   456                             }
   464                         iSocket->Error(KErrNotSupported,MSocketNotify::EErrorIoctl);
   457                         iSocket->Error(KErrNotSupported,MSocketNotify::EErrorIoctl);
   562  *  @param aName the name of the ioctl request to cancel.
   555  *  @param aName the name of the ioctl request to cancel.
   563  *  
   556  *  
   564  */
   557  */
   565 void CSmsProvider::CancelIoctl(TUint aLevel, TUint aName)
   558 void CSmsProvider::CancelIoctl(TUint aLevel, TUint aName)
   566     {
   559     {
   567     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CANCELIOCTL_1, "CSmsProvider::CancelIoctl [aLevel=%u, aName=%u]", aLevel, aName);
   560     LOGSMSPROT3("CSmsProvider::CancelIoctl [aLevel=%d, aName=%d]", aLevel, aName);
   568     
   561     
   569     // Panic in debug mode if this call is invalid in this SAPs current state
   562     // Panic in debug mode if this call is invalid in this SAPs current state
   570     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   563     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   571     __ASSERT_DEBUG(iName==aName,SmspPanic(ESmspBadIoctlName));
   564     __ASSERT_DEBUG(iName==aName,SmspPanic(ESmspBadIoctlName));
   572     if( iName != aName )
   565     if( iName != aName )
   588                     {
   581                     {
   589                     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   582                     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   590                     iProtocol.CancelEnumeratePhone(*this);
   583                     iProtocol.CancelEnumeratePhone(*this);
   591                     iEnumSocket=EFalse;
   584                     iEnumSocket=EFalse;
   592                     iProtocol.iPhoneEnumerationObserver=NULL;
   585                     iProtocol.iPhoneEnumerationObserver=NULL;
   593                     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CANCELIOCTL_2, "-> CSmsProvider::CancelIoctl - [iNumOfEnumeratedMessages=NULL]");
   586                     LOGSMSPROT1("-> CSmsProvider::CancelIoctl - [iNumOfEnumeratedMessages=NULL]");
   594                     } break;
   587                     } break;
   595                 case KIoctlWriteSmsMessage:
   588                 case KIoctlWriteSmsMessage:
   596                     {
   589                     {
   597                     iProtocol.CancelWriteSmsMessage(*this);
   590                     iProtocol.CancelWriteSmsMessage(*this);
   598                     } break;
   591                     } break;
   635  */
   628  */
   636 TInt CSmsProvider::SetOption(TUint /*aLevel*/,TUint /*aName*/,const TDesC8& /*aOption*/)
   629 TInt CSmsProvider::SetOption(TUint /*aLevel*/,TUint /*aName*/,const TDesC8& /*aOption*/)
   637     {
   630     {
   638     // Ignore in code coverage - not intended to be used
   631     // Ignore in code coverage - not intended to be used
   639     BULLSEYE_OFF    
   632     BULLSEYE_OFF    
   640     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SETOPTION_1, "CSmsProvider::SetOption()");
   633     LOGSMSPROT1("CSmsProvider::SetOption()");
   641     return 0;
   634     return 0;
   642     BULLSEYE_RESTORE
   635     BULLSEYE_RESTORE
   643     }
   636     }
   644 
   637 
   645 /**
   638 /**
   659  *  
   652  *  
   660  *  @capability None
   653  *  @capability None
   661  */
   654  */
   662 TInt CSmsProvider::Write(RMBufChain& aBufChain, TUint /*aOptions*/, TSockAddr* /*aAddr*/)
   655 TInt CSmsProvider::Write(RMBufChain& aBufChain, TUint /*aOptions*/, TSockAddr* /*aAddr*/)
   663     {
   656     {
   664     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_WRITE_1, "CSmsProvider::Write");
   657     LOGSMSPROT1("CSmsProvider::Write");
   665     
   658     
   666     if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderWritePolicy,"CSmsProvider Write policy check") != KErrNone) )
   659     if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderWritePolicy,"CSmsProvider Write policy check") != KErrNone) )
   667         {
   660         {
   668         return KErrPermissionDenied;
   661         return KErrPermissionDenied;
   669         }
   662         }
   670     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   663     __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily));
   671     
   664     
   672     /// @note: LOGIFH2A2 macro for logging esock write
   665     /// @note: LOGIFH2A2 macro for logging esock write
   673     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_WRITE_2, "-> CSmsProvider::Write [%d bytes]", aBufChain.Length());
   666     LOGSMSPROT2("-> CSmsProvider::Write [%d bytes]", aBufChain.Length());
   674 #ifdef SMSLOGGERIF
   667 #ifdef SMSLOGGERIF
   675 	HBufC8* debugBuf = HBufC8::New(aBufChain.Length());
   668 	HBufC8* debugBuf = HBufC8::New(aBufChain.Length());
   676 	if(debugBuf)
   669 	if(debugBuf)
   677 		{
   670 		{
   678 		TPtr8 debugData = debugBuf->Des();
   671 		TPtr8 debugData = debugBuf->Des();
   728  */
   721  */
   729 TInt CSmsProvider::GetData(RMBufChain& aBufChain, TUint /*aLength*/, TUint /*aOptions*/, TSockAddr* /*aAddr*/)
   722 TInt CSmsProvider::GetData(RMBufChain& aBufChain, TUint /*aLength*/, TUint /*aOptions*/, TSockAddr* /*aAddr*/)
   730     {
   723     {
   731     __ASSERT_DEBUG((iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound) && (iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly),SmspPanic(KSmspPanicWrongSmsAddressFamily));
   724     __ASSERT_DEBUG((iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound) && (iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly),SmspPanic(KSmspPanicWrongSmsAddressFamily));
   732 
   725 
   733     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_GETDATA_1, "CSmsProvider::GetData [provider=0x%08x]", (TUint)this);
   726     LOGSMSPROT2("CSmsProvider::GetData [provider=0x%08x]", this);
   734     
   727     
   735     // Get the segmented buffer of first message
   728     // Get the segmented buffer of first message
   736     CBufSeg* recvbufseg=iRecvBufSegArray->At(0);
   729     CBufSeg* recvbufseg=iRecvBufSegArray->At(0);
   737     TInt size=recvbufseg->Size();
   730     TInt size=recvbufseg->Size();
   738     __ASSERT_DEBUG(iSegmentIndex<NumSegments(size),SmspPanic(KSmspPanicBadClientMessageRead));
   731     __ASSERT_DEBUG(iSegmentIndex<NumSegments(size),SmspPanic(KSmspPanicBadClientMessageRead));
   779  */
   772  */
   780 void CSmsProvider::ActiveOpen()
   773 void CSmsProvider::ActiveOpen()
   781     {
   774     {
   782     // Ignore in code coverage - not intended to be used
   775     // Ignore in code coverage - not intended to be used
   783     BULLSEYE_OFF    
   776     BULLSEYE_OFF    
   784     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_ACTIVEOPEN_1, "CSmsProvider::ActiveOpen [does nothing]");
   777     LOGSMSPROT1("CSmsProvider::ActiveOpen [does nothing]");
   785     BULLSEYE_RESTORE
   778     BULLSEYE_RESTORE
   786     }
   779     }
   787 
   780 
   788 /**
   781 /**
   789  *  Called by the socket server to indicate the provider should connect to
   782  *  Called by the socket server to indicate the provider should connect to
   794  */
   787  */
   795 void CSmsProvider::ActiveOpen(const TDesC8& /*aConnectionData*/)
   788 void CSmsProvider::ActiveOpen(const TDesC8& /*aConnectionData*/)
   796     {
   789     {
   797     // Ignore in code coverage - not intended to be used
   790     // Ignore in code coverage - not intended to be used
   798     BULLSEYE_OFF    
   791     BULLSEYE_OFF    
   799     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_ACTIVEOPEN1_1, "CSmsProvider::ActiveOpen [does nothing]");
   792     LOGSMSPROT1("CSmsProvider::ActiveOpen [does nothing]");
   800     BULLSEYE_RESTORE
   793     BULLSEYE_RESTORE
   801     }
   794     }
   802 
   795 
   803 /**
   796 /**
   804  *  Called by the socket server to indicate the provider should wait for an
   797  *  Called by the socket server to indicate the provider should wait for an
   810  */
   803  */
   811 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/)
   804 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/)
   812     {
   805     {
   813     // Ignore in code coverage - not intended to be used
   806     // Ignore in code coverage - not intended to be used
   814     BULLSEYE_OFF    
   807     BULLSEYE_OFF    
   815     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_PASSIVEOPEN_1, "CSmsProvider::PassiveOpen [not supported]");
   808     LOGSMSPROT1("CSmsProvider::PassiveOpen [not supported]");
   816     return KErrNotSupported;
   809     return KErrNotSupported;
   817     BULLSEYE_RESTORE
   810     BULLSEYE_RESTORE
   818     }
   811     }
   819 
   812 
   820 /**
   813 /**
   827  */
   820  */
   828 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/,const TDesC8& /*aConnectionData*/)
   821 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/,const TDesC8& /*aConnectionData*/)
   829     {
   822     {
   830     // Ignore in code coverage - not intended to be used
   823     // Ignore in code coverage - not intended to be used
   831     BULLSEYE_OFF    
   824     BULLSEYE_OFF    
   832     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_PASSIVEOPEN1_1, "CSmsProvider::PassiveOpen [not supported]");
   825     LOGSMSPROT1("CSmsProvider::PassiveOpen [not supported]");
   833     return KErrNotSupported;
   826     return KErrNotSupported;
   834     BULLSEYE_RESTORE
   827     BULLSEYE_RESTORE
   835     }
   828     }
   836 
   829 
   837 /**
   830 /**
   840  *  Implementation of the pure virtual CServProviderBase::Shutdown().
   833  *  Implementation of the pure virtual CServProviderBase::Shutdown().
   841  *  
   834  *  
   842  */
   835  */
   843 void CSmsProvider::Shutdown(TCloseType aOption)
   836 void CSmsProvider::Shutdown(TCloseType aOption)
   844     {
   837     {
   845     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN_1, "CSmsProvider::Shutdown [aOption=%d]", aOption);
   838     LOGSMSPROT2("CSmsProvider::Shutdown [aOption=%d]", aOption);
   846     
   839     
   847     TInt messagesInBuffer = iRecvBufSegArray->Count();
   840     TInt messagesInBuffer = iRecvBufSegArray->Count();
   848     for( TInt index = 0; index < messagesInBuffer; ++index )
   841     for( TInt index = 0; index < messagesInBuffer; ++index )
   849         {
   842         {
   850         // Read message from the socket
   843         // Read message from the socket
   851         CSmsMessage*smsmessage=NULL;
   844         CSmsMessage*smsmessage=NULL;
   852         TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(index))));
   845         TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(index))));
   853         if( ret == KErrNone )
   846         if( ret == KErrNone )
   854             {
   847             {
   855             TRAP(ret, (iProtocol.iReassemblyStore->SetMessagePassedToClientL(*smsmessage, EFalse)));
   848             TRAP(ret, (iProtocol.iReassemblyStore->SetMessagePassedToClientL(*smsmessage, EFalse)));
   856             OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN_2, "-> CSmsProvider::Shutdown - SetMessagePassedToClientL [ret=%d]", ret);
   849             LOGSMSPROT2("-> CSmsProvider::Shutdown - SetMessagePassedToClientL [ret=%d]", ret);
   857             }
   850             }
   858         else
   851         else
   859             {
   852             {
   860             OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN_3, "-> CSmsProvider::Shutdown - CSmsProvider::InternalizeMessageL leave [ret=%d]", ret);
   853             LOGSMSPROT2("-> CSmsProvider::Shutdown - CSmsProvider::InternalizeMessageL leave [ret=%d]", ret);
   861             }
   854             }
   862         delete smsmessage;
   855         delete smsmessage;
   863         }
   856         }
   864     
   857     
   865     if( iEnumSocket && iProtocol.iPhoneEnumerationObserver == this )
   858     if( iEnumSocket && iProtocol.iPhoneEnumerationObserver == this )
   884  *  Implementation of the pure virtual CServProviderBase::Shutdown().
   877  *  Implementation of the pure virtual CServProviderBase::Shutdown().
   885  *  
   878  *  
   886  */
   879  */
   887 void CSmsProvider::Shutdown(TCloseType aOption, const TDesC8& /*aDisconnectionData*/)
   880 void CSmsProvider::Shutdown(TCloseType aOption, const TDesC8& /*aDisconnectionData*/)
   888 	{
   881 	{
   889 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN1_1, "CSmsProvider::Shutdown");
   882 	LOGSMSPROT1("CSmsProvider::Shutdown");
   890 	Shutdown(aOption);
   883 	Shutdown(aOption);
   891 	}
   884 	}
   892 
   885 
   893 /**
   886 /**
   894  *  Called by the socket server to indicate the provider should choose
   887  *  Called by the socket server to indicate the provider should choose
   899  */
   892  */
   900 void CSmsProvider::AutoBind()
   893 void CSmsProvider::AutoBind()
   901 	{
   894 	{
   902     // Ignore in code coverage - not intended to be used
   895     // Ignore in code coverage - not intended to be used
   903     BULLSEYE_OFF    
   896     BULLSEYE_OFF    
   904 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_AUTOBIND_1, "CSmsProvider::AutoBind [does nothing]");
   897 	LOGSMSPROT1("CSmsProvider::AutoBind [does nothing]");
   905     BULLSEYE_RESTORE
   898     BULLSEYE_RESTORE
   906 	}
   899 	}
   907 
   900 
   908 /**
   901 /**
   909  *  Called by the SMS protocol to obtain the local address of this SAP.
   902  *  Called by the SMS protocol to obtain the local address of this SAP.
   911  *  @return the local address of this SAP.
   904  *  @return the local address of this SAP.
   912  *  
   905  *  
   913  */
   906  */
   914 const TSmsAddr& CSmsProvider::GetLocalAddress() const
   907 const TSmsAddr& CSmsProvider::GetLocalAddress() const
   915 	{
   908 	{
   916 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_GETLOCALADDRESS_1, "CSmsProvider::GetLocalAddress");
   909 	LOGSMSPROT1("CSmsProvider::GetLocalAddress");
   917 	return iLocalAddress;
   910 	return iLocalAddress;
   918 	}
   911 	}
   919 
   912 
   920 /**
   913 /**
   921  *  Called by the SMS protocol to bind a local address to this SAP.
   914  *  Called by the SMS protocol to bind a local address to this SAP.
   922  *  
   915  *  
   923  */
   916  */
   924 void CSmsProvider::SetLocalAddress(const TSmsAddr& aSmsAddr)
   917 void CSmsProvider::SetLocalAddress(const TSmsAddr& aSmsAddr)
   925 	{
   918 	{
   926 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SETLOCALADDRESS_1, "CSmsProvider::SetLocalAddress");
   919 	LOGSMSPROT1("CSmsProvider::SetLocalAddress");
   927 	iLocalAddress = aSmsAddr;
   920 	iLocalAddress = aSmsAddr;
   928 	}
   921 	}
   929 
   922 
   930 /**
   923 /**
   931  *  Called by the protocol when the modem connection state has changed.
   924  *  Called by the protocol when the modem connection state has changed.
   934  *  @param aStatus either KIoctlSelectModemPresent or KIoctlSelectModemNotPresent.
   927  *  @param aStatus either KIoctlSelectModemPresent or KIoctlSelectModemNotPresent.
   935  *  
   928  *  
   936  */
   929  */
   937 void CSmsProvider::ModemNotificationCompleted(TInt aStatus)
   930 void CSmsProvider::ModemNotificationCompleted(TInt aStatus)
   938 	{
   931 	{
   939 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MODEMNOTIFICATIONCOMPLETED_1, "CSmsProvider::ModemNotificationCompleted [aStatus=%d]", aStatus);
   932 	LOGSMSPROT2("CSmsProvider::ModemNotificationCompleted [aStatus=%d]", aStatus);
   940 
   933 
   941 	if( !IoctlOutstanding() )
   934 	if( !IoctlOutstanding() )
   942 	    {
   935 	    {
   943 		iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
   936 		iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
   944 	    }
   937 	    }
   951  *  @param aStatus the result of the send.
   944  *  @param aStatus the result of the send.
   952  *  
   945  *  
   953  */
   946  */
   954 void CSmsProvider::MessageSendCompleted(TInt aStatus)
   947 void CSmsProvider::MessageSendCompleted(TInt aStatus)
   955     {
   948     {
   956     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGESENDCOMPLETED_1, "CSmsProvider::MessageSendCompleted [aStatus=%d]", aStatus);
   949     LOGSMSPROT2("CSmsProvider::MessageSendCompleted [aStatus=%d]", aStatus);
   957     
   950     
   958     iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
   951     iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
   959     SetIoctlOutstanding(EFalse);
   952     SetIoctlOutstanding(EFalse);
   960     }
   953     }
   961 
   954 
   966  *  @return KErrNone if the message was serialized to the receive buffer successfully.
   959  *  @return KErrNone if the message was serialized to the receive buffer successfully.
   967  *  
   960  *  
   968  */
   961  */
   969 TInt CSmsProvider::MessageReceived(const CSmsMessage& aSmsMessage,TDes& /*aDes*/)
   962 TInt CSmsProvider::MessageReceived(const CSmsMessage& aSmsMessage,TDes& /*aDes*/)
   970     {
   963     {
   971     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGERECEIVED_1, "CSmsProvider::MessageReceived");
   964     LOGSMSPROT1("CSmsProvider::MessageReceived");
   972     
   965     
   973     // Attempt to serial the message to the receive buffer & notify
   966     // Attempt to serial the message to the receive buffer & notify
   974     // the socket of the new data
   967     // the socket of the new data
   975     TInt numnewsegments=0;
   968     TInt numnewsegments=0;
   976     TRAPD(ret,(numnewsegments=ExternalizeMessageL(aSmsMessage,ETrue)));
   969     TRAPD(ret,(numnewsegments=ExternalizeMessageL(aSmsMessage,ETrue)));
   984 /**
   977 /**
   985  *  Informs protocol whether client confirms received message
   978  *  Informs protocol whether client confirms received message
   986  */
   979  */
   987 TBool CSmsProvider::ClientConfirmsMessage() const
   980 TBool CSmsProvider::ClientConfirmsMessage() const
   988     {
   981     {
   989     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CLIENTCONFIRMSMESSAGE_1, "CSmsProvider::ClientConfirmsMessage");
   982     LOGSMSPROT1("CSmsProvider::ClientConfirmsMessage");
   990     
   983     
   991     return ETrue;
   984     return ETrue;
   992     }
   985     }
   993 
   986 
   994 /**
   987 /**
   995  *  Informs protocol whether address is ued by the observer
   988  *  Informs protocol whether address is ued by the observer
   996  */
   989  */
   997 TInt CSmsProvider::SmsAddrIsDuplicate(const MSmsMessageObserver* aObserver, const TSmsAddr& aAddr) const
   990 TInt CSmsProvider::SmsAddrIsDuplicate(const MSmsMessageObserver* aObserver, const TSmsAddr& aAddr) const
   998     {
   991     {
   999     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SMSADDRISDUPLICATE_1, "CSmsProvider::SmsAddrIsDuplicate");
   992     LOGSMSPROT1("CSmsProvider::SmsAddrIsDuplicate");
  1000     
   993     
  1001     if( this == aObserver )
   994     if( this == aObserver )
  1002         {
   995         {
  1003         return EFalse;
   996         return EFalse;
  1004         }
   997         }
  1012  *  @param aStatus the result of the enumeration.
  1005  *  @param aStatus the result of the enumeration.
  1013  *  
  1006  *  
  1014  */
  1007  */
  1015 void CSmsProvider::EnumeratePhoneCompleted(TInt aStatus)
  1008 void CSmsProvider::EnumeratePhoneCompleted(TInt aStatus)
  1016     {
  1009     {
  1017     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_ENUMERATEPHONECOMPLETED_1, "CSmsProvider::EnumeratePhoneCompleted [aStatus=%d]", aStatus);
  1010     LOGSMSPROT2("CSmsProvider::EnumeratePhoneCompleted [aStatus=%d]", aStatus);
  1018     
  1011     
  1019     // Attempt to serialize all enumerated messages to the receive buffer
  1012     // Attempt to serialize all enumerated messages to the receive buffer
  1020     TInt numnewsegments=0;
  1013     TInt numnewsegments=0;
  1021     TInt count=0;
  1014     TInt count=0;
  1022     if( aStatus==KErrNone )
  1015     if( aStatus==KErrNone )
  1079  *  @param aStatus the result of the write operation.
  1072  *  @param aStatus the result of the write operation.
  1080  *  
  1073  *  
  1081  */
  1074  */
  1082 void CSmsProvider::MessageWriteCompleted(TInt aStatus, const CSmsMessage* aSmsMessage)
  1075 void CSmsProvider::MessageWriteCompleted(TInt aStatus, const CSmsMessage* aSmsMessage)
  1083 	{
  1076 	{
  1084 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGEWRITECOMPLETED_1, "CSmsProvider::MessageWriteCompleted [aStatus=%d]", aStatus);
  1077 	LOGSMSPROT2("CSmsProvider::MessageWriteCompleted [aStatus=%d]", aStatus);
  1085 
  1078 
  1086 	// If no errors at present populate the buffer
  1079 	// If no errors at present populate the buffer
  1087 	if( aStatus == KErrNone )
  1080 	if( aStatus == KErrNone )
  1088 	    {
  1081 	    {
  1089 		TRAP(aStatus, (PopulateBufferWithPDUSlotsL(*aSmsMessage)));
  1082 		TRAP(aStatus, (PopulateBufferWithPDUSlotsL(*aSmsMessage)));
  1102  *  @param aSmsMessage the message containing the slot information.
  1095  *  @param aSmsMessage the message containing the slot information.
  1103  *  
  1096  *  
  1104  */
  1097  */
  1105 void CSmsProvider::PopulateBufferWithPDUSlotsL(const CSmsMessage& aSmsMessage)
  1098 void CSmsProvider::PopulateBufferWithPDUSlotsL(const CSmsMessage& aSmsMessage)
  1106     {
  1099     {
  1107     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_POPULATEBUFFERWITHPDUSLOTSL_1, "CSmsProvider::PopulateBufferWithPDUSlotsL");
  1100     LOGSMSPROT1("CSmsProvider::PopulateBufferWithPDUSlotsL");
  1108     
  1101     
  1109     // Create buffer for store id and PDU slot indexes based on size of slot array
  1102     // Create buffer for store id and PDU slot indexes based on size of slot array
  1110     
  1103     
  1111     HBufC8* buf = HBufC8::NewL(aSmsMessage.iSlotArray.Count()+1 * sizeof(TUint));
  1104     HBufC8* buf = HBufC8::NewL(aSmsMessage.iSlotArray.Count()+1 * sizeof(TUint));
  1112     buf->Des().Append(aSmsMessage.Storage());
  1105     buf->Des().Append(aSmsMessage.Storage());
  1120     TPtr8 textBufPtr(buf->Des());
  1113     TPtr8 textBufPtr(buf->Des());
  1121     
  1114     
  1122     iSocket->IoctlComplete(&textBufPtr);
  1115     iSocket->IoctlComplete(&textBufPtr);
  1123     delete buf;
  1116     delete buf;
  1124 
  1117 
  1125     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_POPULATEBUFFERWITHPDUSLOTSL_2, "-> CSmsProvider::PopulateBufferWithPDUSlotsL - done");
  1118     LOGSMSPROT1("-> CSmsProvider::PopulateBufferWithPDUSlotsL - done");
  1126     }
  1119     }
  1127 
  1120 
  1128 /**
  1121 /**
  1129  *  Called by the protocol when a request to delete a message from
  1122  *  Called by the protocol when a request to delete a message from
  1130  *  a phone store by this SAP has completed.
  1123  *  a phone store by this SAP has completed.
  1133  *  @param aStatus the result of the deletion.
  1126  *  @param aStatus the result of the deletion.
  1134  *  
  1127  *  
  1135  */
  1128  */
  1136 void CSmsProvider::MessageDeleteCompleted(TInt aStatus)
  1129 void CSmsProvider::MessageDeleteCompleted(TInt aStatus)
  1137     {
  1130     {
  1138     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGEDELETECOMPLETED_1, "CSmsProvider::MessageDeleteCompleted [aStatus=%d]", aStatus);
  1131     LOGSMSPROT2("CSmsProvider::MessageDeleteCompleted [aStatus=%d]", aStatus);
  1139     iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
  1132     iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
  1140     SetIoctlOutstanding(EFalse);
  1133     SetIoctlOutstanding(EFalse);
  1141     }
  1134     }
  1142 
  1135 
  1143 /**
  1136 /**
  1148  *  @param aSmspList SMS parameter list
  1141  *  @param aSmspList SMS parameter list
  1149  *  
  1142  *  
  1150  */
  1143  */
  1151 void CSmsProvider::ReadSmsParamsCompleted(TInt aStatus, CMobilePhoneSmspList* aSmspList)
  1144 void CSmsProvider::ReadSmsParamsCompleted(TInt aStatus, CMobilePhoneSmspList* aSmspList)
  1152     {
  1145     {
  1153     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_READSMSPARAMSCOMPLETED_1, "CSmsProvider::ReadSmsParamsCompleted [aStatus=%d]", aStatus);
  1146     LOGSMSPROT2("CSmsProvider::ReadSmsParamsCompleted [aStatus=%d]", aStatus);
  1154     
  1147     
  1155     TInt numNewSegments=0;
  1148     TInt numNewSegments=0;
  1156     
  1149     
  1157     if( aStatus == KErrNone )
  1150     if( aStatus == KErrNone )
  1158         {
  1151         {
  1182  *  @param aStatus the result of the write operation.
  1175  *  @param aStatus the result of the write operation.
  1183  *  
  1176  *  
  1184  */
  1177  */
  1185 void CSmsProvider::WriteSmsParamsCompleted(TInt aStatus)
  1178 void CSmsProvider::WriteSmsParamsCompleted(TInt aStatus)
  1186     {
  1179     {
  1187     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_WRITESMSPARAMSCOMPLETED_1, "CSmsProvider::WriteSmsParamsCompleted [aStatus=%d]", aStatus);
  1180     LOGSMSPROT2("CSmsProvider::WriteSmsParamsCompleted [aStatus=%d]", aStatus);
  1188     iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
  1181     iSocket->Error(aStatus,MSocketNotify::EErrorIoctl);
  1189     SetIoctlOutstanding(EFalse);
  1182     SetIoctlOutstanding(EFalse);
  1190     }
  1183     }
  1191 
  1184 
  1192 /**
  1185 /**
  1197  *  @return the total number of segments the messages were split into.
  1190  *  @return the total number of segments the messages were split into.
  1198  *  
  1191  *  
  1199  */
  1192  */
  1200 TInt CSmsProvider::ExternalizeEnumeratedMessagesL(TInt& aCount)
  1193 TInt CSmsProvider::ExternalizeEnumeratedMessagesL(TInt& aCount)
  1201     {
  1194     {
  1202     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEENUMERATEDMESSAGESL_1, "CSmsProvider::ExternalizeEnumeratedMessagesL");
  1195     LOGSMSPROT1("CSmsProvider::ExternalizeEnumeratedMessagesL");
  1203     
  1196     
  1204     TInt numnewsegments(0);
  1197     TInt numnewsegments(0);
  1205     numnewsegments=iProtocol.ExternalizeEnumeratedMessagesL(*this,aCount);
  1198     numnewsegments=iProtocol.ExternalizeEnumeratedMessagesL(*this,aCount);
  1206     
  1199     
  1207     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEENUMERATEDMESSAGESL_2, "-> CSmsProvider::ExternalizeEnumeratedMessagesL - done");
  1200     LOGSMSPROT1("-> CSmsProvider::ExternalizeEnumeratedMessagesL - done");
  1208     
  1201     
  1209     return numnewsegments;
  1202     return numnewsegments;
  1210     }
  1203     }
  1211 
  1204 
  1212 /**
  1205 /**
  1220  *  @return the number of segments the message was split into.
  1213  *  @return the number of segments the message was split into.
  1221  *  
  1214  *  
  1222  */
  1215  */
  1223 TInt CSmsProvider::ExternalizeMessageL(const CSmsMessage& aSmsMessage,TBool aAppend)
  1216 TInt CSmsProvider::ExternalizeMessageL(const CSmsMessage& aSmsMessage,TBool aAppend)
  1224     {
  1217     {
  1225     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEMESSAGEL_1, "CSmsProvider::ExternalizeMessageL()");
  1218     LOGSMSPROT1("CSmsProvider::ExternalizeMessageL()");
  1226     
  1219     
  1227     // Create a new segmented buffer for the serialization of this message
  1220     // Create a new segmented buffer for the serialization of this message
  1228     CBufSeg* recvbufseg = CBufSeg::NewL(KSmsMaxSegmentLength);
  1221     CBufSeg* recvbufseg = CBufSeg::NewL(KSmsMaxSegmentLength);
  1229     CleanupStack::PushL(recvbufseg);
  1222     CleanupStack::PushL(recvbufseg);
  1230     
  1223     
  1244         iRecvBufSegArray->InsertL(0,recvbufseg);
  1237         iRecvBufSegArray->InsertL(0,recvbufseg);
  1245         }
  1238         }
  1246     CleanupStack::PopAndDestroy();  //  writestream
  1239     CleanupStack::PopAndDestroy();  //  writestream
  1247     CleanupStack::Pop();            //  recvbufseg
  1240     CleanupStack::Pop();            //  recvbufseg
  1248     
  1241     
  1249     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEMESSAGEL_2, "-> CSmsProvider::ExternalizeMessageL - done");
  1242     LOGSMSPROT1("-> CSmsProvider::ExternalizeMessageL - done");
  1250     
  1243     
  1251     return NumSegments(recvbufseg->Size());
  1244     return NumSegments(recvbufseg->Size());
  1252     }
  1245     }
  1253 
  1246 
  1254 /**
  1247 /**
  1260  *  @return the de-serialized CSmsMessage object.
  1253  *  @return the de-serialized CSmsMessage object.
  1261  *  
  1254  *  
  1262  */
  1255  */
  1263 CSmsMessage* CSmsProvider::InternalizeMessageL()
  1256 CSmsMessage* CSmsProvider::InternalizeMessageL()
  1264     {
  1257     {
  1265     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEMESSAGEL_1, "CSmsProvider::InternalizeMessageL()");
  1258     LOGSMSPROT1("CSmsProvider::InternalizeMessageL()");
  1266     
  1259     
  1267     // Initialize the read stream with the buffer
  1260     // Initialize the read stream with the buffer
  1268     RBufReadStream readstream(*iSendBufSeg);
  1261     RBufReadStream readstream(*iSendBufSeg);
  1269     readstream.Open(*iSendBufSeg,0);
  1262     readstream.Open(*iSendBufSeg,0);
  1270     CleanupClosePushL(readstream);
  1263     CleanupClosePushL(readstream);
  1279 
  1272 
  1280     CleanupStack::Pop();  //  smsmessage
  1273     CleanupStack::Pop();  //  smsmessage
  1281     CleanupStack::PopAndDestroy();  //  readstream
  1274     CleanupStack::PopAndDestroy();  //  readstream
  1282     iSendBufSeg->Reset();
  1275     iSendBufSeg->Reset();
  1283 
  1276 
  1284     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEMESSAGEL_2, "-> CSmsProvider::InternalizeMessageL - done");
  1277     LOGSMSPROT1("-> CSmsProvider::InternalizeMessageL - done");
  1285     
  1278     
  1286     return smsmessage;
  1279     return smsmessage;
  1287     }
  1280     }
  1288 
  1281 
  1289 /**
  1282 /**
  1296  *  @return the number of segments the parameters was split into.
  1289  *  @return the number of segments the parameters was split into.
  1297  *  
  1290  *  
  1298  */
  1291  */
  1299 TInt CSmsProvider::ExternalizeParametersL(const CMobilePhoneSmspList& aMobilePhoneSmspList)
  1292 TInt CSmsProvider::ExternalizeParametersL(const CMobilePhoneSmspList& aMobilePhoneSmspList)
  1300     {
  1293     {
  1301     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEPARAMETERSL_1, "CSmsProvider::ExternalizeParametersL");
  1294     LOGSMSPROT1("CSmsProvider::ExternalizeParametersL");
  1302     
  1295     
  1303     // Create a new segmented buffer for the serialization of this message
  1296     // Create a new segmented buffer for the serialization of this message
  1304     CBufSeg* recvBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength);
  1297     CBufSeg* recvBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength);
  1305     CleanupStack::PushL(recvBufSeg);
  1298     CleanupStack::PushL(recvBufSeg);
  1306 
  1299 
  1314     // Append start of the other serialized message buffers
  1307     // Append start of the other serialized message buffers
  1315     CleanupStack::PopAndDestroy();	//writeStream
  1308     CleanupStack::PopAndDestroy();	//writeStream
  1316     iRecvBufSegArray->InsertL(0,recvBufSeg);
  1309     iRecvBufSegArray->InsertL(0,recvBufSeg);
  1317     CleanupStack::Pop(recvBufSeg);
  1310     CleanupStack::Pop(recvBufSeg);
  1318 
  1311 
  1319     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEPARAMETERSL_2, "-> CSmsProvider::ExternalizeParametersL - done");
  1312     LOGSMSPROT1("-> CSmsProvider::ExternalizeParametersL - done");
  1320     
  1313     
  1321     return NumSegments(recvBufSeg->Size());
  1314     return NumSegments(recvBufSeg->Size());
  1322     }
  1315     }
  1323 
  1316 
  1324 /**
  1317 /**
  1330  *  @return the retrieved CMobilePhoneSmspList object.
  1323  *  @return the retrieved CMobilePhoneSmspList object.
  1331  *  
  1324  *  
  1332  */
  1325  */
  1333 CMobilePhoneSmspList* CSmsProvider::InternalizeParametersL()
  1326 CMobilePhoneSmspList* CSmsProvider::InternalizeParametersL()
  1334     {
  1327     {
  1335     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEPARAMETERSL_1, "CSmsProvider::InternalizeParametersL");
  1328     LOGSMSPROT1("CSmsProvider::InternalizeParametersL");
  1336     
  1329     
  1337     // Initialize the read stream with the buffer
  1330     // Initialize the read stream with the buffer
  1338     RBufReadStream readStream(*iSendBufSeg);
  1331     RBufReadStream readStream(*iSendBufSeg);
  1339     readStream.Open(*iSendBufSeg,0);
  1332     readStream.Open(*iSendBufSeg,0);
  1340     CleanupClosePushL(readStream);
  1333     CleanupClosePushL(readStream);
  1348 
  1341 
  1349     CleanupStack::Pop(mobilePhoneSmspList);
  1342     CleanupStack::Pop(mobilePhoneSmspList);
  1350     CleanupStack::PopAndDestroy();	//readStream
  1343     CleanupStack::PopAndDestroy();	//readStream
  1351     iSendBufSeg->Reset();
  1344     iSendBufSeg->Reset();
  1352 
  1345 
  1353     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEPARAMETERSL_2, "-> CSmsProvider::InternalizeParametersL - done");
  1346     LOGSMSPROT1("-> CSmsProvider::InternalizeParametersL - done");
  1354     
  1347     
  1355     return mobilePhoneSmspList;
  1348     return mobilePhoneSmspList;
  1356     }
  1349     }
  1357 
  1350 
  1358 CSmsMessage* CSmsProvider::InternalizeMessageL(	CBufSeg* aBufSeg)
  1351 CSmsMessage* CSmsProvider::InternalizeMessageL(	CBufSeg* aBufSeg)
  1359     {
  1352     {
  1360     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEMESSAGEL1_1, "CSmsProvider::InternalizeMessageL");
  1353     LOGSMSPROT1("CSmsProvider::InternalizeMessageL");
  1361     
  1354     
  1362     RBufReadStream readstream(*aBufSeg);
  1355     RBufReadStream readstream(*aBufSeg);
  1363     readstream.Open(*aBufSeg,0);
  1356     readstream.Open(*aBufSeg,0);
  1364     CleanupClosePushL(readstream);
  1357     CleanupClosePushL(readstream);
  1365     CSmsBufferBase* buffer = CSmsBuffer::NewL();
  1358     CSmsBufferBase* buffer = CSmsBuffer::NewL();
  1369     readstream >> *smsmessage;
  1362     readstream >> *smsmessage;
  1370     
  1363     
  1371     CleanupStack::Pop();  //  smsmessage
  1364     CleanupStack::Pop();  //  smsmessage
  1372     CleanupStack::PopAndDestroy();  //  readsream
  1365     CleanupStack::PopAndDestroy();  //  readsream
  1373     
  1366     
  1374     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEMESSAGEL1_2, "-> CSmsProvider::InternalizeMessageL - done");
  1367     LOGSMSPROT1("-> CSmsProvider::InternalizeMessageL - done");
  1375     
  1368     
  1376     return smsmessage;
  1369     return smsmessage;
  1377     }
  1370     }
  1378 
  1371 
  1379 TInt CSmsProvider::SecurityCheck(MProvdSecurityChecker* aSecurityChecker)
  1372 TInt CSmsProvider::SecurityCheck(MProvdSecurityChecker* aSecurityChecker)
  1380     {
  1373     {
  1381     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SECURITYCHECK_1, "CSmsProvider::SecurityCheck");
  1374     LOGSMSPROT1("CSmsProvider::SecurityCheck");
  1382     iSecurityChecker = aSecurityChecker;
  1375     iSecurityChecker = aSecurityChecker;
  1383     return KErrNone;
  1376     return KErrNone;
  1384     }
  1377     }