natfw/natfwunsaf_protocols/unsaf_transport/src/tnatfwunsafmsgstateheaderend.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "tnatfwunsafmsgstateheaderend.h"
       
    22 #include "mnatfwunsafmsgassemblerctx.h"
       
    23 #include "natfwunsafmessagefactory.h"
       
    24 
       
    25 // ----------------------------------------------------------------------------
       
    26 // TNATFWUNSAFMsgStateHeaderEnd::DataReceivedL
       
    27 // ----------------------------------------------------------------------------
       
    28 //
       
    29 TBool TNATFWUNSAFMsgStateHeaderEnd::DataReceivedL( TPtr8 aData,
       
    30     TUint& aNextLength )
       
    31     {
       
    32     __ASSERT_ALWAYS( aData.Length() >= iMsgAssembler.MessageLength(),
       
    33                      User::Leave( KErrUnderflow ) );
       
    34 
       
    35     TPtrC8 headerDescriptor = aData.Left( iMsgAssembler.MessageLength() );
       
    36 
       
    37     CNATFWUNSAFMessage* message =
       
    38         iMsgAssembler.MsgFactory().DecodeL( headerDescriptor );
       
    39 
       
    40     iMsgAssembler.SetMessage( message );
       
    41     message = 0;
       
    42 
       
    43     // delete the header part from the received data,
       
    44     aData.Delete( 0, iMsgAssembler.MessageLength() );
       
    45 
       
    46     iMsgAssembler.ChangeState( TNATFWUNSAFMsgStateBase::EMsgComplete );
       
    47     return iMsgAssembler.CurrentState().DataReceivedL( aData, aNextLength );
       
    48     }
       
    49 
       
    50 // End of File
       
    51