Location:
e32base.h
Link against: euser.lib
CSession
Supported from 5.0
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:
There is no concept of a sharable session; a session is tied to the connecting thread, and no other thread can use it.
This class is derived from CBase
.
|
Defined in CSession
:
CSession()
, Client()
, CountResources()
, Kill()
, Message()
, Panic()
, ReadL()
, ResourceCountMarkEnd()
, ResourceCountMarkStart()
, Server()
, ServiceL()
, WriteL()
Inherited from CBase
:
operator new()
Inherited from CSharableSession
:
CreateL()
protected: CSession(RThread aClient);
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.
|
void ReadL(const TAny* aPtr,TDes8& aDes) const;
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.
|
|
void ReadL(const TAny* aPtr,TDes8& aDes,TInt anOffset) const;
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.
|
|
void ReadL(const TAny* aPtr,TDes16& aDes) const;
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.
|
|
void ReadL(const TAny* aPtr,TDes16& aDes,TInt anOffset) const;
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.
|
|
void WriteL(const TAny* aPtr,const TDesC8& aDes) const;
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.
|
|
void WriteL(const TAny* aPtr,const TDesC8& aDes,TInt anOffset) const;
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.
|
|
void WriteL(const TAny* aPtr,const TDesC16& aDes) const;
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.
|
|
void WriteL(const TAny* aPtr,const TDesC16& aDes,TInt anOffset) const;
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.
|
|
void Panic(const TDesC& aCategory,TInt aReason) const;
Panics the client thread associated with this session.
|
void Kill(TInt aReason) const;
Ends the client thread associated with this session.
|
const RThread& Client() const;
Returns the client thread that caused this session to be created.
|
const CServer* Server() const;
Withdrawn in 6.0
Returns the server active object which provides message handling for this session, i.e. the server active object which created this session object.
|
const RMessage& Message() const;
Withdrawn in 6.0
Returns the current message.
|
virtual void ServiceL(const RMessage& aMessage) = 0;
Withdrawn in 6.0
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.
|
void ResourceCountMarkStart();
Withdrawn in 6.0
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.
void ResourceCountMarkEnd();
Withdrawn in 6.0
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.
virtual TInt CountResources();
Withdrawn in 6.0
Returns the number of resources currently in use.
The default implementation returns KErrGeneral
.
Derived classes which support resource counting must provide a suitable implementation.
|