#include <es_sock.h>
class RSocketServ : public RCommsSession |
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 Attributes | |
---|---|
RHandleBase::iHandle |
Inherited Enumerations | |
---|---|
RHandleBase:TAttributes | |
RSessionBase:TAttachMode |
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.
This class is not intended for user derivation.
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.
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.
Parameter | Description |
---|---|
aMessageSlots | The number of message slots required. If not specified then -1 to use the global pool of free messages. |
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
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.
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
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.
Parameter | Description |
---|---|
aName | Typed descriptor which identifies a protocol name. |
aProtocol | A protocol description type to hold protocol information. |
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
IMPORT_C TInt | GetProtocolInfo | ( | TUint | anIndex, |
TProtocolDesc & | aProtocol | |||
) |
Gets information about a specific protocol.
Parameter | Description |
---|---|
anIndex | Index of required protocol description. |
aProtocol | A protocol description type to hold protocol information. |
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
Install an Esock Extension. PLEASE NOTE: This API is currently unsupported, calling it will always return KErrNotSupported.
Parameter | Description |
---|---|
aDllName | DllName for Esock Extension |
aArgs | argument for Esock Extension |
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
Gets the number of protocols the socket server is currently aware of.
The count returned can be used in conjunction with GetProtocolInfo().
Parameter | Description |
---|---|
aCount | The number of protocols is returned in aCount |
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
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.
Parameter | Description |
---|---|
aStatus | On completion, will contain a system-wide error codes |
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.
Parameter | Description |
---|---|
anAddrFamily | Integer which identifies a protocol suite. |
aSockType | Integer which identifies a type of socket. |
aProtocol | Integer which identifies a specific protocol in a family. |
aStatus | On completion will contain an error code: see the system-wide error codes. |
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
Parameter | Description |
---|---|
anAddrFamily | Integer which identifies a protocol suite |
aSockType | Integer which identifies a type of socket |
aProtocol | Integer which identifies a specific protocol in a family |
aStatus | On completion, will contain a system-wide error codes |
IMPORT_C TVersion | Version | ( | ) | const |
Gets the version number of this client.
Returns: Client side version number
IMPORT_C TInt | __DbgControl | ( | const ESockDebug::TControlMsg & | aRequestMsg | ) |
General purpose control message for esock debug, self dispatching messages to be thrown over it
IMPORT_C TInt | __DbgMbufFreeSpace | ( | ) |
Get the amount of free space in the MBuf manager
IMPORT_C TInt | __DbgMbufTotalSpace | ( | ) |
Get the amount of free space in the MBuf manager