RSocketServ Class Reference

class RSocketServ : public RCommsSession

Provides the Connect() function to create an IPC communication channel to the socket server. To close the channel RHandleBase provides a RHandleBase::Close() function.

The prime use for instances of RSocketServ is to establish subsession communications for RSocket , RHostResolver , RNetDatabase and RConnection . Any of the resources which are open using the session are automatically closed when the session is terminated, however it is more appropriate to issue a Close() on each subsession object before closing the session.

The following operations are also provided:

NumProtocols() - enumerates the number of protocols of which the socket server is currently aware.

GetProtocolInfo() /FindProtocol() - return information about a specific protocol.

StartProtocol() - loads a protocol asynchronously.

Note:

This class is not intended for user derivation.

Public Member Functions
RSocketServ ()
IMPORT_C void ClearExclusiveMode ()
IMPORT_C TInt Connect ( TUint )
IMPORT_C TInt Connect (const TSessionPref &, TUint )
IMPORT_C TInt FindProtocol (const TProtocolName &, TProtocolDesc &)
IMPORT_C TInt GetProtocolInfo ( TUint , TProtocolDesc &)
IMPORT_C TInt InstallExtension (const TDesC &, const TDesC &)
IMPORT_C TInt NumProtocols ( TUint &)
IMPORT_C void SetExclusiveMode ( TRequestStatus &)
IMPORT_C void StartProtocol ( TUint , TUint , TUint , TRequestStatus &)
IMPORT_C void StopProtocol ( TUint , TUint , TUint , TRequestStatus &)
IMPORT_C TVersion Version ()
IMPORT_C TBool __DbgCheckFailNext ()
IMPORT_C TInt __DbgCheckHeap ( TInt )
IMPORT_C TInt __DbgCheckMbuf ( TInt )
IMPORT_C TInt __DbgControl (const ESockDebug::TControlMsg &)
IMPORT_C TInt __DbgFailNext ( TInt )
IMPORT_C TInt __DbgFailNextMbuf ( TInt )
IMPORT_C TInt __DbgMarkEnd ( TInt )
IMPORT_C TInt __DbgMarkHeap ()
IMPORT_C TInt __DbgMbufFreeSpace ()
IMPORT_C TInt __DbgMbufTotalSpace ()
IMPORT_C TInt __DbgSetMbufPoolLimit ( TInt )
Inherited Functions
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::Close()
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RSessionBase::CreateSession(RServer2,const TVersion &)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *)
RSessionBase::Open(RMessagePtr2,TInt,TOwnerType)
RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Open(TInt,TOwnerType)
RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Send(TInt)const
RSessionBase::Send(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt)const
RSessionBase::SendReceive(TInt,TRequestStatus &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSessionBase::SetReturnedHandle(TInt)
RSessionBase::SetReturnedHandle(TInt,RHandleBase &)
RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &)
RSessionBase::ShareAuto()
RSessionBase::ShareProtected()
Inherited Enumerations
RHandleBase:TAttributes
RSessionBase:TAttachMode
Inherited Attributes
RHandleBase::iHandle

Constructor & Destructor Documentation

RSocketServ()

IMPORT_C RSocketServ ( )

Default Constructor

Member Functions Documentation

ClearExclusiveMode()

IMPORT_C void ClearExclusiveMode ( )

Clear exclusive mode for this session PLEASE NOTE: This API is currently unsupported, calling it will always return KErrNone but without actually doing anything.

Connect(TUint)

IMPORT_C TInt Connect ( TUint aMessageSlots = ( TUint )-1 )

Opens a session to the socket server.

Each outstanding asynchronous request made upon the session (typically via a subsession such as RSocket ) requires a message slot. If there is no free slot the request is immediately completed with KErrServerBusy. If a client specifies a fixed number of slots then they form an inelastic pool exclusive to the session. Alternatively a client can specify -1 to use the global free message pool, which can grow upon demand but has poorer time bounds and can in principle fail any request. For most clients the global pool will be appropriate since it removes the need to accurately determine the worst case size.

Note that in previous releases the default value was KESockDefaultMessageSlots (8).

RHandleBase::Close() should be called once the session is no longer required. All resources which are opened using the session will be automatically closed when the session terminates.

When the last session which has open resources for a protocol is closed a protocol module will be unloaded automatically by the socket server.

Parameters

TUint aMessageSlots = ( TUint )-1 The number of message slots required. If not specified then -1 to use the global pool of free messages.

Connect(const TSessionPref &, TUint)

IMPORT_C TInt Connect ( const TSessionPref & aPref,
TUint aMessageSlots = ( TUint )-1
)

Opens a session to the socket server.

By providing session prefs the client states what services they require of the server. This allows the server to configure the client connection in an optimal manner. Such a configuration may not support all normal abilities of a session. For example a connection opened specifying KAfInet for the address family will be able to create TCP sockets but might not be able to create SMS sockets.

Each outstanding asynchronous request made upon the session (typically via a subsession such as RSocket ) requires a message slot. If there is no free slot the request is immediately completed with KErrServerBusy. If a client specifies a fixed number of slots then they form an inelastic pool exclusive to the session. Alternatively a client can specify -1 to use the global free message pool, which can grow upon demand but has poorer time bounds and can in principle fail any request. For most clients the global pool will be appropriate since it removes the need to accurately determine the worst case size.

Note that in previous releases the default value was KESockDefaultMessageSlots (8).

RHandleBase::Close() should be called once the session is no longer required. All resources which are opened using the session will be automatically closed when the session terminates.

When the last session which has open resources for a protocol is closed a protocol module will be unloaded automatically by the socket server.

Parameters

const TSessionPref & aPref
TUint aMessageSlots = ( TUint )-1

