CServProviderBase Class Reference

class CServProviderBase : public CBase

Service Access Point.

Provides transport services to a single protocol. Several of the calls to CServProviderBase have pre-conditions attached to them - for example a connection oriented protocol must have its local address set (either by a SetLocalName() or AutoBind() ) before it is opened. If the socket server calls the CServProviderBase in such an erroneous way, the protocol should panic.

Since 5.0

Inherits from

Public Member Functions
CServProviderBase ()
~CServProviderBase ()
void ActiveOpen ()
void ActiveOpen (const TDesC8 &)
void AutoBind ()
void CancelIoctl ( TUint , TUint )
IMPORT_C void GetData ( TDes8 &, TUint , TSockAddr *)
IMPORT_C TInt GetData ( RMBufChain &, TUint , TUint , TSockAddr *)
TInt GetOption ( TUint , TUint , TDes8 &)
void Ioctl ( TUint , TUint , TDes8 *)
IMPORT_C void JoinSubConnectionL ( ESock::CSubConnectionProviderBase &)
IMPORT_C void LeaveSubConnection ( ESock::CSubConnectionProviderBase &)
void LocalName ( TSockAddr &)
TInt PassiveOpen ( TUint )
TInt PassiveOpen ( TUint , const TDesC8 &)
void RemName ( TSockAddr &)
IMPORT_C TInt SecurityCheck ( MProvdSecurityChecker *)
TInt SetLocalName ( TSockAddr &)
IMPORT_C void SetNotify ( MSocketNotify *)
TInt SetOption ( TUint , TUint , const TDesC8 &)
TInt SetRemName ( TSockAddr &)
IMPORT_C void SetSockType ( TUint )
void Shutdown ( TCloseType )
void Shutdown ( TCloseType , const TDesC8 &)
IMPORT_C TUint SockType ()
void Start ()
IMPORT_C TUint Write (const TDesC8 &, TUint , TSockAddr *)
IMPORT_C TInt Write ( RMBufChain &, TUint , TSockAddr *)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TCloseType { ENormal , EStopInput , EStopOutput , EImmediate }
Protected Attributes
MSocketNotify * iSocket
Private Attributes
TUint iSockType
HBufC8 * iV1ShimDataIn
HBufC8 * iV1ShimDataOut

Constructor & Destructor Documentation

CServProviderBase()

IMPORT_C CServProviderBase ( )

~CServProviderBase()

IMPORT_C ~CServProviderBase ( ) [virtual]

Member Functions Documentation

ActiveOpen()

void ActiveOpen ( ) [pure virtual]

ActiveOpen(const TDesC8 &)

void ActiveOpen ( const TDesC8 & aConnectionData ) [pure virtual]

Initiates a connection operation - this means that it tells the protocol to attempt to connect to a peer. It is called by the socket server in response to a connect request from a client.

This version of the function has user data in the connection frame.

Only ever called on connection-oriented sockets. Such a socket should always have both the local address and the remote address specified before this function is called. If this is not the case then the protocol should panic.

When a connection has completed, the protocol should call ConnectComplete() on its TNotify. If an error occurs during connection the protocol should not call ConnectComplete() at all; instead it should call Error().

Parameters

const TDesC8 & aConnectionData If the protocol supports user specified connection data, then it will be held in this buffer.

AutoBind()

void AutoBind ( ) [pure virtual]

Specifies that the protocol should choose a local address for the service access point itself.

CancelIoctl(TUint, TUint)

void CancelIoctl ( TUint aLevel,
TUint aName
) [pure virtual]

Cancels an outstanding Ioctl call. You are guaranteed only to have one outstanding at once.

Parameters

TUint aLevel IOCTL level.
TUint aName IOCTL name.

GetData(TDes8 &, TUint, TSockAddr *)

IMPORT_C void GetData ( TDes8 & aDesc,
TUint options,
TSockAddr * anAddr = NULL
) [virtual]

