|
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 : TTCPCompMsgStart.cpp |
|
15 // Part of : ConnectionMgr |
|
16 // Implementation |
|
17 // Version : SIP/4.0 |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 #include "TTCPCompMsgStart.h" |
|
23 #include "MMsgAssemblerContext.h" |
|
24 #include "MSigCompController.h" |
|
25 #include "SipAssert.h" |
|
26 |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // TTCPCompMsgStart::DataReceivedL |
|
30 // ---------------------------------------------------------------------------- |
|
31 // |
|
32 void TTCPCompMsgStart::DataReceivedL( TPtr8 aData, TUint& aNextLength ) |
|
33 { |
|
34 // panic if sigcomp is not supported in debug mode.leaves in release mode. |
|
35 __SIP_ASSERT_LEAVE( iMsgAssembler.SigComp().IsSupported(), KErrGeneral ); |
|
36 |
|
37 if ( iMsgAssembler.MsgBuffer().Size() > 0 ) |
|
38 { |
|
39 // insert the received data to msg buffer. |
|
40 iMsgAssembler.MsgBuffer().InsertL( |
|
41 iMsgAssembler.MsgBuffer().Size(), aData ); |
|
42 iMsgAssembler.MsgBuffer().Compress(); |
|
43 // clean the content of received data. |
|
44 aData.Delete( 0, aData.Length() ); |
|
45 TPtr8 bufPtr = iMsgAssembler.MsgBuffer().Ptr( 0 ); |
|
46 |
|
47 // check if the msg buffer a complete sig comp message, if so |
|
48 // copy the msg buffer to a new data buf, clean the msg buffer |
|
49 // and enter to comp msg end state. |
|
50 if ( iMsgAssembler.SigComp().IsCompleteSigCompMessageL( bufPtr ) ) |
|
51 { |
|
52 HBufC8* newData = HBufC8::NewLC( bufPtr.Length() ); |
|
53 // copy the msg buffer data and the received data to new buffer |
|
54 TPtr8 newDataPtr = newData->Des(); |
|
55 newDataPtr.Append(bufPtr); |
|
56 // clean the msg buffer |
|
57 iMsgAssembler.MsgBuffer().Reset(); |
|
58 iMsgAssembler.MsgBuffer().Compress(); |
|
59 |
|
60 iMsgAssembler.ChangeState( MMsgAssemblerContext::ECompMsgEnd ); |
|
61 iMsgAssembler.CurrentState().DataReceivedL( newDataPtr, |
|
62 aNextLength ); |
|
63 CleanupStack::PopAndDestroy(newData); |
|
64 } |
|
65 } |
|
66 else if (iMsgAssembler.SigComp().IsCompleteSigCompMessageL( aData ) ) |
|
67 { |
|
68 iMsgAssembler.ChangeState( MMsgAssemblerContext::ECompMsgEnd ); |
|
69 iMsgAssembler.CurrentState().DataReceivedL( aData, aNextLength ); |
|
70 } |
|
71 else |
|
72 { |
|
73 iMsgAssembler.MsgBuffer().InsertL( |
|
74 iMsgAssembler.MsgBuffer().Size(), aData ); |
|
75 iMsgAssembler.MsgBuffer().Compress(); |
|
76 } |
|
77 } |