FindProtocol(const TProtocolName &, TProtocolDesc &)

IMPORT_C TInt FindProtocol ( const TProtocolName & aName,
TProtocolDesc & aProtocol
)

Gets information about a specific protocol, identified by it's name.

There is no wildcard support.

Parameters

const TProtocolName & aName Typed descriptor which identifies a protocol name.
TProtocolDesc & aProtocol A protocol description type to hold protocol information.

GetProtocolInfo(TUint, TProtocolDesc &)

IMPORT_C TInt GetProtocolInfo ( TUint anIndex,
TProtocolDesc & aProtocol
)

Gets information about a specific protocol.

Parameters

TUint anIndex Index of required protocol description.
TProtocolDesc & aProtocol A protocol description type to hold protocol information.

InstallExtension(const TDesC &, const TDesC &)

IMPORT_C TInt InstallExtension ( const TDesC & aDllName,
const TDesC & aArgs =  TPtrC ()
)

Install an Esock Extension. PLEASE NOTE: This API is currently unsupported, calling it will always return KErrNotSupported.

capability
NetworkControl Loading extensions to Esock will be behavioural changing and must be restricted to privileged apps
Because it always return KErrNotSupported thus useless

Parameters

const TDesC & aDllName DllName for Esock Extension
const TDesC & aArgs =  TPtrC () argument for Esock Extension

NumProtocols(TUint &)

IMPORT_C TInt NumProtocols ( TUint & aCount )

Gets the number of protocols the socket server is currently aware of.

The count returned can be used in conjunction with GetProtocolInfo() .

Parameters

TUint & aCount The number of protocols is returned in aCount

SetExclusiveMode(TRequestStatus &)

IMPORT_C void SetExclusiveMode ( TRequestStatus & aStatus )

Set this session as the socket server exclusive session. PLEASE NOTE: This API is currently unsupported, calling it will always return KErrNone but without actually doing anything.

capability
NetworkControl Restricting Esock to one session is very dangerous and must be highly restricted

Parameters

TRequestStatus & aStatus On completion, will contain a system-wide error codes

StartProtocol(TUint, TUint, TUint, TRequestStatus &)

IMPORT_C void StartProtocol ( TUint anAddrFamily,
TUint aSockType,
TUint aProtocol,
TRequestStatus & aStatus
)

Loads a specified protocol asynchronously.

The protocol is specified by family, socket type and protocol identifier.

Note that client programs do not normally need to call this function, as loading of a protocol is done automatically by the Sockets Server when a socket of that protocol is opened. Some applications may, however, need to ensure that an open socket call will not take a significant amount of time (e.g. IrCOMM). This function can be called by such applications to preload the protocol.

There is no way to cancel this operation once it has been called.

capability
NetworkControl Protocol starting is a critical operation in the comms process and must be restricted

Parameters

TUint anAddrFamily Integer which identifies a protocol suite.
TUint aSockType Integer which identifies a type of socket.
TUint aProtocol Integer which identifies a specific protocol in a family.
TRequestStatus & aStatus On completion will contain an error code: see the system-wide error codes.

StopProtocol(TUint, TUint, TUint, TRequestStatus &)

IMPORT_C void StopProtocol ( TUint anAddrFamily,
TUint aSockType,
TUint aProtocol,
TRequestStatus & aStatus
)

Unload a protocol asynchronously - note it will fail if there are any resources open

capability
NetworkControl Protocol stopping is a critical operation in the comms process and must be restricted

Parameters

TUint anAddrFamily Integer which identifies a protocol suite
TUint aSockType Integer which identifies a type of socket
TUint aProtocol Integer which identifies a specific protocol in a family
TRequestStatus & aStatus On completion, will contain a system-wide error codes

Version()

IMPORT_C TVersion Version ( ) const

Gets the version number of this client.

__DbgCheckFailNext()

IMPORT_C TBool __DbgCheckFailNext ( ) const

Empty release implementation

__DbgCheckHeap(TInt)

IMPORT_C TInt __DbgCheckHeap ( TInt aCount )

Set a heap mark in the socket server

Parameters

TInt aCount

__DbgCheckMbuf(TInt)

IMPORT_C TInt __DbgCheckMbuf ( TInt asize )

Set the Mbuf pool limit

Parameters

TInt asize

__DbgControl(const ESockDebug::TControlMsg &)

IMPORT_C TInt __DbgControl ( const ESockDebug::TControlMsg & aRequestMsg )

General purpose control message for esock debug, self dispatching messages to be thrown over it

Parameters

const ESockDebug::TControlMsg & aRequestMsg

__DbgFailNext(TInt)

IMPORT_C TInt __DbgFailNext ( TInt aCount )

Set a heap mark in the socket server

Parameters

TInt aCount

__DbgFailNextMbuf(TInt)

IMPORT_C TInt __DbgFailNextMbuf ( TInt aCount )

Set a Mbuf mark in the socket server

Parameters

TInt aCount

__DbgMarkEnd(TInt)

IMPORT_C TInt __DbgMarkEnd ( TInt aCount )

Set a heap mark in the socket server

Parameters

TInt aCount

__DbgMarkHeap()

IMPORT_C TInt __DbgMarkHeap ( )

Set a heap mark in the socket server

__DbgMbufFreeSpace()

IMPORT_C TInt __DbgMbufFreeSpace ( )

Get the amount of free space in the MBuf manager

__DbgMbufTotalSpace()

IMPORT_C TInt __DbgMbufTotalSpace ( )

Get the amount of free space in the MBuf manager

__DbgSetMbufPoolLimit(TInt)

IMPORT_C TInt __DbgSetMbufPoolLimit ( TInt asize )

Set the Mbuf pool limit

Parameters

TInt asize