Gets data which the protocol has indicated is waiting in its buffers using the NewData up-call on the MSocketNotify .

GetData() will only ever be called for as much data as the protocol has specified it can process using the NewData up-call.

For stream oriented protocols GetData() should fill the descriptor with data from the stream. On a datagram protocol GetData() should copy one datagram into the descriptor and set the length of the descriptor. If a full datagram will not fit into the supplied descriptor, the overflow should be discarded.

anAddr should be filled in by the protocol with the address of where the data came from.

Parameters

TDes8 & aDesc The buffer for data.
TUint options
TSockAddr * anAddr = NULL Address where the data came from.

GetData(RMBufChain &, TUint, TUint, TSockAddr *)

IMPORT_C TInt GetData ( RMBufChain & aData,
TUint aLength,
TUint aOptions,
TSockAddr * anAddr = NULL
) [virtual]

Gets data which the protocol has indicated is waiting in its buffers using the NewData up-call on the MSocketNotify .

GetData() will only ever be called for as much data as the protocol has specified it can process using the NewData up-call.

For stream oriented protocols GetData() should fill the descriptor with data from the stream. On a datagram protocol GetData() should copy one datagram into the descriptor and set the length of the descriptor. If a full datagram will not fit into the supplied descriptor, the overflow should be discarded.

anAddr should be filled in by the protocol with the address of where the data came from.

Parameters

RMBufChain & aData
TUint aLength
TUint aOptions Protocol specific options.
TSockAddr * anAddr = NULL Address where the data came from.

GetOption(TUint, TUint, TDes8 &)

TInt GetOption ( TUint level,
TUint name,
TDes8 & anOption
) const [pure virtual]

Gets some protocol specific option when called by the socket server on behalf of a client. A protocol may pass the request down a protocol stack (to protocols it is bound to) using the GetOption() function of CProtocolBase .

Parameters

TUint level
TUint name
TDes8 & anOption Option data.

Ioctl(TUint, TUint, TDes8 *)

void Ioctl ( TUint level,
TUint name,
TDes8 * anOption
) [pure virtual]

Performs some protocol specific IO control.

Note:

If this function is called erroneously, the protocol should call Error() on the socket. If an Ioctl call is already outstanding, the client will be panicked with the value ETwoIoctls.

Parameters

TUint level
TUint name
TDes8 * anOption Option data.

JoinSubConnectionL(ESock::CSubConnectionProviderBase &)

IMPORT_C void JoinSubConnectionL ( ESock::CSubConnectionProviderBase & aSubConnProvider ) [virtual]

Parameters

ESock::CSubConnectionProviderBase & aSubConnProvider

LeaveSubConnection(ESock::CSubConnectionProviderBase &)

IMPORT_C void LeaveSubConnection ( ESock::CSubConnectionProviderBase & aSubConnProvider ) [virtual]

Parameters

ESock::CSubConnectionProviderBase & aSubConnProvider

LocalName(TSockAddr &)

void LocalName ( TSockAddr & anAddr ) const [pure virtual]

Gets the local name (address) of the socket service provider entity. The format of the data in the TSockAddr object is defined by individual protocols.

The local address is the address of the local machine plus a local port number. Generally only the port number is important, unless you have two IP interfaces, for example.

Parameters

TSockAddr & anAddr The address to be filled in

PassiveOpen(TUint)

TInt PassiveOpen ( TUint aQueSize ) [pure virtual]

Tells the protocol to start waiting for an incoming connection request on this socket (i.e. port). It is called by the socket server in response to a listen request from a client.

Only ever called on connection-oriented sockets. Such a socket should always have both the local address and the remote address specified before this function is called. If this is not the case, then the protocol should panic.

The aQue parameter is the number of sockets which can be waiting for an outstanding Start after calling ConnectComplete(). The protocol should keep a count of sockets in this state - incrementing a variable in ConnectComplete(), and decrementing it in Start() .

