RSessionBase Class Reference

class RSessionBase : public RHandleBase

Client-side handle to a session with a server.

This is the client-side interface through which communication with the server is channelled.

Clients normally define and implement a derived class to provide a richer interface.

Inherits from

Public Member Functions
IMPORT_C TIntOpen(RMessagePtr2, TInt, TOwnerType)
IMPORT_C TIntOpen(RMessagePtr2, TInt, const TSecurityPolicy &, TOwnerType)
IMPORT_C TIntOpen(TInt, TOwnerType)
IMPORT_C TIntOpen(TInt, const TSecurityPolicy &, TOwnerType)
TInt SetReturnedHandle(TInt)
IMPORT_C TIntSetReturnedHandle(TInt, const TSecurityPolicy &)
TInt ShareAuto()
TInt ShareProtected()
Protected Member Functions
TInt CreateSession(const TDesC &, const TVersion &)
IMPORT_C TIntCreateSession(const TDesC &, const TVersion &, TInt)
IMPORT_C TIntCreateSession(const TDesC &, const TVersion &, TInt, TIpcSessionType, const TSecurityPolicy *, TRequestStatus *)
TInt CreateSession(RServer2, const TVersion &)
IMPORT_C TIntCreateSession(RServer2, const TVersion &, TInt)
IMPORT_C TIntCreateSession(RServer2, const TVersion &, TInt, TIpcSessionType, const TSecurityPolicy *, TRequestStatus *)
TInt CreateSession(const TDesC &, const TVersion &, TInt, TRequestStatus *)
TInt Send(TInt, const TIpcArgs &)
TInt Send(TInt)
voidSendReceive(TInt, const TIpcArgs &, TRequestStatus &)
TInt SendReceive(TInt, const TIpcArgs &)
voidSendReceive(TInt, TRequestStatus &)
TInt SendReceive(TInt)
TInt SetReturnedHandle(TInt, RHandleBase &)
Private Member Functions
TInt DoConnect(const TVersion &, TRequestStatus *)
IMPORT_C TIntDoSend(TInt, const TIpcArgs *)
IMPORT_C voidDoSendReceive(TInt, const TIpcArgs *, TRequestStatus &)
IMPORT_C TIntDoSendReceive(TInt, const TIpcArgs *)
IMPORT_C TIntDoShare(TInt)
TInt SendAsync(TInt, const TIpcArgs *, TRequestStatus *)
TInt SendSync(TInt, const TIpcArgs *)
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)
Public Member Enumerations
enumTAttachMode { EExplicitAttach, EAutoAttach }
Inherited Enumerations
RHandleBase:TAttributes
Inherited Attributes
RHandleBase::iHandle

Member Functions Documentation

CreateSession(const TDesC &, const TVersion &)

TInt CreateSession(const TDesC &aServer,
const TVersion &aVersion
)[protected, inline]

Creates a session with a server, specifying no message slots.

It should be called as part of session initialisation in the derived class.

Message slots are not pre-allocated for the session but are taken from a system-wide pool allowing up to 255 asynchronous messages to be outstanding. This raises a risk of failure due to lack of memory and, therefore, this mode of operation is not viable for sessions that make guarantees about the failure modes of asynchonous services.

KErrNone if successful, otherwise one of the other system-wide error codes.

Parameters

const TDesC & aServerThe name of the server with which a session is to be established.
const TVersion & aVersionThe lowest version of the server with which this client is compatible

CreateSession(const TDesC &, const TVersion &, TInt)

IMPORT_C TIntCreateSession(const TDesC &aServer,
const TVersion &aVersion,
TIntaAsyncMessageSlots
)[protected]

Parameters

const TDesC & aServer
const TVersion & aVersion
TInt aAsyncMessageSlots

CreateSession(const TDesC &, const TVersion &, TInt, TIpcSessionType, const TSecurityPolicy *, TRequestStatus *)

IMPORT_C TIntCreateSession(const TDesC &aServer,
const TVersion &aVersion,
TIntaAsyncMessageSlots,
TIpcSessionTypeaType,
const TSecurityPolicy *aPolicy = 0,
TRequestStatus *aStatus = 0
)[protected]

Parameters

const TDesC & aServer
const TVersion & aVersion
TInt aAsyncMessageSlots
TIpcSessionType aType
const TSecurityPolicy * aPolicy = 0
TRequestStatus * aStatus = 0

CreateSession(RServer2, const TVersion &)

TInt CreateSession(RServer2aServer,
const TVersion &aVersion
)[protected, inline]

Creates a session with a server, specifying no message slots.

It should be called as part of session initialisation in the derived class.

Message slots are not pre-allocated for the session but are taken from a system-wide pool allowing up to 255 asynchronous messages to be outstanding. This raises a risk of failure due to lack of memory and, therefore, this mode of operation is not viable for sessions that make guarantees about the failure modes of asynchonous services.

KErrNone if successful, otherwise one of the other system-wide error codes.

