servicediscoveryandcontrol/pnp/test/upnp/unittests/tcpclient/inc/ctestserversockethandler.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /*
       
     2 * Copyright (c) 2008 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 #ifndef __CTESTSERVERSOCKETHANDLER_H__
       
    20 #define __CTESTSERVERSOCKETHANDLER_H__
       
    21 
       
    22 #include <rsockethandler.h>
       
    23 #include <es_mbuf.h>
       
    24 #include <comms-infras/mbufchain.h>
       
    25 #include <testexecutestepbase.h>
       
    26 
       
    27 class MTcpClientTestCase;
       
    28 
       
    29 class CTestServerSocketHandler: public CTimer,
       
    30 								public MSocketHandlerObserver
       
    31 	{
       
    32 public:
       
    33 	static CTestServerSocketHandler* NewL ( MTcpClientTestCase* aTestCase, RInternalSocket& aIncomingConnection, CTestExecuteLogger& aLogger );
       
    34 	virtual ~CTestServerSocketHandler ();
       
    35 
       
    36 private:
       
    37 	CTestServerSocketHandler ( MTcpClientTestCase* aTestCase, RInternalSocket& aIncomingConnection, CTestExecuteLogger&	aLogger );
       
    38 	void ConstructL ();
       
    39 	TBool ProcessRequestL ();
       
    40 	TBool IsConnectionCloseInData ( const TDesC8& aRequest, const TDesC8& aResponse ) const;
       
    41 	TBool Is100ContinueInRequestData ( const TDesC8& aRequest ) const;
       
    42 	void SendDataL ();
       
    43 	
       
    44 	// From MSocketHandlerObserver
       
    45 	void OpenComplete ( RInternalSocket& /*Socket*/ )
       
    46 	{	}
       
    47 	void ConnectComplete () 
       
    48 	{	}
       
    49 	void AcceptComplete ( RInternalSocket& /*aSocket*/ )
       
    50 	{	}
       
    51 	void SendComplete ( TInt aLength );	
       
    52 	void SendToComplete ( TInt /*aLength*/ )
       
    53 	{	}
       
    54 	void RecvComplete ( RMBufChain& aData );
       
    55 	void RecvFromComplete ( RMBufChain& /*aData*/, const TSockAddr& /*aAddr*/ )
       
    56 	{	}
       
    57 	void IoctlComplete ()
       
    58 	{	}
       
    59 	void Error ( TOperation /*aOperation*/, TInt /*aError*/ )
       
    60 	{	}
       
    61 		
       
    62 	// From CTimer
       
    63 	void RunL ();
       
    64 	
       
    65 private:
       
    66 	RInternalSocket 		iIncomingConnection;
       
    67 	RSocketHandler			iSocketHandler;
       
    68 	HBufC8*					iDataStore;
       
    69 	HBufC8*					iDataToSend;
       
    70 	RMBufChain				iSendChain;
       
    71 	MTcpClientTestCase*		iTestCase;		// Not owned
       
    72 	TInt					iTransCount;
       
    73 	TInt					iCurrentTrans;
       
    74 	TInt					iDataPos;
       
    75 	TBool					iCloseConnection;
       
    76 	TBool					iPost;
       
    77 	TBool					iSend100Continue;
       
    78 	CTestExecuteLogger&		iLogger;
       
    79 	};
       
    80 
       
    81 #endif // __CTESTSERVERSOCKETHANDLER_H__