Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32base.h
Link against: euser.lib

Class CSession

CSession

Support

Supported from 5.0

Description

Represents a session for a client thread on the server-side.

A session acts as a channel of communication between the client and the server. A client thread can have multiple concurrent sessions with a server.

A session can also be shared by all threads within a single process

A server must define and implement a derived class. In particular it must provide an implementation for the ServiceL() virtual function.

Note that in ER5:

Derivation

CBaseBase class for all classes to be instantiated on the heap
CSessionRepresents a session for a client thread on the server-side
CSharableSessionSharable session abstract base class

Defined in CSession:
CSession(), Client(), CountResources(), Kill(), Message(), Panic(), ReadL(), ResourceCountMarkEnd(), ResourceCountMarkStart(), Server(), ServiceL(), WriteL()

Inherited from CBase:
operator new()

Inherited from CSharableSession:
CreateL()


Construction and destruction


CSession()

protected: CSession(RThread aClient);

Description

Constructs the server-side client session object for the specified client thread.

Derived classes must define and implement a constructor through which the client thread can be specified. A typical implementation calls this client session base class constructor through a constructor initialization list.

Parameters

RThread aClient

The client thread for which this server-side client session is being constructed.

[Top]


Read data from the client address space


ReadL()

void ReadL(const TAny* aPtr,TDes8& aDes) const;

Description

Copies data from the client thread's address space into an 8 bit descriptor in the server address space.

The source data must be a valid descriptor.

Data is copied from the start of the source descriptor data area. The length of data copied is the length of the source descriptor.

The length of data copied is limited to the maximum length of the target descriptor.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data at this pointer must be a descriptor, i.e. a TDesC8 type.

TDes8& aDes

An 8 bit descriptor in the server address space. This is the target of the copy operation.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid descriptor.


ReadL()

void ReadL(const TAny* aPtr,TDes8& aDes,TInt anOffset) const;

Description

Copies data from the client thread's address space into an 8 bit descriptor in the server address space.

The source data must be a valid descriptor.

Data is copied from the specified offset position within the source descriptor data area. The length of data copied is the length of source descriptor data minus the offset value. If the offset value is greater than the length of the source descriptor, then no data is copied.

The length of data copied is limited to the maximum length of the target descriptor.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data at this pointer must be a descriptor, i.e. a TDesC8 type.

TDes8& aDes

An 8 bit descriptor in the server address space. This is the target of the copy operation.

TInt anOffset

The offset from the start of the source descriptor data area from where copying is to begin. This value must be greater than or equal to zero.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the offset value is negative the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid descriptor.


ReadL()

void ReadL(const TAny* aPtr,TDes16& aDes) const;

Description

Copies data from the client thread's address space into a 16 bit descriptor in the server address space.

The source data must be a valid descriptor.

Data is copied from the start of the source descriptor data area. The length of data copied is the length of the source descriptor.

The length of data copied is limited to the maximum length of the target descriptor.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data at this pointer must be a descriptor, i.e. a TDesC16 type.

TDes16& aDes

A 16 bit descriptor in the server address space. This is the target of the copy operation.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid descriptor.


ReadL()

void ReadL(const TAny* aPtr,TDes16& aDes,TInt anOffset) const;

Description

Copies data from the client thread's address space into a 16 bit descriptor in the server address space.

The source data must be a valid descriptor.

Data is copied from the specified offset position within the source descriptor data area. The length of data copied is the length of source descriptor data minus the offset value. If the offset value is greater than the length of the source descriptor, then no data is copied.

The length of data copied is limited to the maximum length of the target descriptor.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data at this pointer must be a descriptor, i.e. aTDesC16 type.

TDes16& aDes

A 16 bit descriptor in the server address space. This is the target of the copy operation.

TInt anOffset

The offset from the start of the source descriptor data area from where copying is to begin. This value must be greater than or equal to zero.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the offset value is negative the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid descriptor.

[Top]


Write data into the client address space


WriteL()

void WriteL(const TAny* aPtr,const TDesC8& aDes) const;

Description

Copies data from an 8 bit descriptor in the server address space to the client thread's address space.

The target location must be a valid modifiable descriptor.

Data is copied from the source descriptor to the data area of the target descriptor; the length of data copied is the length of the source descriptor.

The target descriptor in the client address space must be big enough to contain the data otherwise the function leaves; i.e. the target descriptor maximum length cannot be less than the length of the source descriptor.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data type at this location must be a modifiable descriptor, i.e. aTDes8 type.

TDesC8& aDes

An 8 bit descriptor in the server address space. This is the source of the copy operation.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid modifiable descriptor.


WriteL()

void WriteL(const TAny* aPtr,const TDesC8& aDes,TInt anOffset) const;

Description

Copies data from an 8 bit descriptor in the server address space to the client thread's address space.

The target location must be a valid modifiable descriptor.

