servicediscoveryandcontrol/pnp/test/upnp/unittests/tcpclient/inc/proxyprotocol.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 #if !defined(__PROXYPROTOCOL_H)
       
    20 #define __PROXYPROTOCOL_H
       
    21 
       
    22 #include "es_ptest.h"
       
    23 #include <es_prot.h>
       
    24 #include <comms-infras/nifif.h>
       
    25 #include <dns_qry.h>
       
    26 
       
    27 enum TDPanic
       
    28 	{
       
    29 	EBadProtocol = 1000,
       
    30 	EBadCall = 1001,
       
    31 	ENotBound = 1002,
       
    32 	ENotStarted = 1003,
       
    33 	EInterfaceNotDeleted = 1004,
       
    34 	EIdAndNoHolder = 1005,
       
    35 	EIfAndHolder = 1006,
       
    36 	ETestPanic = 1007
       
    37 	};
       
    38 	
       
    39 void Panic(TDPanic aPanic);
       
    40 
       
    41 
       
    42 NONSHARABLE_CLASS(CProxyProtocol): public CProtocolBase
       
    43 	{
       
    44 public:
       
    45 
       
    46 	~CProxyProtocol();
       
    47 	
       
    48 	static CProxyProtocol *NewL(TInt aProtocol, TServerProtocolDesc* aProtoDesc);
       
    49 	CServProviderBase *NewSAPL(TUint aProtocol);
       
    50 	TBool CanCreateSockets();
       
    51 	void InitL(TDesC& aTag);
       
    52 	void BindL(CProtocolBase *aProtocol, TUint anId);
       
    53 	virtual void BindToL(CProtocolBase *protocol);
       
    54 	void StartL(void);
       
    55 	TInt Send(RMBufChain &,CProtocolBase* aSourceProtocol);
       
    56 	void Process(RMBufChain &,CProtocolBase* aSourceProtocol);
       
    57 	TInt Send(TDes8 &, TSockAddr *to,TSockAddr *from,CProtocolBase* aSourceProtocol);
       
    58 	void Process(TDes8 & ,TSockAddr *from,TSockAddr *to,CProtocolBase* aSourceProtocol);
       
    59 	void Identify(TServerProtocolDesc *)const;
       
    60 	TInt GetOption(TUint level,TUint name,TDes8 &anOption,CProtocolBase* aSourceProtocol);
       
    61 	TInt SetOption(TUint level,TUint name,const TDesC8& option,CProtocolBase* aSourceProtocol);
       
    62 	void Error(TInt anError,CProtocolBase* aSourceProtocol);
       
    63 	TBool IsStarted(){return iStarted;}
       
    64 private:
       
    65 	CProxyProtocol(TServerProtocolDesc* aProtoDesc);
       
    66 	
       
    67 private:
       
    68 	TInt iType;
       
    69 	TServerProtocolDesc* iProtoDesc;
       
    70 	TBool iStarted;
       
    71 	CArrayFixFlat<CProtocolBase *> iProtocols;
       
    72 	};
       
    73 
       
    74 NONSHARABLE_CLASS(CProxyProvd) : public CServProviderBase
       
    75 	{
       
    76 public:
       
    77 	static CProxyProvd *NewL(CProxyProtocol &aProtocol);
       
    78 	virtual void Ioctl(TUint level,TUint name,TDes8 *anOption);
       
    79 	void TestComplete(TProxyProtocolTestResult result);
       
    80 	
       
    81 	void LocalName(TSockAddr &anAddr)const;
       
    82 	virtual TInt SetLocalName(TSockAddr &anAddr);
       
    83 	virtual void RemName(TSockAddr &anAddr)const;
       
    84 	virtual TInt SetRemName(TSockAddr &anAddr);
       
    85 	virtual TInt GetOption(TUint level,TUint name,TDes8 &anOption)const;
       
    86 	virtual TInt SetOption(TUint level,TUint name,const TDesC8 &anOption);
       
    87 	
       
    88 	virtual void CancelIoctl(TUint aLevel,TUint aName);
       
    89 	virtual TInt Write(RMBufChain& aData, TUint options, TSockAddr* anAddr=NULL);
       
    90 	virtual TUint Write(const TDesC8& aDesc, TUint options, TSockAddr* anAddr);
       
    91 	virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint options,TSockAddr* anAddr=NULL);
       
    92 	virtual void GetData(TDes8& aDesc,TUint options,TSockAddr* anAddr=NULL);
       
    93 	virtual void ActiveOpen(void);
       
    94 	virtual void ActiveOpen(const TDesC8 &aConnectionData);
       
    95 	virtual TInt PassiveOpen(TUint aQue);
       
    96 	virtual TInt PassiveOpen(TUint aQue,const TDesC8 &aConnectionData);
       
    97 	virtual void AutoBind( void );
       
    98 	virtual void Shutdown(TCloseType option);
       
    99 	virtual void Shutdown(TCloseType option,const TDesC8 &aDisconnectData);
       
   100 	virtual void Start();
       
   101 
       
   102 private:
       
   103 	CProxyProvd(CProxyProtocol &aProtocol);
       
   104 	
       
   105 private:
       
   106 	TBool iIsBound;
       
   107 	CProxyProtocol *iProtocol;
       
   108 	TSockAddr iAddr;
       
   109 	TBool iInputStopped;
       
   110 	TInt iListenErrorCode;
       
   111 	TBool iCancelIoctl; // Set when an IOCTL has been cancelled.
       
   112 	
       
   113 	TBool iBlockOnClose; //Used by and test Ioctl to cause the socket to hang on close
       
   114 	TBool iCompleteIoctl;
       
   115 	};
       
   116 
       
   117 #endif //__PROXYPROTOCOL_H