datacommsserver/esockserver/test/providers/dummy/inc/dummypr_flow.h
branchRCL_3
changeset 18 9644881fedd0
equal deleted inserted replaced
17:9ddb1d67ebaf 18:9644881fedd0
       
     1 // Copyright (c) 2008-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 // Dummy network flow
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #if !defined(__DUMMYPR_FLOW_H__)
       
    24 #define __DUMMYPR_FLOW_H__
       
    25 
       
    26 #include "dummypr_factory.h"
       
    27 #include <comms-infras/ss_protflow.h>
       
    28 #include <comms-infras/ss_subconnflow.h>
       
    29 #include <comms-infras/es_sap.h>
       
    30 #include <comms-infras/nifif.h>
       
    31 
       
    32 #include <comms-infras/ss_nodemessages_dataclient.h>
       
    33 #include <comms-infras/ss_nodemessages_flow.h>
       
    34 
       
    35 
       
    36 namespace ESock
       
    37 {
       
    38 
       
    39 
       
    40 class CDummyFlow : public CSubConnectionFlowBase,
       
    41 	public MSessionData,
       
    42 	public MSessionControl,
       
    43 	public MFlowBinderControl,
       
    44 	public MSessionControlNotify,
       
    45 	public MSessionDataNotify
       
    46 /**
       
    47 @internalComponent
       
    48 @released since v9.6
       
    49  */
       
    50 	{
       
    51 public:
       
    52     enum {EProtocolId = 254};
       
    53     typedef CDummyFlowFactory FactoryType; //for factoryobject_cast to work
       
    54 
       
    55 	static CDummyFlow* NewL(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
       
    56 	void SetSSP(CServProviderBase& aSSP);
       
    57 
       
    58 	inline CServProviderBase* Provider();
       
    59 
       
    60 protected:
       
    61 	// Lifetime
       
    62 	CDummyFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
       
    63 	virtual ~CDummyFlow();
       
    64 	void SetSockType(TUint aSockType);
       
    65 	TInt LockToConnectionInfo();
       
    66 
       
    67 	// MSessionData
       
    68 	virtual TUint Write(const TDesC8& aDesc,TUint aOptions, TSockAddr* anAddr);
       
    69 	virtual TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr);
       
    70 	virtual void GetData(TDes8& aDesc, TUint aOptions, TSockAddr* anAddr);
       
    71 	virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr);
       
    72 
       
    73 	// MSessionControl
       
    74 	virtual void Start();
       
    75 	virtual void LocalName(TSockAddr& anAddr) const;
       
    76 	virtual void SetLocalName(TSockAddr& anAddr);
       
    77 	virtual void RemName(TSockAddr& anAddr) const;
       
    78 	virtual TInt SetRemName(TSockAddr& anAddr);
       
    79 	virtual TInt GetOption(TUint aLevel,TUint aName,TDes8& anOption) const;
       
    80 	virtual void Ioctl(TUint aLevel,TUint aName,TDes8* anOption);
       
    81 	virtual void CancelIoctl(TUint aLevel,TUint aName);
       
    82 	virtual TInt SetOption(TUint aLevel, TUint aName,const TDesC8 &anOption);
       
    83 	virtual void ActiveOpen();
       
    84 	virtual void ActiveOpen(const TDesC8& aConnectionData);
       
    85 	virtual TInt PassiveOpen(TUint aQueueSize);
       
    86 	virtual TInt PassiveOpen(TUint aQueueSize,const TDesC8& aConnectionData);
       
    87 	virtual void Shutdown(MSessionControl::TCloseType aOption);
       
    88 	virtual void Shutdown(MSessionControl::TCloseType aOption, const TDesC8& aDisconnectionData);
       
    89 	virtual void AutoBind();
       
    90 	virtual TInt SecurityCheck(MProvdSecurityChecker* aSecurityChecker);
       
    91 
       
    92     // MFlowBinderControl
       
    93     //session binders for CSocket
       
    94     virtual MSessionControl* GetControlL(TInt aSessionType,MSessionControlNotify& aSessionControlNotify);
       
    95     virtual MSessionData* BindL(MSessionDataNotify& aNotify);
       
    96     virtual void Unbind();
       
    97     virtual CSubConnectionFlowBase& CloneFlowL();
       
    98 	virtual CSubConnectionFlowBase* Flow();
       
    99 
       
   100 private:
       
   101 	// MSessionControlNotify
       
   102     void ConnectComplete();
       
   103 	void ConnectComplete(const TDesC8& aConnectData);
       
   104     void ConnectComplete(CSubConnectionFlowBase& anSSP);
       
   105 	void ConnectComplete(CSubConnectionFlowBase& anSSP,const TDesC8& aConnectData);
       
   106 	void CanClose(MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
       
   107     void CanClose(const TDesC8& aDisconnectData,MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
       
   108 	TInt Error(TInt anError,TUint anOperationMask);
       
   109 	void Disconnect( );
       
   110 	void Disconnect(TDesC8& aDisconnectData);
       
   111 	void IoctlComplete(TDesC8* aBuf);
       
   112 	void DisconnectFromListener(CSubConnectionFlowBase& aSSP);
       
   113 	void SetLocalNameComplete();
       
   114 
       
   115 
       
   116 	// MSessionDataNotify
       
   117 	void NewData(TUint aCount);
       
   118 	void CanSend();
       
   119 
       
   120 protected:
       
   121 	// CSubConnectionFlowBase
       
   122 	virtual MFlowBinderControl* DoGetBinderControlL();
       
   123 
       
   124 	// Messages::ANode
       
   125 	virtual void ReceivedL(
       
   126 		const Messages::TRuntimeCtxId& aSender,
       
   127 		const Messages::TNodeId& aRecipient,
       
   128 		Messages::TSignatureBase& aMessage
       
   129 		);
       
   130 
       
   131 	void BindToL(TCFDataClient::TBindTo& aBindTo);
       
   132 
       
   133 
       
   134 private:
       
   135 	// Flow binders
       
   136 	MFlowBinderControl* iLowerFlowBinderControl;
       
   137 
       
   138 	// Lower session binding
       
   139 	MSessionControl* iLowerFlowControl;
       
   140 	MSessionData* iLowerFlowData;
       
   141 
       
   142 	// Upper session binding
       
   143 	MSessionControlNotify* iSessionControlNotify;
       
   144 	MSessionDataNotify* iSessionDataNotify;
       
   145 
       
   146 	RCFParameterFamilyBundleC iParamBundle;
       
   147 	};
       
   148 
       
   149 }
       
   150 
       
   151 
       
   152 #endif	// __DUMMYPR_FLOW_H__
       
   153