epoc32/include/comms-infras/es_sap.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 
    54 public:
    55 
    56 	IMPORT_C virtual ~CNetworkFlow();
    57 
    58 protected:
    59 	void SetLocalName(TSockAddr& anAddr);
    60 	TInt SetRemName(TSockAddr& anAddr);
    61 	TUint Write(const TDesC8& aDesc,TUint aOptions, TSockAddr* anAddr);
    62 	TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr);
    63     void BindToL(const TCFDataClient::TBindTo& aBindTo);
    64     NetInterfaces::TInterfaceControl* FetchInterfaceControlL(TSupportedCommsApiExt aInterfaceId);
    65 
    66 protected:
    67 
    68 	virtual MFlowBinderControl* DoGetBinderControlL();
    69 	//MFlowBinderControl
    70 	virtual MSessionControl* GetControlL(TInt aSessionType,MSessionControlNotify& aSessionControlNotify);
    71 	virtual void Unbind();
    72 	virtual MSessionData* BindL(MSessionDataNotify& aNotify);
    73 	virtual CSubConnectionFlowBase* Flow(); //returns its own flow
    74 
    75     TBool IsBoundToSession() const
    76         {
    77         return  iSessionControlNotify || iSessionDataNotify;
    78         }
    79 
    80 	void ProcessDCIdleState();
    81 
    82 	
    83 protected:
    84 	IMPORT_C CNetworkFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
    85 	void UpdateDestinationAddress(const TSockAddr& aDest);
    86 
    87     #define SAP_FLAG_FUNCTIONS(name, flag) \
    88 		inline TBool name() { return iStateFlags & flag; } \
    89 		inline void Set##name() { iStateFlags |= flag; }	\
    90 		inline void Clear##name() { iStateFlags &= ~flag; }
    91 
    92 #ifdef SYMBIAN_NETWORKING_UPS
    93 	virtual TBool ActivityRunning() = 0;
    94 #endif
    95 
    96 
    97 protected:
    98 	TSockAddr iLocalAddress;
    99 	TSockAddr iRemoteAddress;
   100 
   101 	//upper flow
   102 	MSessionControlNotify* iSessionControlNotify;
   103 	MSessionDataNotify* iSessionDataNotify;
   104 	//lower flow
   105 	MFlowBinderControl* iLowerFlow;
   106 	MLowerControl* iLowerControl; //just to keep the lower flow up
   107 
   108 	enum TStateFlag
   109 		{
   110 		ELocalAddressSet = 0x00000001,
   111 		ERemoteAddressSet = 0x00000002,
   112 		ENoBearerRunning = 0x00000004,
   113 		EStarted = 0x00000008,
   114 		EIdle = 0x00000080,
   115 		EIdleSent = 0x00000100
   116 		};
   117 	SAP_FLAG_FUNCTIONS(LocalAddressSet, ELocalAddressSet)
   118 	SAP_FLAG_FUNCTIONS(RemoteAddressSet, ERemoteAddressSet)
   119 	SAP_FLAG_FUNCTIONS(NoBearerGuard, ENoBearerRunning)
   120 	SAP_FLAG_FUNCTIONS(Started, EStarted)
   121 	SAP_FLAG_FUNCTIONS(Idle, EIdle)
   122 	SAP_FLAG_FUNCTIONS(IdleSent, EIdleSent)
   123 		
   124 	TUint iStateFlags;
   125 	};
   126 
   127 } //namespace ESock
   128 
   129 #endif	// __ES_SAP_H__
   130 
   131