When a connection has completed, the protocol should call ConnectComplete() on its TNotify. If an error occurs during connection the protocol should not call ConnectComplete() at all; instead it should call Error().

Parameters

TUint aQueSize Size of connect queue.

PassiveOpen(TUint, const TDesC8 &)

TInt PassiveOpen ( TUint aQueSize,
const TDesC8 & aConnectionData
) [pure virtual]

Tells the protocol to start waiting for an incoming connection request on this socket (i.e. port). It is called by the socket server in response to a listen request from a client.

This version of the function has user data in the connection frame.

Only ever called on connection-oriented sockets. Such a socket should always have both the local address and the remote address specified before this function is called. If this is not the case then the protocol should panic.

The aQue parameter is the number of sockets which can be waiting for an outstanding Start after calling ConnectComplete(). The protocol should keep a count of sockets in this state - incrementing a variable in ConnectComplete(), and decrementing it in Start() .

When a connection has completed the protocol should call ConnectComplete() on its TNotify. If an error occurs during connection the protocol should not call ConnectComplete() at all; instead it should call Error().

Parameters

TUint aQueSize size of connect queue
const TDesC8 & aConnectionData if the protocol supports user specified connection data then it will be held in this buffer.

RemName(TSockAddr &)

void RemName ( TSockAddr & anAddr ) const [pure virtual]

Gets the remote name (address) of the socket service provider entity. The format of the data in the TSockAddr object is defined by individual protocols.

A remote address is either the address you're sending data to (non connection-oriented sockets)* or the remote end of the connection. It is the address of the remote machine (your peer in the network) plus a port number.

Note:

RemName is only meaningful if the socket server client has called Connect() to set up a default address for SendTo(). This function will only be called on the protocol if this is the case.

Parameters

TSockAddr & anAddr The address to be filled in

SecurityCheck(MProvdSecurityChecker *)

IMPORT_C TInt SecurityCheck ( MProvdSecurityChecker * aSecurityChecker ) [virtual]

Use the class instance argument to perform security policy checks on the originating client process.

This method is called when a SAP is created and when a socket is transferred between sessions. The SAP is required to check whether the originating client process has enough privileges to request services from the SAP. The MProvdSecurityChecker class instance is used to perform security policy checks. The SAP may choose to perform a security policy check in its SecurityCheck(...) method, or it may choose to store the MProvdSecurityChecker class instance argument and perform checking later (i.e. when subsequent SAP methods are called).

Ask the socket provider to perform a security policy check on the originating process (default implementation).

Called when a socket is opened or transferred, and after the PRT presents a new accepting socket to ESOCK.

Parameters

MProvdSecurityChecker * aSecurityChecker Pointer to class used by SAP to perform security checks on the client process. This pointer becomes invalid when the SAP is destroyed or detached.

SetLocalName(TSockAddr &)

TInt SetLocalName ( TSockAddr & anAddr ) [pure virtual]

Sets the local name (address) of the socket service provider entity. The format of the data in the TSockAddr object is defined by individual protocols.

Parameters

TSockAddr & anAddr The address

SetNotify(MSocketNotify *)

IMPORT_C void SetNotify ( MSocketNotify * aSocket ) [virtual]

Set notification for transport services to a single protocol

Parameters

MSocketNotify * aSocket

SetOption(TUint, TUint, const TDesC8 &)

TInt SetOption ( TUint level,
TUint name,
const TDesC8 & anOption
) [pure virtual]

Sets some protocol specific option when called by the socket server on behalf of a client. A protocol may pass the request down a protocol stack (to protocols it is bound to) using the SetOption() function of CProtocolBase .

Parameters

TUint level
TUint name
const TDesC8 & anOption Option data.

SetRemName(TSockAddr &)

TInt SetRemName ( TSockAddr & anAddr ) [pure virtual]

