realtimenetprots/sipfw/SIP/ConnectionMgr/src/TTCPMsgInit.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name        : TTCPMsgInit.cpp
       
    15 // Part of     : ConnectionMgr
       
    16 // Implementation
       
    17 // Version     : SIP/4.0
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 #include "TTCPMsgInit.h"
       
    23 #include "MMsgAssemblerContext.h"
       
    24 #include "MSigCompController.h"
       
    25 
       
    26 
       
    27 // ----------------------------------------------------------------------------
       
    28 // TTCPMsgInit::DataReceivedL
       
    29 // ----------------------------------------------------------------------------
       
    30 //
       
    31 void TTCPMsgInit::DataReceivedL( TPtr8 aData, TUint&  aNextLength )
       
    32 	{
       
    33 	iMsgAssembler.SetUnConsumedBytes( 0 );
       
    34 	
       
    35 	// check first if the data received is compressed. 
       
    36 	// if so, enter to state TTCPCompMsgStart state.
       
    37 	if ( iMsgAssembler.SigComp().IsSupported() &&
       
    38 	     iMsgAssembler.SigComp().IsSigCompMsg( aData ) )
       
    39 		{
       
    40 		iMsgAssembler.SetIsSigComp( ETrue );
       
    41 		iMsgAssembler.ChangeState( MMsgAssemblerContext::ECompMsgStart );
       
    42 		iMsgAssembler.CurrentState().DataReceivedL( aData , aNextLength );
       
    43 		}
       
    44 	else // received data is not compressed
       
    45 		{
       
    46 		iMsgAssembler.SetIsSigComp( EFalse );
       
    47 		TInt startPos = FindHeaderStartPosition( aData );
       
    48 		
       
    49 		// if header not start from position 0
       
    50 		// delete extra characters so that header start from pos 0.
       
    51 		if ( startPos > 0 ) 
       
    52 			{
       
    53 			aData.Delete(0, startPos );
       
    54 			}
       
    55 			
       
    56 		// if the header start position is found
       
    57 		if ( startPos > KErrNotFound )
       
    58 			{
       
    59 			// enter into next state EMsgHeaderStart. 
       
    60 			iMsgAssembler.ChangeState( MMsgAssemblerContext::EMsgHeaderStart );
       
    61 			iMsgAssembler.CurrentState().DataReceivedL( aData , aNextLength );
       
    62 			}
       
    63 		}
       
    64 	}