Parameters

RServer2 aServerA handle to a server with which a session is to be established.
const TVersion & aVersionThe lowest version of the server with which this client is compatible

CreateSession(RServer2, const TVersion &, TInt)

IMPORT_C TIntCreateSession(RServer2aServer,
const TVersion &aVersion,
TIntaAsyncMessageSlots
)[protected]

Parameters

RServer2 aServer
const TVersion & aVersion
TInt aAsyncMessageSlots

CreateSession(RServer2, const TVersion &, TInt, TIpcSessionType, const TSecurityPolicy *, TRequestStatus *)

IMPORT_C TIntCreateSession(RServer2aServer,
const TVersion &aVersion,
TIntaAsyncMessageSlots,
TIpcSessionTypeaType,
const TSecurityPolicy *aPolicy = 0,
TRequestStatus *aStatus = 0
)[protected]

Parameters

RServer2 aServer
const TVersion & aVersion
TInt aAsyncMessageSlots
TIpcSessionType aType
const TSecurityPolicy * aPolicy = 0
TRequestStatus * aStatus = 0

CreateSession(const TDesC &, const TVersion &, TInt, TRequestStatus *)

TInt CreateSession(const TDesC &aServer,
const TVersion &aVersion,
TIntaAsyncMessageSlots,
TRequestStatus *aStatus
)[protected, inline]

Use CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TIpcSessionType aType,const TSecurityPolicy* aPolicy=0, TRequestStatus* aStatus=0);

Parameters

const TDesC & aServer
const TVersion & aVersion
TInt aAsyncMessageSlots
TRequestStatus * aStatus

DoConnect(const TVersion &, TRequestStatus *)

TInt DoConnect(const TVersion &aVersion,
TRequestStatus *aStatus
)[private]

Parameters

const TVersion & aVersion
TRequestStatus * aStatus

DoSend(TInt, const TIpcArgs *)

IMPORT_C TIntDoSend(TIntaFunction,
const TIpcArgs *aArgs
)const [private]

Parameters

TInt aFunction
const TIpcArgs * aArgs

DoSendReceive(TInt, const TIpcArgs *, TRequestStatus &)

IMPORT_C voidDoSendReceive(TIntaFunction,
const TIpcArgs *aArgs,
TRequestStatus &aStatus
)const [private]

Parameters

TInt aFunction
const TIpcArgs * aArgs
TRequestStatus & aStatus

DoSendReceive(TInt, const TIpcArgs *)

IMPORT_C TIntDoSendReceive(TIntaFunction,
const TIpcArgs *aArgs
)const [private]

Parameters

TInt aFunction
const TIpcArgs * aArgs

DoShare(TInt)

IMPORT_C TIntDoShare(TIntaAttachMode)[private]

Parameters

TInt aAttachMode

Open(RMessagePtr2, TInt, TOwnerType)

IMPORT_C TIntOpen(RMessagePtr2aMessage,
TIntaParam,
TOwnerTypeaType = EOwnerProcess
)

Parameters

RMessagePtr2 aMessage
TInt aParam
TOwnerType aType = EOwnerProcess

Open(RMessagePtr2, TInt, const TSecurityPolicy &, TOwnerType)

IMPORT_C TIntOpen(RMessagePtr2aMessage,
TIntaParam,
const TSecurityPolicy &aServerPolicy,
TOwnerTypeaType = EOwnerProcess
)

Parameters

RMessagePtr2 aMessage
TInt aParam
const TSecurityPolicy & aServerPolicy
TOwnerType aType = EOwnerProcess

Open(TInt, TOwnerType)

IMPORT_C TIntOpen(TIntaArgumentIndex,
TOwnerTypeaType = EOwnerProcess
)

Parameters

TInt aArgumentIndex
TOwnerType aType = EOwnerProcess

Open(TInt, const TSecurityPolicy &, TOwnerType)

IMPORT_C TIntOpen(TIntaArgumentIndex,
const TSecurityPolicy &aServerPolicy,
TOwnerTypeaType = EOwnerProcess
)

Parameters

TInt aArgumentIndex
const TSecurityPolicy & aServerPolicy
TOwnerType aType = EOwnerProcess

Send(TInt, const TIpcArgs &)

TInt Send(TIntaFunction,
const TIpcArgs &aArgs
)const [protected, inline]

Issues a blind request to the server with the specified function number, and arguments.

A blind request is one where the server does not issue a response to the client.

KErrNone, if the send operation is successful; KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; KErrNoMemory, if there is insufficient memory available.

panic

USER 72 if the function number is negative.

Parameters

TInt aFunctionThe function number identifying the request.
const TIpcArgs & aArgsA set of up to 4 arguments and their types to be passed to the server.

Send(TInt)

TInt Send(TIntaFunction)const [protected, inline]

Issues a blind request to the server with the specified function number, but with no arguments.

A blind request is one where the server does not issue a response to the client.

