Multiple Client Support

This document describes how multiple clients can access a driver over a single logical channel.

A single channel has a single handle which is shared by driver users. A driver can allow or prevent the sharing of a handle to a logical channel between multiple users. This policy is implemented by the DLogicalChannel::RequestUserHandle() function. The default implementation does not restrict sharing of the channel, but a driver can override the function to change this.

In the following example, the driver ensures that only the intended clients can get the handle and access the driver. Any other client that tries to share the handle gets a KErrAccessDenied error.

TInt DExDriverLogicalChannel::RequestUserHandle(DThread* aThread,
        TOwnerType aType)
    {
    // Handle should be provided only to the intended client. Any 
    // other clients that try to get a handle to the driver should get an access 
    // denied error.
    if ( aType!=EOwnerThread || aThread!=iClient)
        return KErrAccessDenied;
    return KErrNone;
    }

DLogicalChannel::RequestUserHandle() only restricts the user from sharing or duplicating an existing channel. It does not restrict another process from opening its own separate channel on the same device.

Note: More than one user can access the driver at the same time. It is up to the driver to manage and provide correct and secure access to the driver.