datacommsserver/esockserver/inc/es_sap.h
changeset 0 dfb7c4ff071f
child 9 77effd21b2c9
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 1997-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology
       
    19  @released
       
    20 */
       
    21 
       
    22 #if !defined(__ES_SAP_H__)
       
    23 #define __ES_SAP_H__
       
    24 
       
    25 #define SYMBIAN_NETWORKING_UPS
       
    26 
       
    27 #include <es_prot.h>
       
    28 #include <es_sock.h>
       
    29 #include <comms-infras/ss_subconnflow.h>
       
    30 #include <comms-infras/ss_flowbinders.h>
       
    31 #include <comms-infras/ss_nodemessages_dataclient.h>
       
    32 
       
    33 namespace ESock
       
    34 {
       
    35 
       
    36 class CNetworkFlow : public CSubConnectionFlowBase, protected MSessionData, protected MSessionControl,
       
    37                         protected MFlowBinderControl
       
    38 /** Service Access Point for SAPs that have a seperate control side.
       
    39 
       
    40 Provides transport services to a single protocol. Several of the calls to
       
    41 CServProviderBase have pre-conditions attached to them - for example
       
    42 a connection oriented protocol must have its local address set (either by
       
    43 a SetLocalName() or AutoBind()) before it is opened. If the socket server
       
    44 calls the CServProviderBase in such an erroneous way, the protocol should panic.
       
    45 
       
    46 It also provides an interface towards subconnection providers to allow
       
    47 SAPs to work with a seperate control path.
       
    48 
       
    49 @internalTechnology
       
    50 @released Since 9.0 */
       
    51 	{
       
    52 	friend class ProtocolManager;
       
    53 public:
       
    54 
       
    55 	IMPORT_C virtual ~CNetworkFlow();
       
    56 
       
    57 protected:
       
    58 	void SetLocalName(TSockAddr& anAddr);
       
    59 	TInt SetRemName(TSockAddr& anAddr);
       
    60 	TUint Write(const TDesC8& aDesc,TUint aOptions, TSockAddr* anAddr);
       
    61 	TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr);
       
    62     void BindToL(const TCFDataClient::TBindTo& aBindTo);
       
    63     NetInterfaces::TInterfaceControl* FetchInterfaceControlL(TSupportedCommsApiExt aInterfaceId);
       
    64 
       
    65 protected:
       
    66 
       
    67 	virtual MFlowBinderControl* DoGetBinderControlL();
       
    68 	//MFlowBinderControl
       
    69 	virtual MSessionControl* GetControlL(TInt aSessionType,MSessionControlNotify& aSessionControlNotify);
       
    70 	virtual void Unbind();
       
    71 	virtual MSessionData* BindL(MSessionDataNotify& aNotify);
       
    72 	virtual CSubConnectionFlowBase* Flow(); //returns its own flow
       
    73 
       
    74     TBool IsBoundToSession() const
       
    75         {
       
    76         return  iSessionControlNotify || iSessionDataNotify;
       
    77         }
       
    78 
       
    79 	void ProcessDCIdleState();
       
    80 
       
    81 #ifdef SYMBIAN_NETWORKING_UPS
       
    82 	virtual TBool ActivityRunning() = 0;
       
    83 #else
       
    84     inline TBool NoBearerGuard()
       
    85     	{ return iNoBearerRunning; }
       
    86     inline void SetNoBearerGuard()
       
    87     	{ iNoBearerRunning = ETrue; }
       
    88     inline void ClearNoBearerGuard()
       
    89     	{ iNoBearerRunning = EFalse; }
       
    90 #endif
       
    91 
       
    92 protected:
       
    93 	IMPORT_C CNetworkFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
       
    94 	void UpdateDestinationAddress(const TSockAddr& aDest);
       
    95 
       
    96 protected:
       
    97 	TSockAddr iLocalAddress;
       
    98 	TSockAddr iRemoteAddress;
       
    99 
       
   100 	//upper flow
       
   101 	MSessionControlNotify* iSessionControlNotify;
       
   102 	MSessionDataNotify* iSessionDataNotify;
       
   103 	//lower flow
       
   104 	MFlowBinderControl* iLowerFlow;
       
   105 	MLowerControl* iLowerControl; //just to keep the lower flow up
       
   106 
       
   107 	enum TDCIdleState
       
   108 		{
       
   109 		EClientsPresent = 0, // presumption is we're always created for a client (ie HR or socket)
       
   110 		EIdle = 1,
       
   111 		EIdleSent = 2
       
   112 		};
       
   113 	TBool iLocalAddressSet:1;
       
   114 	TBool iRemoteAddressSet:1;
       
   115 	TBool iConnectionInfoSet:1;
       
   116 	TBool iJoinOutstanding:1;
       
   117 	TBool iLeaveOutstanding:1;	
       
   118 #ifndef SYMBIAN_NETWORKING_UPS
       
   119 	TBool iNoBearerRunning:1;			// NoBearer msg has been issued to SCPR
       
   120 #endif
       
   121 	TBool iIsStarted:1;	
       
   122 	TDCIdleState iDCIdle:2;			
       
   123 	};
       
   124 
       
   125 } //namespace ESock
       
   126 
       
   127 #endif	// __ES_SAP_H__
       
   128 
       
   129