servicediscoveryandcontrol/pnp/test/upnp/unittests/tcpserver/inc/ctcpservertestcase.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 CTCPSERVERTESTCASE_H_
       
    20 #define CTCPSERVERTESTCASE_H_
       
    21 
       
    22 //----------------------------------------------------------//
       
    23 /////////////////// CTcpServerTestCase /////////////////////////
       
    24 //////Testcase: Send the test data from the test client/////////
       
    25 //----------------------------------------------------------//
       
    26 const TUint16 KActivityNull = 0;
       
    27 
       
    28 NONSHARABLE_CLASS(CTcpServerTestCase) : public CTcpServerTestBase,
       
    29 										public Messages::ASimpleNodeIdBase,
       
    30 										public MSocketHandlerObserver										
       
    31 	{
       
    32 public:
       
    33 	//static CTcpServerTestCase* NewL ( CProxyProvd* aProvd );
       
    34 	virtual ~CTcpServerTestCase ();
       
    35 	
       
    36 	virtual void ReceivedL ( const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage );
       
    37 	
       
    38 	// From MSocketHandlerObserver
       
    39 	virtual void OpenComplete ( RInternalSocket& aSocket );
       
    40 	virtual void ConnectComplete ();
       
    41 	virtual void AcceptComplete ( RInternalSocket& /*aSocket*/ ) 
       
    42 	{	}
       
    43 	virtual void SendComplete ( TInt aLength );	
       
    44 	virtual void SendToComplete ( TInt /*aLength*/ )
       
    45 	{	}
       
    46 	virtual void RecvComplete ( RMBufChain& /*aData*/ )
       
    47 	{	}
       
    48 	virtual void RecvFromComplete ( RMBufChain& /*aData*/, const TSockAddr& /*aAddr*/ )
       
    49 	{	}
       
    50 	virtual void IoctlComplete ()
       
    51 	{	}
       
    52 	virtual void Error ( TOperation /*aOperation*/, TInt /*aError*/ )
       
    53 	{	}
       
    54 	
       
    55 protected:
       
    56 	enum TState
       
    57 		{
       
    58 		ECreateServer = 0,
       
    59 		EStartServer,
       
    60 		EOpenClientSocketAndConnect,
       
    61 		ESendData,
       
    62 		ESendStopServer,
       
    63 		EServerStopped,		
       
    64 		ECleanup,		
       
    65 		EStartTimer,
       
    66 		ETimerStopped,
       
    67 		};
       
    68 		
       
    69 	CTcpServerTestCase ( CProxyProvd* aProvd );
       
    70 	void ConstructL (const TDesC8& aDes);
       
    71 	virtual TVerdict RunTestL ();
       
    72 	
       
    73 	
       
    74 	Messages::TNodeId 	iTcpServer;
       
    75 	RBuf8				iServiceUri;
       
    76 	
       
    77 	RInternalSocket		iClientSocket;
       
    78 	RSocketHandler		iSocketHandler;
       
    79 	CSocketOpener*		iSocketOpener;
       
    80 	
       
    81 	RMBufChain			iSendChain;
       
    82 	TInetAddr			iHostAddr;
       
    83 	TVerdict			iResponse;
       
    84 	
       
    85 	RTimer				iTimer;
       
    86 	TState				iState;
       
    87 	};
       
    88 
       
    89 
       
    90 
       
    91 #endif /*CTCPSERVERTESTCASE_H_*/