1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/comms-infras/es_sap.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,131 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @internalTechnology
1.22 + @released
1.23 +*/
1.24 +
1.25 +#if !defined(__ES_SAP_H__)
1.26 +#define __ES_SAP_H__
1.27 +
1.28 +#define SYMBIAN_NETWORKING_UPS
1.29 +
1.30 +#include <es_prot.h>
1.31 +#include <es_sock.h>
1.32 +#include <comms-infras/ss_subconnflow.h>
1.33 +#include <comms-infras/ss_flowbinders.h>
1.34 +#include <comms-infras/ss_nodemessages_dataclient.h>
1.35 +
1.36 +namespace ESock
1.37 +{
1.38 +
1.39 +class CNetworkFlow : public CSubConnectionFlowBase, protected MSessionData, protected MSessionControl,
1.40 + protected MFlowBinderControl
1.41 +/** Service Access Point for SAPs that have a seperate control side.
1.42 +
1.43 +Provides transport services to a single protocol. Several of the calls to
1.44 +CServProviderBase have pre-conditions attached to them - for example
1.45 +a connection oriented protocol must have its local address set (either by
1.46 +a SetLocalName() or AutoBind()) before it is opened. If the socket server
1.47 +calls the CServProviderBase in such an erroneous way, the protocol should panic.
1.48 +
1.49 +It also provides an interface towards subconnection providers to allow
1.50 +SAPs to work with a seperate control path.
1.51 +
1.52 +@internalTechnology
1.53 +@released Since 9.0 */
1.54 + {
1.55 + friend class ProtocolManager;
1.56 +
1.57 +public:
1.58 +
1.59 + IMPORT_C virtual ~CNetworkFlow();
1.60 +
1.61 +protected:
1.62 + void SetLocalName(TSockAddr& anAddr);
1.63 + TInt SetRemName(TSockAddr& anAddr);
1.64 + TUint Write(const TDesC8& aDesc,TUint aOptions, TSockAddr* anAddr);
1.65 + TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr);
1.66 + void BindToL(const TCFDataClient::TBindTo& aBindTo);
1.67 + NetInterfaces::TInterfaceControl* FetchInterfaceControlL(TSupportedCommsApiExt aInterfaceId);
1.68 +
1.69 +protected:
1.70 +
1.71 + virtual MFlowBinderControl* DoGetBinderControlL();
1.72 + //MFlowBinderControl
1.73 + virtual MSessionControl* GetControlL(TInt aSessionType,MSessionControlNotify& aSessionControlNotify);
1.74 + virtual void Unbind();
1.75 + virtual MSessionData* BindL(MSessionDataNotify& aNotify);
1.76 + virtual CSubConnectionFlowBase* Flow(); //returns its own flow
1.77 +
1.78 + TBool IsBoundToSession() const
1.79 + {
1.80 + return iSessionControlNotify || iSessionDataNotify;
1.81 + }
1.82 +
1.83 + void ProcessDCIdleState();
1.84 +
1.85 +
1.86 +protected:
1.87 + IMPORT_C CNetworkFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
1.88 + void UpdateDestinationAddress(const TSockAddr& aDest);
1.89 +
1.90 + #define SAP_FLAG_FUNCTIONS(name, flag) \
1.91 + inline TBool name() { return iStateFlags & flag; } \
1.92 + inline void Set##name() { iStateFlags |= flag; } \
1.93 + inline void Clear##name() { iStateFlags &= ~flag; }
1.94 +
1.95 +#ifdef SYMBIAN_NETWORKING_UPS
1.96 + virtual TBool ActivityRunning() = 0;
1.97 +#endif
1.98 +
1.99 +
1.100 +protected:
1.101 + TSockAddr iLocalAddress;
1.102 + TSockAddr iRemoteAddress;
1.103 +
1.104 + //upper flow
1.105 + MSessionControlNotify* iSessionControlNotify;
1.106 + MSessionDataNotify* iSessionDataNotify;
1.107 + //lower flow
1.108 + MFlowBinderControl* iLowerFlow;
1.109 + MLowerControl* iLowerControl; //just to keep the lower flow up
1.110 +
1.111 + enum TStateFlag
1.112 + {
1.113 + ELocalAddressSet = 0x00000001,
1.114 + ERemoteAddressSet = 0x00000002,
1.115 + ENoBearerRunning = 0x00000004,
1.116 + EStarted = 0x00000008,
1.117 + EIdle = 0x00000080,
1.118 + EIdleSent = 0x00000100
1.119 + };
1.120 + SAP_FLAG_FUNCTIONS(LocalAddressSet, ELocalAddressSet)
1.121 + SAP_FLAG_FUNCTIONS(RemoteAddressSet, ERemoteAddressSet)
1.122 + SAP_FLAG_FUNCTIONS(NoBearerGuard, ENoBearerRunning)
1.123 + SAP_FLAG_FUNCTIONS(Started, EStarted)
1.124 + SAP_FLAG_FUNCTIONS(Idle, EIdle)
1.125 + SAP_FLAG_FUNCTIONS(IdleSent, EIdleSent)
1.126 +
1.127 + TUint iStateFlags;
1.128 + };
1.129 +
1.130 +} //namespace ESock
1.131 +
1.132 +#endif // __ES_SAP_H__
1.133 +
1.134 +