KErrNone, if the send operation is successful; KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; KErrNoMemory, if there is insufficient memory available.

panic

USER 72 if the function number is negative.

Parameters

TInt aFunctionThe function number identifying the request.

SendAsync(TInt, const TIpcArgs *, TRequestStatus *)

TInt SendAsync(TIntaFunction,
const TIpcArgs *aArgs,
TRequestStatus *aStatus
)const [private]

Parameters

TInt aFunction
const TIpcArgs * aArgs
TRequestStatus * aStatus

SendReceive(TInt, const TIpcArgs &, TRequestStatus &)

voidSendReceive(TIntaFunction,
const TIpcArgs &aArgs,
TRequestStatus &aStatus
)const [protected, inline]

Issues an asynchronous request to the server with the specified function number and arguments.

The completion status of the request is returned via the request status object, aStatus.

panic

USER 72 if the function number is negative.

Parameters

TInt aFunctionThe function number identifying the request.
const TIpcArgs & aArgsA set of up to 4 arguments and their types to be passed to the server.
TRequestStatus & aStatusThe request status object used to contain the completion status of the request.

SendReceive(TInt, const TIpcArgs &)

TInt SendReceive(TIntaFunction,
const TIpcArgs &aArgs
)const [protected, inline]

Issues a synchronous request to the server with the specified function number and arguments.

KErrNone, if the send operation is successful; KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; KErrNoMemory, if there is insufficient memory available.

panic

USER 72 if the function number is negative.

Parameters

TInt aFunctionThe function number identifying the request.
const TIpcArgs & aArgsA set of up to 4 arguments and their types to be passed to the server.

SendReceive(TInt, TRequestStatus &)

voidSendReceive(TIntaFunction,
TRequestStatus &aStatus
)const [protected, inline]

Issues an asynchronous request to the server with the specified function number, but with no arguments.

The completion status of the request is returned via the request status object, aStatus.

panic

USER 72 if the function number is negative.

Parameters

TInt aFunctionThe function number identifying the request.
TRequestStatus & aStatusThe request status object used to contain the completion status of the request.

SendReceive(TInt)

TInt SendReceive(TIntaFunction)const [protected, inline]

Issues a synchronous request to the server with the specified function number, but with no arguments.

KErrNone, if the send operation is successful; KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; KErrNoMemory, if there is insufficient memory available.

panic

USER 72 if the function number is negative.

Parameters

TInt aFunctionThe function number identifying the request.

SendSync(TInt, const TIpcArgs *)

TInt SendSync(TIntaFunction,
const TIpcArgs *aArgs
)const [private]

Parameters

TInt aFunction
const TIpcArgs * aArgs

SetReturnedHandle(TInt)

TInt SetReturnedHandle(TIntaHandleOrError)[inline]

Sets the handle-number of this handle to the specified value.

The function can take a (zero or positive) handle-number, or a (negative) error number.

If aHandleOrError represents a handle-number, then the handle-number of this handle is set to that value. If aHandleOrError represents an error number, then the handle-number of this handle is set to zero and the negative value is returned.

KErrNone, if aHandle is a handle-number; the value of aHandleOrError, otherwise.

Parameters

TInt aHandleOrErrorA handle-number, if zero or positive; an error value, if negative.

SetReturnedHandle(TInt, const TSecurityPolicy &)

IMPORT_C TIntSetReturnedHandle(TIntaHandleOrError,
const TSecurityPolicy &aServerPolicy
)

Parameters

TInt aHandleOrError
const TSecurityPolicy & aServerPolicy

SetReturnedHandle(TInt, RHandleBase &)

TInt SetReturnedHandle(TIntaHandleOrError,
RHandleBase &aHandle
)[protected, static, inline]

Parameters

TInt aHandleOrError
RHandleBase & aHandle

ShareAuto()

TInt ShareAuto()[inline]

Creates a session that can be shared by other threads in the current process.

After calling this function the session object may be used by threads other than than the one that created it.

Note that this can only be done with servers that mark their sessions as sharable.

KErrNone, if the session is successfully shared; KErrNoMmemory, if the attempt fails for lack of memory.

panic

KERN-EXEC 23 The session cannot be shared.

CServer2

RSessionBase::ShareProtected()

CServer2::TServerType

ShareProtected()

TInt ShareProtected()[inline]

Creates a session handle that can be be passed via IPC to another process as well as being shared by other threads in the current process.

After calling this function the session object may be used by threads other than than the one that created it.

Note that this can only be done with servers that mark their sessions as globally sharable.

KErrNone, if the session is successfully shared; KErrNoMmemory, if the attempt fails for lack of memory.

panic

KERN-EXEC 23 The session cannot be shared.

CServer2

RSessionBase::ShareAuto()

CServer2::TServerType

Member Enumerations Documentation

Enum TAttachMode

Indicates whether or not threads in the process are automatically attached to the session when passed as a parameter to the Share() function.

Enumerators

EExplicitAttach
EAutoAttach