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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #if !defined(__ES_SAP_H__)
25 #define SYMBIAN_NETWORKING_UPS
29 #include <comms-infras/ss_subconnflow.h>
30 #include <comms-infras/ss_flowbinders.h>
31 #include <comms-infras/ss_nodemessages_dataclient.h>
36 class CNetworkFlow : public CSubConnectionFlowBase, protected MSessionData, protected MSessionControl,
37 protected MFlowBinderControl
38 /** Service Access Point for SAPs that have a seperate control side.
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.
46 It also provides an interface towards subconnection providers to allow
47 SAPs to work with a seperate control path.
50 @released Since 9.0 */
52 friend class ProtocolManager;
56 IMPORT_C virtual ~CNetworkFlow();
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);
68 virtual MFlowBinderControl* DoGetBinderControlL();
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
75 TBool IsBoundToSession() const
77 return iSessionControlNotify || iSessionDataNotify;
80 void ProcessDCIdleState();
84 IMPORT_C CNetworkFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
85 void UpdateDestinationAddress(const TSockAddr& aDest);
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; }
92 #ifdef SYMBIAN_NETWORKING_UPS
93 virtual TBool ActivityRunning() = 0;
98 TSockAddr iLocalAddress;
99 TSockAddr iRemoteAddress;
102 MSessionControlNotify* iSessionControlNotify;
103 MSessionDataNotify* iSessionDataNotify;
105 MFlowBinderControl* iLowerFlow;
106 MLowerControl* iLowerControl; //just to keep the lower flow up
110 ELocalAddressSet = 0x00000001,
111 ERemoteAddressSet = 0x00000002,
112 ENoBearerRunning = 0x00000004,
113 EStarted = 0x00000008,
115 EIdleSent = 0x00000100
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)
129 #endif // __ES_SAP_H__