Data is copied from the source descriptor to the specified offset position within the target descriptor data area. The length of data copied is the length of the source descriptor. The length of the target descriptor is set to the length of the source descriptor plus the value of the offset.

The target descriptor in the client address space must be big enough to contain the data otherwise the function leaves; i.e. the target descriptor maximum length cannot be less than the sum of the source descriptor length plus the value of the offset.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data type at this location must be a modifiable descriptor, i.e. aTDes8 type.

const TDesC8& aDes

An 8 bit descriptor in the server address space. This is the source of the copy operation.

TInt anOffset

The offset from the start of the target descriptor data area where copying is to begin. This value must be greater than or equal to zero.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the offset value is negative the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid modifiable descriptor. there is insufficient space in the target descriptor in the client thread's address space.


WriteL()

void WriteL(const TAny* aPtr,const TDesC16& aDes) const;

Description

Copies data from a 16 bit descriptor in the server address space to the client thread's address space.

The target location must be a valid modifiable descriptor.

Data is copied from the source descriptor to the data area of the target descriptor; the length of data copied is the length of the source descriptor.

The target descriptor in the client address space must be big enough to contain the data otherwise the function leaves; i.e. the target descriptor maximum length cannot be less than the length of the source descriptor.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data type at this location must be a modifiable descriptor, i.e. aTDes16 type.

TDesC16& aDes

A 16 bit descriptor in the server address space. This is the source of the copy operation.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid modifiable descriptor.


WriteL()

void WriteL(const TAny* aPtr,const TDesC16& aDes,TInt anOffset) const;

Description

Copies data from a 16 bit descriptor in the server address space to the client thread's address space.

The target location must be a valid modifiable descriptor.

Data is copied from the source descriptor to the specified offset position within the target descriptor data area. The length of data copied is the length of the source descriptor. The length of the target descriptor is set to the length of the source descriptor plus the value of the offset.

The target descriptor in the client address space must be big enough to contain the data otherwise the function leaves; i.e. the target descriptor maximum length cannot be less than the sum of the source descriptor length plus the value of the offset.

Parameters

const TAny* aPtr

A pointer to a valid address within the client thread's address space. The data type at this location must be a modifiable descriptor, i.e. aTDes16 type.

const TDesC16& aDes

A 16 bit descriptor in the server address space. This is the source of the copy operation.

TInt anOffset

The offset from the start of the target descriptor data area where copying is to begin. This value must be greater than or equal to zero.

Leave codes

 

The function leaves with one of the system-wide error codes, if: the offset value is negative the pointer in the client thread's address space is not valid within that address space. the pointer in the client thread's address space does not point to a valid modifiable descriptor. there is insufficient space in the target descriptor in the client thread's address space.

[Top]


Error handling


Panic()

void Panic(const TDesC& aCategory,TInt aReason) const;

Description

Panics the client thread associated with this session.

Parameters

const TDesC& aCategory

Text specifying the panic category name.

TInt aReason

The panic number.

See also:


Kill()

void Kill(TInt aReason) const;

Description

Ends the client thread associated with this session.

Parameters

TInt aReason

The reason associated with the ending of the client thread.

See also:

[Top]


Accessor functions


Client()

const RThread& Client() const;

Description

Returns the client thread that caused this session to be created.

Return value

RThread&

The client thread.


Server()

const CServer* Server() const;

Support

Withdrawn in 6.0

Description

Returns the server active object which provides message handling for this session, i.e. the server active object which created this session object.

Return value

CServer*

The server active object.


Message()

const RMessage& Message() const;

Support

Withdrawn in 6.0

Description

Returns the current message.

Return value

RMessage&

The current message.

[Top]


Request handling


ServiceL()

virtual void ServiceL(const RMessage& aMessage) = 0;

Support

Withdrawn in 6.0

Description

Handles the servicing of client requests to the server.

This function must be implemented in a derived class. The details of the request are contained within the message.

Parameters

const RMessage& aMessage

The message containing the client request


ResourceCountMarkStart()

void ResourceCountMarkStart();

Support

Withdrawn in 6.0

Description

Initialises resource counting.

If resource counting has not been implemented in the derived class, the function panics the client thread associated with this session, specifying the category name CSession and panic number 1.

See also:


ResourceCountMarkEnd()

void ResourceCountMarkEnd();

Support

Withdrawn in 6.0

Description

Ends resource counting.

It checks that the current number of resources in use is the same as that when resource counting started. If these values are not equal, the function panics the client thread associated with this session, specifying the category name CSession and panic number 2.

See also:


CountResources()

virtual TInt CountResources();

Support

Withdrawn in 6.0

Description

Returns the number of resources currently in use.

The default implementation returns KErrGeneral.

Derived classes which support resource counting must provide a suitable implementation.

Return value

TInt

The current number of resources in use.