Adaptation/GUID-3102F778-DD2F-4C87-A0DF-7FA44C9709D8.dita
changeset 15 307f4279f433
equal deleted inserted replaced
14:578be2adaf3e 15:307f4279f433
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-3102F778-DD2F-4C87-A0DF-7FA44C9709D8" xml:lang="en"><title>Multiple
       
    13 Client Support</title><shortdesc>This document describes how multiple clients can access a driver
       
    14 over a single logical channel.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>A single channel has a single handle which is shared by driver users. A
       
    16 driver can allow or prevent the sharing of a handle to a logical channel between
       
    17 multiple users. This policy is implemented by the <xref href="GUID-A3CC1D95-4681-3349-A67C-F113A614041D.dita#GUID-A3CC1D95-4681-3349-A67C-F113A614041D/GUID-9E23019E-7383-371E-B63C-85500F6B653D"><apiname>DLogicalChannel::RequestUserHandle()</apiname></xref> function.
       
    18 The default implementation does not restrict sharing of the channel, but a
       
    19 driver can override the function to change this. </p>
       
    20 <p>In the following example, the driver ensures that only the intended clients
       
    21 can get the handle and access the driver. Any other client that tries to share
       
    22 the handle gets a <codeph>KErrAccessDenied</codeph> error. </p>
       
    23 <codeblock id="GUID-2FEB04B3-ABD3-58E4-BFDB-0AD947BA6E16" xml:space="preserve">TInt DExDriverLogicalChannel::RequestUserHandle(DThread* aThread,
       
    24         TOwnerType aType)
       
    25     {
       
    26     // Handle should be provided only to the intended client. Any 
       
    27     // other clients that try to get a handle to the driver should get an access 
       
    28     // denied error.
       
    29     if ( aType!=EOwnerThread || aThread!=iClient)
       
    30         return KErrAccessDenied;
       
    31     return KErrNone;
       
    32     }</codeblock>
       
    33 <p> <xref href="GUID-A3CC1D95-4681-3349-A67C-F113A614041D.dita#GUID-A3CC1D95-4681-3349-A67C-F113A614041D/GUID-9E23019E-7383-371E-B63C-85500F6B653D"><apiname>DLogicalChannel::RequestUserHandle()</apiname></xref> only restricts
       
    34 the user from sharing or duplicating an existing channel. It does not restrict
       
    35 another process from opening its own separate channel on the same device. </p>
       
    36 <p> <note> More than one user can access the driver at the same time. It is
       
    37 up to the driver to manage and provide correct and secure access to the driver. </note></p>
       
    38 </conbody></concept>