williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: williamr@2: #if !defined(__ES_PROT_H__) williamr@2: #define __ES_PROT_H__ williamr@2: williamr@2: williamr@2: #include williamr@2: williamr@2: /** williamr@2: ESock subsession unique id williamr@2: @internalTechnology williamr@2: */ williamr@2: typedef TUint TSubSessionUniqueId; williamr@2: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: enum TConnStartType williamr@2: { williamr@2: EConnStartExplicit, williamr@2: EConnStartImplicit williamr@2: }; williamr@2: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: enum TESOCKActivePriority williamr@2: { williamr@2: ESSExclusivePriority=100000, williamr@2: ECommReceivePriority=200, ///< Must always run. williamr@2: ECommTransmitPriority=100, williamr@2: ECAsyncImmediatePriority=75, ///< I.e. before a timer event goes off. williamr@2: ESocketTimerPriority=50, williamr@2: EActiveIpcPriority=20, williamr@2: EActiveHighPriority=10, williamr@2: EActiveMedPriority=0, williamr@2: EActiveLowPriority=-10, williamr@2: ECAsyncDeferredPriority=-20, williamr@2: }; williamr@2: williamr@2: /** williamr@2: End of data,Socket can't receive more data. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: const TUint KNewDataEndofData = 0xFFFFFFFF; williamr@2: williamr@2: class CServProviderBase; williamr@2: class CSocket; williamr@2: williamr@2: class MSocketNotify williamr@2: /** Abstract base class used by a CServProviderBase-derived object, through its williamr@2: iSocket member, to notify the socket server that various events have occurred. williamr@2: williamr@2: The class provides several up-call member functions. williamr@2: williamr@2: All up-calls on an MSocketNotify should be made in the context of the socket williamr@2: server's thread - i.e. the thread which called NewSAPL() on the protocol. williamr@2: williamr@2: @publishedPartner williamr@2: @released Since v5.0 */ williamr@2: { williamr@2: public: williamr@2: /** Delete and detach flags. */ williamr@2: enum TDelete williamr@2: { williamr@2: /** Delete SAP */ williamr@2: EDelete, williamr@2: /** Don't delete SAP */ williamr@2: EDetach williamr@2: }; williamr@2: /** Error codes. */ williamr@2: enum TOperationBitmasks williamr@2: { williamr@2: /** An error has occurred which affects Send() operations */ williamr@2: EErrorSend=0x0000001, williamr@2: williamr@2: /** An error has occurred which affects Receive() operations. */ williamr@2: EErrorRecv=0x0000002, williamr@2: williamr@2: /** An error has occurred which affects Connect() operations */ williamr@2: EErrorConnect=0x0000004, williamr@2: williamr@2: /** An error has occurred which affects Close() operations */ williamr@2: EErrorClose=0x00000008, williamr@2: williamr@2: /** An error has occurred which affects Ioctl() operations */ williamr@2: EErrorIoctl=0x00000010, williamr@2: williamr@2: /** A fatal error has occurred */ williamr@2: EErrorFatal=0x10000000, williamr@2: williamr@2: /** An error has occurred which affects all operations */ williamr@2: EErrorAllOperations=0x7fffffff, williamr@2: }; williamr@2: williamr@2: /** williamr@2: Indicates that new data is available on a service access point williamr@2: williamr@2: For a stream-oriented protocol aCount should be a byte count; for datagram-oriented williamr@2: sockets aCount should be a datagram count. williamr@2: williamr@2: @note aCount is the amount of new data, not the total amount of data waiting williamr@2: to be read. williamr@2: williamr@2: @param aCount The amount of new data. A value of KNewDataEndofData indicates williamr@2: that the socket is in a half-closed state and will receive no more data. Any subsequent williamr@2: reads will complete with KErrEof and a length of 0. */ williamr@2: virtual void NewData(TUint aCount) = 0; williamr@2: /** Indicates that new buffer space is available on a service. */ williamr@2: virtual void CanSend() = 0; williamr@2: /** Indicates that a connection attempt has completed successfully (for active opens). williamr@2: williamr@2: There are four versions of this up-call: two are for active opens and two are for passive williamr@2: opens. Both active and passive versions support a variant carrying user connection williamr@2: data for protocols which support it. williamr@2: williamr@2: @note A connection-less protocol should never call the ConnectComplete() up-calls. williamr@2: @note A protocol should keep a count of sockets which have called ConnectComplete() williamr@2: but have not had Start() called. Sockets in this state have their Error() williamr@2: and NewData() calls deferred until Start() is called.*/ williamr@2: virtual void ConnectComplete() = 0; williamr@2: /** Indicates that a connection attempt has completed successfully (for active opens). williamr@2: williamr@2: There are four versions of this up-call: two are for active opens and two are for passive williamr@2: opens. Both active and passive versions support a variant carrying user connection williamr@2: data for protocols which support it. williamr@2: williamr@2: @note A connection-less protocol should never call the ConnectComplete() up-calls. williamr@2: @note A protocol should keep a count of sockets which have called ConnectComplete() williamr@2: but have not had Start() called. Sockets in this state have their Error() williamr@2: and NewData() calls deferred until Start() is called. williamr@2: williamr@2: @param aConnectData Connect data (if supported). williamr@2: */ williamr@2: virtual void ConnectComplete(const TDesC8& aConnectData) = 0; williamr@2: /** Indicates that a connection attempt has completed successfully (for passive opens). williamr@2: williamr@2: There are four versions of this up-call: two are for active opens and two are for passive williamr@2: opens. Both active and passive versions support a variant carrying user connection williamr@2: data for protocols which support it. williamr@2: williamr@2: The versions of ConnectComplete() for passive opens carry a new SSP (socket service williamr@2: provider, or SAP) for the newly created socket. A new socket will then be linked up to williamr@2: the SSP and data transfer can take place. The original socket stays listening. williamr@2: williamr@2: @note A connection-less protocol should never call the ConnectComplete() up-calls. williamr@2: @note A protocol should keep a count of sockets which have called ConnectComplete() williamr@2: but have not had Start() called. Sockets in this state have their Error() williamr@2: and NewData() calls deferred until Start() is called. williamr@2: williamr@2: @param aSSP The new SSP for passive opens. williamr@2: */ williamr@2: virtual void ConnectComplete(CServProviderBase& aSSP) = 0; williamr@2: /** Indicates that a connection attempt has completed successfully (for passive opens). williamr@2: williamr@2: There are four versions of this up-call: two are for active opens and two are for passive williamr@2: opens. Both active and passive versions support a variant carrying user connection williamr@2: data for protocols which support it. williamr@2: williamr@2: The versions of ConnectComplete() for passive opens carry a new SSP (socket service williamr@2: provider, or SAP) for the newly created socket. A new socket will then be linked up to williamr@2: the SSP and data transfer can take place. The original socket stays listening. williamr@2: williamr@2: @note A connection-less protocol should never call the ConnectComplete() up-calls. williamr@2: @note A protocol should keep a count of sockets which have called ConnectComplete() williamr@2: but have not had Start() called. Sockets in this state have their Error() williamr@2: and NewData() calls deferred until Start() is called. williamr@2: williamr@2: @param aSSP The new SSP for passive opens. williamr@2: @param aConnectData Connect data (if supported). */ williamr@2: virtual void ConnectComplete(CServProviderBase& aSSP,const TDesC8& aConnectData) = 0; williamr@2: /** Indicates that the SAP has finished closing down. williamr@2: williamr@2: This up-call is the response to a Shutdown(). A connection-oriented protocol should call williamr@2: CanClose() when it has terminated communications with the remote host. Protocols can call williamr@2: CanClose() from within their Shutdown() code. After CanClose() has been called, an SAP may williamr@2: be deleted by the socket server. williamr@2: williamr@2: @note The protocol must not access the CServProviderBase object after calling CanClose(). williamr@2: @param aDelete Delete SAP. williamr@2: */ williamr@2: virtual void CanClose(TDelete aDelete=EDelete) = 0; williamr@2: /** Indicates that the SAP has finished closing down. williamr@2: williamr@2: This up-call is the response to a Shutdown(). A connection-oriented protocol should call williamr@2: CanClose() when it has terminated communications with the remote host. Protocols can call williamr@2: CanClose() from within their Shutdown() code. After CanClose() has been called, an SAP may williamr@2: be deleted by the socket server. williamr@2: williamr@2: @note The protocol must not access the CServProviderBase object after calling CanClose(). williamr@2: @param aDisconnectData Any user data carried on the disconnect frame. williamr@2: @param aDelete Delete SAP. williamr@2: */ williamr@2: virtual void CanClose(const TDesC8& aDisconnectData,TDelete aDelete=EDelete) = 0; williamr@2: /** Tells the socket server that an error state has arisen within the protocol. williamr@2: williamr@2: It should not be used to report programmatic errors, either in the protocol williamr@2: itself or the socket server (a panic should be used in these cases). When williamr@2: Error() is called on a connection-oriented socket, the socket is moved into williamr@2: a dead state which denies user access to it. williamr@2: williamr@2: @param anError KErrNone or another of the system-wide error codes. williamr@2: @param anOperationMask A bitmask of TOperationBitmasks values specifying which williamr@2: pending operations are affected by the Error up-call. */ williamr@2: virtual void Error(TInt anError,TUint anOperationMask=EErrorAllOperations) = 0; williamr@2: /** Indicates that the other end of a connection has disconnected. williamr@2: williamr@2: This is analogous to CanClose(), but in this case the other end initiated it. williamr@2: williamr@2: Once the client has called Shutdown() it is illegal to call Disconnect(). Instead, williamr@2: CanClose() or Error(KErrDisconnected) should be called. williamr@2: */ williamr@2: virtual void Disconnect(void) = 0; williamr@2: /** Indicates that the other end of a connection has disconnected. williamr@2: williamr@2: This is analogous to CanClose(), but in this case the other end initiated it. williamr@2: williamr@2: Once the client has called Shutdown() it is illegal to call Disconnect(). Instead, williamr@2: CanClose() or Error(KErrDisconnected) should be called. williamr@2: williamr@2: @param aConnectData User data in the disconnect frame. williamr@2: */ williamr@2: virtual void Disconnect(TDesC8& aDisconnectData) = 0; williamr@2: /** Indicates that the currently pending Ioctl has completed. williamr@2: williamr@2: The parameter aBuf is protocol defined - in fact it is defined by the specific williamr@2: Ioctl. williamr@2: williamr@2: @param aBuf Any data requested by the Ioctl operation. */ williamr@2: virtual void IoctlComplete(TDesC8* aBuf) = 0; williamr@2: williamr@2: /** williamr@2: Indicates that there are no bearer available williamr@2: williamr@2: @param aConnectionParams, the connection parameters. williamr@2: */ williamr@2: virtual void NoBearer(const TDesC8& aConnectionParams) = 0; williamr@2: williamr@2: /** williamr@2: Indicates the bearer available. williamr@2: williamr@2: @param aConnectionInfo, Information about socket connection. williamr@2: */ williamr@2: virtual void Bearer(const TDesC8& aConnectionInfo) = 0; williamr@2: williamr@2: /** williamr@2: Indicates that this socket is now completed an asynchronous join williamr@2: with a sub-connection. It now can use the properties of the sub-connection williamr@2: */ williamr@2: virtual void JoinedSubConnection() {;}; williamr@2: williamr@2: /** williamr@2: Indicates that this socket was not able to complete an asynchronous join williamr@2: with a sub-connection. The socket is still joined, but cannot use the williamr@2: properties of the sub-connection williamr@2: williamr@2: @param aError Reason the socket could not be joined williamr@2: */ williamr@2: virtual void SubConnectionJoinFailed(TInt /*aError*/) {;}; williamr@2: williamr@2: /** williamr@2: Indicates that this socket has now completed an asynchronous leave williamr@2: from a sub-connection. The socket is now connected to the sub-connection williamr@2: anymore. williamr@2: */ williamr@2: virtual void LeftSubConnection() {;}; williamr@2: williamr@2: private: williamr@2: }; williamr@2: williamr@2: williamr@2: class TNifProgress; williamr@2: williamr@2: class MConnectionNotify williamr@2: /** williamr@2: * Callback interface from CConnectionProvdBase-derived classes williamr@2: * @internalTechnology williamr@2: */ williamr@2: { williamr@2: public: williamr@2: virtual void SelectionComplete(TInt aError, const TDesC8& aSelectionInfo) = 0; williamr@2: virtual void ConnectionError(TInt aError) = 0; williamr@2: virtual void LinkLayerOpen(TInt aError) = 0; williamr@2: virtual void LinkLayerClosed(TInt aError) = 0; williamr@2: virtual void ProgressNotification(TInt aStage, TInt aError) = 0; williamr@2: virtual void ProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId, TInt aStage, TInt aError) = 0; williamr@2: virtual void ServiceChangeNotification(TUint32 aId, const TDesC& aType) = 0; williamr@2: virtual void InterfaceStateChangeNotification(TDesC8& aInfo) = 0; williamr@2: virtual void NotifyDataSent(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aUplinkVolume) = 0; williamr@2: virtual void NotifyDataReceived(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aDownlinkVolume) = 0; williamr@2: williamr@2: virtual void SubConnectionEvent(const TSubConnectionEvent& aSubConnectionEvent) = 0; williamr@2: }; williamr@2: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: enum TProtocolServiceInfo williamr@2: { williamr@2: ESocketSupport=0x00000001, ///< Can make sockets williamr@2: ETransport=0x00000002, ///< Can act as a transport - ie can be bound to williamr@2: EPreferMBufChains=0x00000004, ///< Will process MBufChains (I.e. won't convert them to descriptors) williamr@2: EPreferDescriptors=0x00000008, ///< Will process Descriptors (I.e. won't convert them to MBufChains) williamr@2: ECantProcessMBufChains=0x00000010, ///< Will Panic if asked to process an MBufChain williamr@2: ENeedMBufs=0x00000020, ///< Uses MBufChains internally. williamr@2: EUseCanSend=0x00000040, ///< Uses the inter-protocol CanSend upcall. williamr@2: EInterface=0x00000080, ///< Is a CInterfaceBase rather than CProtocolBase williamr@2: }; williamr@2: williamr@2: /** williamr@2: @internalTechnology williamr@2: */ williamr@2: enum TProtocolType williamr@2: { williamr@2: ENormalProtocol, ///< Normal protocol williamr@2: EInterfaceProtocol ///< Has EInterface flags set and supports GetBinderL() williamr@2: }; williamr@2: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: const TInt KUnlimitedSockets=-1; williamr@2: williamr@2: struct TServerProtocolDesc : public TProtocolDesc williamr@2: /** williamr@2: Contains data that describes a particular protocol. williamr@2: @publishedPartner williamr@2: @released williamr@2: williamr@2: @see CProtocolFamilyBase::ProtocolList(). williamr@2: */ williamr@2: { williamr@2: TInt iServiceTypeInfo; ///< Set this to 1 if the protocol supports socket creation williamr@2: TInt iNumSockets; ///< The maximum number of SSPs the protocol supports williamr@2: }; williamr@2: williamr@2: williamr@2: class MResolverNotify williamr@2: /** williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: virtual void QueryComplete(TInt anError)=0; williamr@2: }; williamr@2: williamr@2: /** Ensure that the requested length for datagrams is bigger than any real one. This ensures that williamr@2: naive providers deliver them without truncation, so allowing the client to perform continuation reads. williamr@2: @internalTechnology williamr@2: */ williamr@2: const TUint KGetDataWholeDatagram = 0x40000000; williamr@2: williamr@2: /** williamr@2: Security checker class passed down to providers which is used to perform security checks on the client williamr@2: of the provider. The provider calls the CheckPolicy(...) method with a suitable TSecurityPolicy williamr@2: class and a diagnostic string as arguments. williamr@2: williamr@2: @see CServProviderBase williamr@2: @see CResolverProvdBase williamr@2: williamr@2: @code williamr@2: _LIT_SECURITY_POLICY_C1(myPolicy1, ECapabilityNetworkServices); williamr@2: ... williamr@2: TInt CMyProvider::SecurityCheck(MProvdSecurityChecker *aChecker) williamr@2: { williamr@2: ... williamr@2: if (aChecker->CheckPolicy(myPolicy1, "CMyProvider main") == KErrNone) williamr@2: { williamr@2: // client has NetworkServices capability williamr@2: } williamr@2: ... williamr@2: } williamr@2: @endcode williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: class MProvdSecurityChecker williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Check the security policy of a client process. williamr@2: williamr@2: Called from a socket or resolver provider to check whether the client process conforms to a security policy. williamr@2: williamr@2: @param aPolicy A TSecurityPolicy class instance containing the security information to be checked against the client. williamr@2: @param aDiagnostic A diagnostic string used when logging system-wide security failures, else 0. williamr@2: @return KErrNone if client process has the required security information, else KErrPermissionDenied. williamr@2: (In the future, some other system error may be returned). williamr@2: */ williamr@2: virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy, const char *aDiagnostic) = 0; williamr@2: }; williamr@2: williamr@2: class RMBufChain; williamr@2: class CSubConnectionProviderBase; williamr@2: class CServProviderBase : public CBase williamr@2: /** Service Access Point. williamr@2: williamr@2: Provides transport services to a single protocol. Several of the calls to williamr@2: CServProviderBase have pre-conditions attached to them - for example williamr@2: a connection oriented protocol must have its local address set (either by williamr@2: a SetLocalName() or AutoBind()) before it is opened. If the socket server williamr@2: calls the CServProviderBase in such an erroneous way, the protocol should panic. williamr@2: williamr@2: @publishedPartner williamr@2: @released Since 5.0 */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: public: williamr@2: williamr@2: /** Describes the behaviour the SAP should take on shutdown.*/ williamr@2: enum TCloseType williamr@2: { williamr@2: ENormal, ///< The protocol should shutdown gracefully — no further input or output will be requested. williamr@2: EStopInput, ///< The protocol should shut down gracefully — all further and pending input should be discarded. williamr@2: EStopOutput, ///< The protocol should shutdown gracefully — all pending output should be discarded. williamr@2: EImmediate ///< The protocol should close the connection immediately and free all resources without performing a graceful disconnect. williamr@2: }; williamr@2: IMPORT_C CServProviderBase(); williamr@2: IMPORT_C virtual ~CServProviderBase(); williamr@2: williamr@2: IMPORT_C virtual void SetNotify(MSocketNotify* aSocket); williamr@2: //V1.0 itf support williamr@2: IMPORT_C virtual void SetSockType(TUint aSockType); williamr@2: IMPORT_C TUint SockType() const; williamr@2: williamr@2: IMPORT_C virtual void JoinSubConnectionL(CSubConnectionProviderBase& aSubConnProvider); williamr@2: IMPORT_C virtual void LeaveSubConnection(CSubConnectionProviderBase& aSubConnProvider); williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: pure virtual williamr@2: */ williamr@2: /** williamr@2: Start a service provider. williamr@2: */ williamr@2: virtual void Start()=0; williamr@2: /** Gets the local name (address) of the socket service provider entity. The format williamr@2: of the data in the TSockAddr object is defined by individual protocols. williamr@2: williamr@2: The local address is the address of the local machine plus a local port number. williamr@2: Generally only the port number is important, unless you have two IP interfaces, williamr@2: for example. williamr@2: williamr@2: @param anAddr The address to be filled in */ williamr@2: virtual void LocalName(TSockAddr& anAddr) const =0; williamr@2: /** Sets the local name (address) of the socket service provider entity. The format williamr@2: of the data in the TSockAddr object is defined by individual protocols. williamr@2: williamr@2: @param anAddr The address williamr@2: @return Returns KErrNone if the local name is correctly set or, if this is williamr@2: not the case, an informative error number. */ williamr@2: virtual TInt SetLocalName(TSockAddr& anAddr)=0; williamr@2: /** Gets the remote name (address) of the socket service provider entity. The format williamr@2: of the data in the TSockAddr object is defined by individual protocols. williamr@2: williamr@2: A remote address is either the address you're sending data to (non connection-oriented williamr@2: sockets)* or the remote end of the connection. It is the address of the remote williamr@2: machine (your peer in the network) plus a port number. williamr@2: williamr@2: @note RemName is only meaningful if the socket server client has called Connect() williamr@2: to set up a default address for SendTo(). This function will only be called williamr@2: on the protocol if this is the case. williamr@2: williamr@2: @param anAddr The address to be filled in */ williamr@2: virtual void RemName(TSockAddr& anAddr) const =0; williamr@2: /** Sets the remote name (address) of the socket service provider entity. The format williamr@2: of the data in the TSockAddr object is defined by individual protocols. williamr@2: williamr@2: @param anAddr The address williamr@2: @return Returns KErrNone if the remote name is correctly set or, if this is williamr@2: not the case, an informative error number. */ williamr@2: virtual TInt SetRemName(TSockAddr& anAddr)=0; williamr@2: /** Gets some protocol specific option when called by the socket server on behalf of a williamr@2: client. A protocol may pass the request down a protocol stack (to protocols it is bound williamr@2: to) using the GetOption() function of CProtocolBase. williamr@2: williamr@2: @param aLevel Option level. williamr@2: @param aName Option name. williamr@2: @param anOption Option data. williamr@2: @return System wide error code. williamr@2: */ williamr@2: virtual TInt GetOption(TUint level,TUint name,TDes8& anOption)const =0; williamr@2: /** Performs some protocol specific IO control. williamr@2: williamr@2: @note If this function is called erroneously, the protocol should call Error() on the williamr@2: socket. If an Ioctl call is already outstanding, the client will be panicked with the williamr@2: value ETwoIoctls. williamr@2: williamr@2: @param aLevel Option level. williamr@2: @param aName Option name. williamr@2: @param anOption Option data. williamr@2: @return System wide error code. williamr@2: */ williamr@2: virtual void Ioctl(TUint level,TUint name,TDes8* anOption)=0; williamr@2: /** Cancels an outstanding Ioctl call. You are guaranteed only to have one outstanding williamr@2: at once. williamr@2: williamr@2: @param aLevel IOCTL level. williamr@2: @param aName IOCTL name. williamr@2: */ williamr@2: virtual void CancelIoctl(TUint aLevel,TUint aName)=0; williamr@2: /** Sets some protocol specific option when called by the socket server on behalf of a williamr@2: client. A protocol may pass the request down a protocol stack (to protocols it is bound williamr@2: to) using the SetOption() function of CProtocolBase. williamr@2: williamr@2: @param aLevel Option level. williamr@2: @param aName Option name. williamr@2: @param anOption Option data. williamr@2: @return System wide error code. williamr@2: */ williamr@2: virtual TInt SetOption(TUint level,TUint name,const TDesC8& anOption)=0; williamr@2: virtual void ActiveOpen()=0; williamr@2: /** Initiates a connection operation - this means that it tells the protocol to williamr@2: attempt to connect to a peer. It is called by the socket server in response williamr@2: to a connect request from a client. williamr@2: williamr@2: This version of the function has user data in the connection frame. williamr@2: williamr@2: Only ever called on connection-oriented sockets. Such a socket williamr@2: should always have both the local address and the remote address specified williamr@2: before this function is called. If this is not the case then the protocol williamr@2: should panic. williamr@2: williamr@2: When a connection has completed, the protocol should call ConnectComplete() williamr@2: on its TNotify. If an error occurs during connection the protocol should not williamr@2: call ConnectComplete() at all; instead it should call Error(). williamr@2: williamr@2: @param aConnectionData If the protocol supports user specified connection williamr@2: data, then it will be held in this buffer. */ williamr@2: virtual void ActiveOpen(const TDesC8& aConnectionData)=0; williamr@2: /** Tells the protocol to start waiting for an incoming connection request on this williamr@2: socket (i.e. port). It is called by the socket server in response to a listen williamr@2: request from a client. williamr@2: williamr@2: Only ever called on connection-oriented sockets. Such a socket williamr@2: should always have both the local address and the remote address specified williamr@2: before this function is called. If this is not the case, then the protocol williamr@2: should panic. williamr@2: williamr@2: The aQue parameter is the number of sockets which can be waiting for an outstanding williamr@2: Start after calling ConnectComplete(). The protocol should keep a count of williamr@2: sockets in this state - incrementing a variable in ConnectComplete(), and williamr@2: decrementing it in Start(). williamr@2: williamr@2: When a connection has completed, the protocol should call ConnectComplete() williamr@2: on its TNotify. If an error occurs during connection the protocol should not williamr@2: call ConnectComplete() at all; instead it should call Error(). williamr@2: williamr@2: @param aQueSize Size of connect queue. williamr@2: */ williamr@2: virtual TInt PassiveOpen(TUint aQueSize)=0; williamr@2: /** Tells the protocol to start waiting for an incoming connection request on this williamr@2: socket (i.e. port). It is called by the socket server in response to a listen williamr@2: request from a client. williamr@2: williamr@2: This version of the function has user data in the connection frame. williamr@2: williamr@2: Only ever called on connection-oriented sockets. Such a socket williamr@2: should always have both the local address and the remote address specified williamr@2: before this function is called. If this is not the case then the protocol williamr@2: should panic. williamr@2: williamr@2: The aQue parameter is the number of sockets which can be waiting for an outstanding williamr@2: Start after calling ConnectComplete(). The protocol should keep a count of williamr@2: sockets in this state - incrementing a variable in ConnectComplete(), and williamr@2: decrementing it in Start(). williamr@2: williamr@2: When a connection has completed the protocol should call ConnectComplete() williamr@2: on its TNotify. If an error occurs during connection the protocol should not williamr@2: call ConnectComplete() at all; instead it should call Error(). williamr@2: williamr@2: @param aQueSize size of connect queue williamr@2: @param aConnectionData if the protocol supports user specified connection data williamr@2: then it will be held in this buffer. */ williamr@2: virtual TInt PassiveOpen(TUint aQueSize,const TDesC8& aConnectionData)=0; williamr@2: /** Terminates a connection (or closes a non connection-oriented socket down). williamr@2: williamr@2: The value of the option argument specifies the type of processing which will williamr@2: be required of the protocol after this function is called. williamr@2: williamr@2: Normally, when the socket server has called Shutdown() for a socket, it will williamr@2: wait for the socket to call CanClose() before destroying the CServProviderBase williamr@2: object. However, if the option argument is EImmediate, the CServProviderBase williamr@2: will be destroyed as soon as Shutdown() returns. williamr@2: williamr@2: @param option The shutdown type. */ williamr@2: virtual void Shutdown(TCloseType option)=0; williamr@2: /** Terminates a connection (or closes a non connection-oriented socket down). williamr@2: williamr@2: The value of the option argument specifies the type of processing which will williamr@2: be required of the protocol after this function is called. williamr@2: williamr@2: Normally, when the socket server has called Shutdown() for a socket, it will williamr@2: wait for the socket to call CanClose() before destroying the CServProviderBase williamr@2: object. However, if the option argument is EImmediate, the CServProviderBase williamr@2: will be destroyed as soon as Shutdown() returns. williamr@2: williamr@2: @param option The shutdown type. williamr@2: @param aDisconnectionData If the protocol supports disconnect data, any such williamr@2: data required will be held in this buffer. */ williamr@2: virtual void Shutdown(TCloseType option,const TDesC8& aDisconnectionData)=0; williamr@2: /** Specifies that the protocol should choose a local address for the service access williamr@2: point itself. */ williamr@2: virtual void AutoBind()=0; williamr@2: williamr@2: // protocol read/write data; ESock v1.5 calls down to the v1.5 itf (RMBufChain). williamr@2: // v1.5-ready protocols implement this, laggard protocols inherit these base class williamr@2: // implementations which call the v1.0 descriptor itf instead. williamr@2: williamr@2: /** Sends data onto the network via the protocol. williamr@2: williamr@2: Connection-oriented sockets must be in a connected state (that is ConnectComplete() has williamr@2: been called on their MSocketNotify before Write() is called). williamr@2: williamr@2: The socket server keeps track of how much data is waiting and then tries to send it all williamr@2: until the protocol tells it to hold off by returning 0 (datagram sockets) or 'less than williamr@2: all data consumed' (stream sockets) to Write(). The protocol should call CanSend() when it williamr@2: is ready to send more data. williamr@2: williamr@2: anAddr is the address to write the data to. Connection oriented sockets always use the williamr@2: default value. williamr@2: williamr@2: @param aDesc The data to be sent. williamr@2: @param aOptions Protocol specific options. williamr@2: @param anAddr Address to write the data to. williamr@2: williamr@2: @returns For stream-oriented protocols the return value is the number of bytes actually written. williamr@2: If this is less than the length of the descriptor then the protocol should call CanSend() williamr@2: when it is ready to send more data. For datagram-oriented protocols, the write should return williamr@2: either 0 if the write cannot be completed, or the length of the descriptor if the write succeeds - williamr@2: no other values are valid. If the Write() must return 0, then it should call CanSend() when it is williamr@2: ready to send more data. If the Write() fails due to some error, then it should call Error() with williamr@2: an informative error number. williamr@2: */ williamr@2: IMPORT_C virtual TUint Write(const TDesC8& aDesc,TUint options, TSockAddr* anAddr=NULL); williamr@2: /** Sends data onto the network via the protocol. williamr@2: williamr@2: Connection-oriented sockets must be in a connected state (that is ConnectComplete() has williamr@2: been called on their MSocketNotify before Write() is called). williamr@2: williamr@2: The socket server keeps track of how much data is waiting and then tries to send it all williamr@2: until the protocol tells it to hold off by returning 0 (datagram sockets) or 'less than williamr@2: all data consumed' (stream sockets) to Write(). The protocol should call CanSend() when it williamr@2: is ready to send more data. williamr@2: williamr@2: anAddr is the address to write the data to. Connection oriented sockets always use the williamr@2: default value. williamr@2: williamr@2: @param aData The data to be sent. williamr@2: @param aOptions Protocol specific options. williamr@2: @param anAddr Address to write the data to. williamr@2: williamr@2: @returns For stream-oriented protocols the return value is the number of bytes actually written. williamr@2: If this is less than the length of the descriptor then the protocol should call CanSend() williamr@2: when it is ready to send more data. For datagram-oriented protocols, the write should return williamr@2: either 0 if the write cannot be completed, or the length of the descriptor if the write succeeds - williamr@2: no other values are valid. If the Write() must return 0, then it should call CanSend() when it is williamr@2: ready to send more data. If the Write() fails due to some error, then it should call Error() with williamr@2: an informative error number. williamr@2: */ williamr@2: IMPORT_C virtual TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr=NULL); williamr@2: williamr@2: /** Gets data which the protocol has indicated is waiting in its buffers using the NewData williamr@2: up-call on the MSocketNotify. williamr@2: williamr@2: GetData() will only ever be called for as much data as the protocol has specified it can process williamr@2: using the NewData up-call. williamr@2: williamr@2: For stream oriented protocols GetData() should fill the descriptor with data from the stream. On williamr@2: a datagram protocol GetData() should copy one datagram into the descriptor and set the length of williamr@2: the descriptor. If a full datagram will not fit into the supplied descriptor, the overflow should williamr@2: be discarded. williamr@2: williamr@2: anAddr should be filled in by the protocol with the address of where the data came from. williamr@2: williamr@2: @param aDesc The buffer for data. williamr@2: @param aOptions Protocol specific options. williamr@2: @param anAddr Address where the data came from. williamr@2: */ williamr@2: IMPORT_C virtual void GetData(TDes8& aDesc,TUint options,TSockAddr* anAddr=NULL); williamr@2: /** Gets data which the protocol has indicated is waiting in its buffers using the NewData williamr@2: up-call on the MSocketNotify. williamr@2: williamr@2: GetData() will only ever be called for as much data as the protocol has specified it can process williamr@2: using the NewData up-call. williamr@2: williamr@2: For stream oriented protocols GetData() should fill the descriptor with data from the stream. On williamr@2: a datagram protocol GetData() should copy one datagram into the descriptor and set the length of williamr@2: the descriptor. If a full datagram will not fit into the supplied descriptor, the overflow should williamr@2: be discarded. williamr@2: williamr@2: anAddr should be filled in by the protocol with the address of where the data came from. williamr@2: williamr@2: @param aDesc The buffer for data. williamr@2: @param aOptions Protocol specific options. williamr@2: @param anAddr Address where the data came from. williamr@2: */ williamr@2: IMPORT_C virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr=NULL); williamr@2: williamr@2: /** Use the class instance argument to perform security policy checks on the originating client process. williamr@2: williamr@2: This method is called when a SAP is created and when a socket is transferred between sessions. The SAP is williamr@2: required to check whether the originating client process has enough privileges to request services from the SAP. williamr@2: The MProvdSecurityChecker class instance is used to perform security policy checks. The SAP may choose williamr@2: to perform a security policy check in its SecurityCheck(...) method, or it may choose to store the williamr@2: MProvdSecurityChecker class instance argument and perform checking later (i.e. when subsequent williamr@2: SAP methods are called). williamr@2: williamr@2: @param aSecurityChecker Pointer to class used by SAP to perform security checks on the client process. This williamr@2: pointer becomes invalid when the SAP is destroyed or detached. williamr@2: @returns KErrPermissionDenied if SAP wishes to disallow access to the client, else KErrNone. This would williamr@2: normally be as a result of calling MProvdSecurityChecker::CheckPolicy(...) with a suitable security policy argument. williamr@2: */ williamr@2: IMPORT_C virtual TInt SecurityCheck(MProvdSecurityChecker *aSecurityChecker); williamr@2: williamr@2: protected: williamr@2: /** On socket creation, the socket server sets this member to point to a server williamr@2: notification interface. */ williamr@2: MSocketNotify* iSocket; williamr@2: private: williamr@2: //V1.0 interface support specifics williamr@2: HBufC8* iV1ShimDataIn; williamr@2: HBufC8* iV1ShimDataOut; williamr@2: TUint iSockType; williamr@2: }; williamr@2: williamr@2: class CProtocolBase; williamr@2: class CResolverProvdBase : public CBase williamr@2: /** williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: public: williamr@2: inline void SetNotify(MResolverNotify* aNotifier); williamr@2: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: virtual void CancelCurrentOperation()=0; williamr@2: williamr@2: /** Use the class instance argument to perform security policy checks on the originating client process. williamr@2: williamr@2: This method is called when a resolver is created. The resolver is required to check whether the originating williamr@2: client process has enough privileges to request services from the resolver. The MProvdSecurityChecker williamr@2: class instance is used to perform security policy checks. The resolver may choose to perform a security williamr@2: policy check in its SecurityCheck(...) method, or it may choose to store the MProvdSecurityChecker class williamr@2: instance argument and use it to perform checking later (i.e. when subsequent resolver methods are called). williamr@2: williamr@2: @param aSecurityChecker Pointer to class used by resolver to perform security checks on the client process. This williamr@2: pointer becomes invalid when the resolver is destroyed or detached. williamr@2: @returns KErrPermissionDenied if resolver wishes to disallow access to the client, else KErrNone. This would williamr@2: normally be as a result of calling MProvdSecurityChecker::CheckPolicy(...) with a suitable security policy argument. williamr@2: */ williamr@2: IMPORT_C virtual TInt SecurityCheck(MProvdSecurityChecker *aSecurityChecker); williamr@2: williamr@2: protected: williamr@2: MResolverNotify* iNotify; williamr@2: private: williamr@2: CProtocolBase* iProtocol; williamr@2: }; williamr@2: williamr@2: class CHostResolvProvdBase : public CResolverProvdBase williamr@2: /** williamr@2: Provides Host name resolver service williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: public: williamr@2: williamr@2: /** williamr@2: Get the Host name by name williamr@2: @param aName, results of name queries williamr@2: */ williamr@2: virtual void GetByName(TNameRecord& aName)=0; williamr@2: williamr@2: /** williamr@2: Gets the Host name by address williamr@2: @param aName, results of name queries williamr@2: */ williamr@2: virtual void GetByAddress(TNameRecord& aName)=0; williamr@2: williamr@2: /** williamr@2: Sets the Host name williamr@2: @param aNameBuf, name to set williamr@2: */ williamr@2: virtual void SetHostName(TDes& aNameBuf)=0; williamr@2: williamr@2: /** williamr@2: Gets the Host name williamr@2: @param aNameBuf, name to retrieve williamr@2: */ williamr@2: virtual void GetHostName(TDes& aNameBuf)=0; williamr@2: IMPORT_C virtual TInt SetOption(TUint level,TUint name,const TDesC8& anOption); williamr@2: IMPORT_C virtual void Query(const TDesC8& aQryBuf, TDes8& aResBuf, TInt aCounter); williamr@2: }; williamr@2: williamr@2: class CServiceResolvProvdBase : public CResolverProvdBase williamr@2: /** williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: public: williamr@2: williamr@2: /** williamr@2: Get the Host name by name williamr@2: @param aName, results of name queries williamr@2: */ williamr@2: virtual void GetByName(const TDesC& aNameBuf,TInt32& aPortNum)=0; williamr@2: williamr@2: /** williamr@2: Gets the Host name by address williamr@2: @param aName, results of name queries williamr@2: */ williamr@2: virtual void GetByNumber(TDes& aNameBuf,TInt32 aPortNum)=0; williamr@2: williamr@2: /** williamr@2: Sets the Host name williamr@2: @param aNameBuf, name to set williamr@2: */ williamr@2: virtual void RegisterService(const TDesC& aNameBuf,TInt32 aPortNum)=0; williamr@2: williamr@2: /** williamr@2: Gets the Host name williamr@2: @param aNameBuf, name to retrieve williamr@2: */ williamr@2: virtual void RemoveService(const TDesC& aNameBuf,TInt32 aPortNum)=0; williamr@2: }; williamr@2: williamr@2: class CNetDBProvdBase : public CResolverProvdBase williamr@2: /** williamr@2: Provides network Database access williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: public: williamr@2: virtual void Query(TDes8& aBuffer)=0; williamr@2: virtual void Add(TDes8& aBuffer)=0; williamr@2: virtual void Remove(TDes8& aBuffer)=0; williamr@2: }; williamr@2: williamr@2: /** williamr@2: Definition of argument to CConnectionProvdBase::SetUsageProfile() williamr@2: Bitmap masks williamr@2: williamr@2: @internalTechnology williamr@2: */ williamr@2: const TUint KConnProfileNone = 0; williamr@2: williamr@2: /** williamr@2: Definition of argument to CConnectionProvdBase::SetUsageProfile() williamr@2: Bitmap masks williamr@2: williamr@2: @internalTechnology williamr@2: */ williamr@2: const TUint KConnProfileLong = 1; williamr@2: williamr@2: /** williamr@2: Definition of argument to CConnectionProvdBase::SetUsageProfile() williamr@2: Bitmap masks williamr@2: williamr@2: @internalTechnology williamr@2: */ williamr@2: const TUint KConnProfileMedium = 2; williamr@2: williamr@2: class TConnPref; williamr@2: class CSubConnectionProviderBase; williamr@2: class CNifIfBase; williamr@2: williamr@2: class CConnectionProvdBase : public CBase williamr@2: /** williamr@2: * Base class for connection providers (currently nifman) williamr@2: * @internalTechnology williamr@2: */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: friend class CConnection; williamr@2: friend class CConnectionSettingsShim; //to access the virtual "Do" db functions directly williamr@2: public: williamr@2: IMPORT_C virtual ~CConnectionProvdBase(); williamr@2: williamr@2: IMPORT_C TUint Id() const; williamr@2: IMPORT_C void SetConnectionProviderClient(MConnectionNotify* aClient); williamr@2: MConnectionNotify* ConnectionProviderClient(); williamr@2: williamr@2: williamr@2: // SubConnectionProvider Management williamr@2: void JoinL(CSubConnectionProviderBase& aSubConnProvider); williamr@2: void Leave(CSubConnectionProviderBase& aSubConnProvider); williamr@2: williamr@2: virtual void StartL(TConnStartType aConnectType, const RMessagePtr2* aMessage) = 0; williamr@2: virtual void StartL(TConnStartType aConnectType, const TConnPref& aPref, const RMessagePtr2* aMessage) = 0; williamr@2: virtual void AttachToConnectionL(const TDesC8& aConnectionInfo, TBool aMonitorAttach, const RMessagePtr2* aMessage) = 0; williamr@2: virtual TInt Stop(TInt aError, const RMessagePtr2* aMessage) = 0; williamr@2: virtual void ProgressL(TNifProgressBuf& aBuffer) const = 0; williamr@2: virtual void ProgressL(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgressBuf& aBuffer) const = 0; williamr@2: virtual void LastProgressError(TNifProgressBuf& aBuffer) = 0; williamr@2: virtual void RequestServiceChangeNotificationL() = 0; williamr@2: virtual void CancelServiceChangeNotification() = 0; williamr@2: virtual void EnumerateConnectionsL(RPointerArray& aConnectionInfoPtrArray) = 0; williamr@2: virtual TBool AllInterfaceNotificationL() = 0; williamr@2: virtual void ControlL(TUint aOptionLevel, TUint aOptionName, TDes8& aOption, const RMessagePtr2* aMessage) = 0; williamr@2: virtual void SetUsageProfile(TUint aProfile) = 0; williamr@2: williamr@2: /** williamr@2: Stop the specified subconnection williamr@2: williamr@2: @param aSubConnectionUniqueId The id of the subconnection to be stopped williamr@2: @param aError The error code to be propogated to the clients of the subconnection williamr@2: */ williamr@2: virtual TInt Stop(TSubConnectionUniqueId aSubConnectionUniqueId, TInt aError, const RMessagePtr2* aMessage)=0; williamr@2: williamr@2: /** williamr@2: Find out the number of subconnetions on a connection williamr@2: williamr@2: @param aCount On return, contains the number of subconnections williamr@2: */ williamr@2: virtual TInt EnumerateSubConnections(TUint& aCount)=0; williamr@2: williamr@2: /** williamr@2: Get information about a subconnection specified only by generic index williamr@2: williamr@2: @param aIndex williamr@2: @param aSubConnectionInfo An appropriate SubConnectionInfo-derived class; on return, this is filled in williamr@2: */ williamr@2: virtual TInt GetSubConnectionInfo(TUint aIndex, TDes8& aSubConnectionInfo)=0; williamr@2: williamr@2: /** williamr@2: Get information about a subconnection specifed by its unique id williamr@2: williamr@2: @param aSubConnectionInfo An appropriate SubConnectionInfo-derived class containing a valid TSubConnectionUniqueId; on return, this is filled in williamr@2: */ williamr@2: virtual TInt GetSubConnectionInfo(TDes8& aSubConnectionInfo)=0; williamr@2: williamr@2: /** williamr@2: Register for all subconnection notifications williamr@2: */ williamr@2: virtual TInt AllSubConnectionNotificationEnable()=0; williamr@2: williamr@2: /** williamr@2: Cancel registration for AllSubConnectionNotification williamr@2: */ williamr@2: virtual TInt CancelAllSubConnectionNotification()=0; williamr@2: williamr@2: /** williamr@2: Find out how much data has been sent and received williamr@2: williamr@2: @param aSubConnectionUniqueId The id of the subconnection to which this request refers williamr@2: @param aUplinkVolume The total number of bytes sent on this subconnection williamr@2: @param aDownlinkVolume The total number of bytes received on this subconnection williamr@2: */ williamr@2: virtual TInt DataTransferred(TSubConnectionUniqueId aSubConnectionUniqueId, TUint& aUplinkVolume, TUint& aDownlinkVolume)=0; williamr@2: williamr@2: /** williamr@2: Cancel a request for the amount of data sent and received williamr@2: williamr@2: @param aSubConnectionUniqueId The id of the subconnection that this request refers to williamr@2: @note At present this method is never called, as this is a synchronous operation on the server side williamr@2: */ williamr@2: virtual TInt DataTransferredCancel(TSubConnectionUniqueId aSubConnectionUniqueId)=0; williamr@2: williamr@2: /** williamr@2: Make a request for notifications about data sent at the specifed granularity on a specified subconnection williamr@2: williamr@2: @param aSubConnectionUniqueId The id of the subconnection to which this request refers williamr@2: @param aUplinkGranularity The granularity in bytes at which notifications should be sent williamr@2: */ williamr@2: virtual TInt SetDataSentNotificationGranularity(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aUplinkGranularity)=0; williamr@2: williamr@2: /** williamr@2: Cancel a request for notifications about data sent on a specified subconnection williamr@2: williamr@2: @param aSubConnectionUniqueId The id of the subconnection to which this request refers williamr@2: */ williamr@2: virtual TInt DataSentNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId)=0; williamr@2: williamr@2: /** williamr@2: Make a request for notifications about data received at the specifed granularity on a specified subconnection williamr@2: williamr@2: @param aSubConnectionUniqueId The id of the subconnection to which this request refers williamr@2: @param aDownlinkGranularity The granularity in bytes at which notifications should be sent williamr@2: */ williamr@2: virtual TInt SetDataReceivedNotificationGranularity(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aDownlinkGranularity)=0; williamr@2: williamr@2: /** williamr@2: Cancel a request for notifications about data received on a specified subconnection williamr@2: williamr@2: @param aSubConnectionUniqueId The id of the subconnection to which this request refers williamr@2: */ williamr@2: virtual TInt DataReceivedNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId)=0; williamr@2: williamr@2: /** williamr@2: * SendIoctlMessageL forwards Ioctl request to the target williamr@2: * Important - message has to be completed by the target. There is no notification back williamr@2: * to the caller => meant for forwarding Ioctl messages the forwarding path is not really williamr@2: * interested in apart from "routing informations" williamr@2: * @param aMessage forwarded message (it's the caller's resposibility to forward just Ioctl williamr@2: * messages) williamr@2: */ williamr@2: virtual void SendIoctlMessageL(const RMessage2& aMessage) = 0; williamr@2: virtual void SendCancelIoctl() = 0; williamr@2: williamr@2: //PREQ399_REMOVE williamr@2: #ifdef SYMBIAN_NETWORKING_3GPPDEFAULTQOS williamr@2: virtual CNifIfBase* GetNif(TInt aIndex) = 0; williamr@2: #endif williamr@2: //SYMBIAN_NETWORKING_3GPPDEFAULTQOS //PREQ399_REMOVE williamr@2: williamr@2: IMPORT_C void GetBoolSettingL(const TDesC& aSettingName, TBool& aValue ); williamr@2: IMPORT_C void GetBoolSettingL(const TDesC& aSettingName, TBool& aValue, const RMessagePtr2* aMessage ); williamr@2: IMPORT_C void GetDes16SettingL(const TDesC& aSettingName, TDes16& aValue ); williamr@2: IMPORT_C void GetDes16SettingL(const TDesC& aSettingName, TDes16& aValue, const RMessagePtr2* aMessage ); williamr@2: IMPORT_C void GetDes8SettingL(const TDesC& aSettingName, TDes8& aValue ); williamr@2: IMPORT_C void GetDes8SettingL(const TDesC& aSettingName, TDes8& aValue, const RMessagePtr2* aMessage ); williamr@2: IMPORT_C void GetIntSettingL(const TDesC& aSettingName, TUint32& aValue ); williamr@2: IMPORT_C void GetIntSettingL(const TDesC& aSettingName, TUint32& aValue, const RMessagePtr2* aMessage ); williamr@2: IMPORT_C HBufC* GetLongDesSettingLC(const TDesC& aSettingName, const RMessagePtr2* aMessage ); williamr@2: IMPORT_C HBufC* GetLongDesSettingLC(const TDesC& aSettingName ); williamr@2: williamr@2: protected: williamr@2: IMPORT_C CConnectionProvdBase(TUint aId); williamr@2: IMPORT_C void CreateL(MConnectionNotify* aConnection); williamr@2: williamr@2: virtual void DoGetIntSettingL(const TDesC& aSettingName, TUint32& aValue, const RMessagePtr2* aMessage ) = 0; williamr@2: virtual void DoGetBoolSettingL(const TDesC& aSettingName, TBool& aValue, const RMessagePtr2* aMessage ) = 0; williamr@2: virtual void DoGetDes8SettingL(const TDesC& aSettingName, TDes8& aValue, const RMessagePtr2* aMessage ) = 0; williamr@2: virtual void DoGetDes16SettingL(const TDesC& aSettingName, TDes16& aValue, const RMessagePtr2* aMessage ) = 0; williamr@2: virtual HBufC* DoGetLongDesSettingLC(const TDesC& aSettingName, const RMessagePtr2* aMessage ) = 0; williamr@2: williamr@2: protected: williamr@2: MConnectionNotify* iConnection; williamr@2: RPointerArray iSubConnProviders; williamr@2: TUint iId; williamr@2: }; williamr@2: williamr@2: class CProtocolFamilyBase; williamr@2: class RMBufChain; williamr@2: class CProtocolRef; williamr@2: class CProtocolBase : public CBase williamr@2: /** Protocols created by protocol families must be instances of sub-classes of williamr@2: the abstract CProtocolBase. williamr@2: @publishedPartner williamr@2: @released Since v5.0 */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: friend class CProtocolRef; williamr@2: williamr@2: public: williamr@2: IMPORT_C virtual CServProviderBase* NewSAPL(TUint aProtocol); williamr@2: IMPORT_C virtual CHostResolvProvdBase* NewHostResolverL(); williamr@2: IMPORT_C virtual CServiceResolvProvdBase* NewServiceResolverL(); williamr@2: IMPORT_C virtual CNetDBProvdBase* NewNetDatabaseL(); williamr@2: IMPORT_C CProtocolBase(); williamr@2: IMPORT_C virtual ~CProtocolBase(); williamr@2: CProtocolFamilyBase* ProtocolFamily(); williamr@2: IMPORT_C virtual void Close(); williamr@2: IMPORT_C virtual void Open(); williamr@2: IMPORT_C virtual void CloseNow(); williamr@2: IMPORT_C virtual void StartSending(CProtocolBase* aProtocol); // Up williamr@2: IMPORT_C TPtrC Tag(); williamr@2: IMPORT_C virtual void InitL(TDesC& aTag); // From ProtocolManager before all binding. williamr@2: IMPORT_C virtual void StartL(); // From Protocol Manager - after all binding williamr@2: IMPORT_C virtual void BindL(CProtocolBase* protocol, TUint id); // From higher protocol williamr@2: IMPORT_C virtual void BindToL(CProtocolBase* protocol); // From Protocol Manager williamr@2: IMPORT_C virtual TInt Send(RMBufChain& aPDU,CProtocolBase* aSourceProtocol=NULL); // Down williamr@2: IMPORT_C virtual TInt Send(TDes8& aPDU,TSockAddr* to,TSockAddr* from=NULL,CProtocolBase* aSourceProtocol=NULL); // Done williamr@2: IMPORT_C virtual void Process(RMBufChain&,CProtocolBase* aSourceProtocol=NULL); // Up williamr@2: IMPORT_C virtual void Process(TDes8& aPDU,TSockAddr* from,TSockAddr* to=NULL,CProtocolBase* aSourceProtocol=NULL); // Up williamr@2: IMPORT_C virtual TInt GetOption(TUint level,TUint name,TDes8& option,CProtocolBase* aSourceProtocol=NULL); // Down williamr@2: IMPORT_C virtual TInt SetOption(TUint level,TUint name,const TDesC8& option,CProtocolBase* aSourceProtocol=NULL); // Down williamr@2: IMPORT_C virtual void Error(TInt anError,CProtocolBase* aSourceProtocol=NULL); // Up williamr@2: williamr@2: // Pure virtual williamr@2: /** Fills in the passed TServerProtocolDesc with data describing the protocol. williamr@2: williamr@2: @param aProtocolDesc Protocol description object to fill in */ williamr@2: virtual void Identify(TServerProtocolDesc* aProtocolDesc)const =0; // from anyone. williamr@2: williamr@2: inline TInt RefCount() const; williamr@2: protected: williamr@2: IMPORT_C void CanClose(); // Up williamr@2: private: williamr@2: void TryDelete(); williamr@2: protected: williamr@2: // TProtocolDesc iDesc; williamr@2: private: williamr@2: CProtocolRef* iManagerRef; williamr@2: TInt iRefCount; williamr@2: }; williamr@2: williamr@2: class CProtocolFamilyRef; williamr@2: class CLibUnloader; williamr@2: class CConnection; williamr@2: class CConnectionProvdBase; williamr@2: class CProtocolFamilyBase : public CBase williamr@2: /** Defines the interface for protocol families. williamr@2: williamr@2: Protocol families must: williamr@2: williamr@2: be able to identify the protocols which they can create williamr@2: williamr@2: be able to create instances of protocol objects for all the protocols they williamr@2: advertise williamr@2: williamr@2: @publishedPartner williamr@2: @released */ williamr@2: { williamr@2: friend class ProtocolManager; williamr@2: friend class CProtocolFamilyRef; williamr@2: public: williamr@2: IMPORT_C virtual ~CProtocolFamilyBase(); williamr@2: IMPORT_C CProtocolFamilyBase(); williamr@2: IMPORT_C virtual void Close(); williamr@2: IMPORT_C virtual void Open(); williamr@2: IMPORT_C virtual TInt Remove(); williamr@2: IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const; williamr@2: williamr@2: void SetLibraryL(RLibrary& aLib); williamr@2: williamr@2: // Pure virtual williamr@2: /** Initialises a protocol family. williamr@2: williamr@2: After the CProtocolFamilyBase-derived object has been created, the first function williamr@2: called by the socket server on that object is Install(). It is at this point that the williamr@2: CProtocolFamilyBase-derived object should perform any initialisation which it needs. williamr@2: williamr@2: @return System-wide error code */ williamr@2: virtual TInt Install()=0; williamr@2: /** Creates a new protocol object. williamr@2: williamr@2: During socket creation, after the socket server has called Open() on a protocol family, williamr@2: it next calls this function to create an instance of a CProtocolBase-derived object - williamr@2: the protocol itself. williamr@2: williamr@2: @param aSockType A supported socket type for the protocol family as advertised williamr@2: in the protocol list. williamr@2: @param aProtocol A protocol number specifying a protocol returned by ProtocolList(). williamr@2: williamr@2: @return A protocol, or NULL if some error has prevented the protocol from being williamr@2: created. */ williamr@2: virtual CProtocolBase * NewProtocolL(TUint aSockType,TUint aProtocol)=0; williamr@2: /** Gets a list of supported protocols. williamr@2: williamr@2: Called during initialisation, directly after Install(). ProtocolList() returns a list williamr@2: of all the protocols in the protocol family. The protocol family object should allocate williamr@2: memory to hold an array of TServerProtocolDesc structures. This function should then williamr@2: fill them in and return the pointer and a count of the number of protocols williamr@2: supported. The socket server caches this information, so that it does not williamr@2: need to keep the protocol module loaded. williamr@2: williamr@2: The protocol family should not attempt to use static data (which it can't) williamr@2: or to free this memory later, as the socket server will automatically free williamr@2: this storage. williamr@2: williamr@2: @param aProtocolList This pointer is set to point to memory allocated by the williamr@2: protocol family and filled in as described above williamr@2: @return The number of protocols in this protocol family (and entries in the williamr@2: list of protocols) */ williamr@2: virtual TUint ProtocolList(TServerProtocolDesc*& aProtocolList)=0; williamr@2: williamr@2: inline TInt RefCount() const; williamr@2: williamr@2: protected: williamr@2: williamr@2: /** Contains version information */ williamr@2: TVersion iVersion; williamr@2: private: williamr@2: TInt iRefCount; williamr@2: CLibUnloader* iLibUnloader; williamr@2: CProtocolFamilyRef* iManagerRef; williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: typedef CProtocolFamilyBase* (*TProtocolNew)(); williamr@2: williamr@2: williamr@2: class SocketTimer williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static void Queue(TTimeIntervalMicroSeconds32 aTimeInMicroSeconds,TDeltaTimerEntry& aTimer); williamr@2: IMPORT_C static void Remove(TDeltaTimerEntry& aTimer); williamr@2: }; williamr@2: williamr@2: class SocketServExt williamr@2: /** williamr@2: @internalTechnology williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CProtocolBase* FindAndLoadProtocolL(const TDesC& aName, TProtocolType aType=ENormalProtocol); williamr@2: IMPORT_C static CProtocolBase* FindAndLoadProtocolL(TUint aAddrFamily, TUint aSockType, TUint aProtocol); williamr@2: IMPORT_C static void InstallExtensionL(const TDesC& aDllName, const TDesC& aArgs); williamr@2: IMPORT_C static void OpenSession(); williamr@2: IMPORT_C static void CloseSession(); williamr@2: IMPORT_C static void InstallSchedulerWaitHook(TCallBack* aCall); williamr@2: }; williamr@2: williamr@2: class CSocketServExtRef; williamr@2: class CSocketServExtBase : public CBase williamr@2: /** williamr@2: Base class for extensions williamr@2: williamr@2: @internalTechnology williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C virtual ~CSocketServExtBase(); williamr@2: protected: williamr@2: IMPORT_C CSocketServExtBase(); williamr@2: public: williamr@2: virtual void InstallL(const TDesC& aArgs)=0; williamr@2: virtual void Remove()=0; williamr@2: // williamr@2: private: williamr@2: friend class CSocketServExtRef; williamr@2: CSocketServExtRef* iExtRef; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: KSoOwnerInfo williamr@2: williamr@2: Definition for internal SetOption() from ESock to Provider to communicate williamr@2: socket owner information. williamr@2: williamr@2: @internalTechnology williamr@2: @released williamr@2: */ williamr@2: const TInt KSOLProvider = 2; williamr@2: williamr@2: const TUint KSoOwnerInfo = 1 | KSocketInternalOptionBit; williamr@2: williamr@2: class TSoOwnerInfo williamr@2: /** williamr@2: Class used to communicate the owner of a socket from ESOCK to Provider. williamr@2: @internalTechnology williamr@2: */ williamr@2: { williamr@2: public: williamr@2: TUidType iUid; williamr@2: }; williamr@2: williamr@2: /** williamr@2: KSoConnectionInfo williamr@2: williamr@2: Definition for internal SetOption() from ESock to Provider to communicate williamr@2: connection selection information. Note that the information is opaque williamr@2: to ESock and comes from Nifman in the form of a TSoIfConnectionInfo class. williamr@2: @internalTechnology williamr@2: */ williamr@2: const TInt KSoConnectionInfo = 2 | KSocketInternalOptionBit; williamr@2: williamr@2: /** williamr@2: UID of Protocol Modules williamr@2: @publishedPartner williamr@2: @released */ williamr@2: const TInt KUidProtocolModule = 0x1000004A; williamr@2: williamr@2: /** williamr@2: UID of Unicode Protocol Modules williamr@2: williamr@2: @internalTechnology williamr@2: */ williamr@2: const TInt KUidUnicodeProtocolModule = 0x10003d38; williamr@2: williamr@2: /** @internalTechnology */ williamr@2: const TInt KUidEsockExtension = 0x10000387; williamr@2: williamr@2: #include williamr@2: williamr@2: #endif