Sets the remote name (address) of the socket service provider entity. The format of the data in the TSockAddr object is defined by individual protocols.

Parameters

TSockAddr & anAddr The address

SetSockType(TUint)

IMPORT_C void SetSockType ( TUint aSockType ) [virtual]

Parameters

TUint aSockType

Shutdown(TCloseType)

void Shutdown ( TCloseType option ) [pure virtual]

Terminates a connection (or closes a non connection-oriented socket down).

The value of the option argument specifies the type of processing which will be required of the protocol after this function is called.

Normally, when the socket server has called Shutdown() for a socket, it will wait for the socket to call CanClose() before destroying the CServProviderBase object. However, if the option argument is EImmediate, the CServProviderBase will be destroyed as soon as Shutdown() returns.

Parameters

TCloseType option The shutdown type.

Shutdown(TCloseType, const TDesC8 &)

void Shutdown ( TCloseType option,
const TDesC8 & aDisconnectionData
) [pure virtual]

Terminates a connection (or closes a non connection-oriented socket down).

The value of the option argument specifies the type of processing which will be required of the protocol after this function is called.

Normally, when the socket server has called Shutdown() for a socket, it will wait for the socket to call CanClose() before destroying the CServProviderBase object. However, if the option argument is EImmediate, the CServProviderBase will be destroyed as soon as Shutdown() returns.

Parameters

TCloseType option The shutdown type.
const TDesC8 & aDisconnectionData If the protocol supports disconnect data, any such data required will be held in this buffer.

SockType()

IMPORT_C TUint SockType ( ) const

Start()

void Start ( ) [pure virtual]

pure virtual Start a service provider.

Write(const TDesC8 &, TUint, TSockAddr *)

IMPORT_C TUint Write ( const TDesC8 & aDesc,
TUint options,
TSockAddr * anAddr = NULL
) [virtual]

Sends data onto the network via the protocol.

Connection-oriented sockets must be in a connected state (that is ConnectComplete() has been called on their MSocketNotify before Write() is called).

The socket server keeps track of how much data is waiting and then tries to send it all until the protocol tells it to hold off by returning 0 (datagram sockets) or 'less than all data consumed' (stream sockets) to Write() . The protocol should call CanSend() when it is ready to send more data.

anAddr is the address to write the data to. Connection oriented sockets always use the default value.

Parameters

const TDesC8 & aDesc The data to be sent.
TUint options
TSockAddr * anAddr = NULL Address to write the data to.

Write(RMBufChain &, TUint, TSockAddr *)

IMPORT_C TInt Write ( RMBufChain & aData,
TUint aOptions,
TSockAddr * anAddr = NULL
) [virtual]

Sends data onto the network via the protocol.

Connection-oriented sockets must be in a connected state (that is ConnectComplete() has been called on their MSocketNotify before Write() is called).

The socket server keeps track of how much data is waiting and then tries to send it all until the protocol tells it to hold off by returning 0 (datagram sockets) or 'less than all data consumed' (stream sockets) to Write() . The protocol should call CanSend() when it is ready to send more data.

anAddr is the address to write the data to. Connection oriented sockets always use the default value.

Parameters

RMBufChain & aData The data to be sent.
TUint aOptions Protocol specific options.
TSockAddr * anAddr = NULL Address to write the data to.

Member Enumerations Documentation

Enum TCloseType

Describes the behaviour the SAP should take on shutdown.

Enumerators

ENormal
EStopInput
EStopOutput
EImmediate

Member Data Documentation

TUint iSockType

TUint iSockType [private]

MSocketNotify * iSocket

MSocketNotify * iSocket [protected]

On socket creation, the socket server sets this member to point to a server notification interface.

HBufC8 * iV1ShimDataIn

HBufC8 * iV1ShimDataIn [private]

HBufC8 * iV1ShimDataOut

HBufC8 * iV1ShimDataOut [private]