1/*
2 * @APPLE_LICENSE_HEADER_START@
3 *
4 * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 1997 Apple Computer, Inc.
25 *
26 *
27 * HISTORY
28 *
29 */
30
31
32#ifndef _IOKIT_IOHIDUSERCLIENT_H
33#define _IOKIT_IOHIDUSERCLIENT_H
34
35#include <libkern/c++/OSContainers.h>
36#include <IOKit/IOUserClient.h>
37#include "IOHIDSystem.h"
38#include "IOHIDEventServiceQueue.h"
39
40class IOHIDUserClient : public IOUserClient
41{
42    OSDeclareDefaultStructors(IOHIDUserClient)
43
44private:
45
46    IOHIDSystem     *owner;
47
48public:
49    // IOUserClient methods
50    virtual IOReturn clientClose( void );
51
52    virtual IOService * getService( void );
53
54    virtual IOReturn registerNotificationPort(
55		mach_port_t port, UInt32 type, UInt32 refCon );
56
57    virtual IOReturn connectClient( IOUserClient * client );
58
59    virtual IOReturn clientMemoryForType( UInt32 type,
60        UInt32 * flags, IOMemoryDescriptor ** memory );
61
62    virtual IOExternalMethod * getTargetAndMethodForIndex(
63                        IOService ** targetP, UInt32 index );
64
65    // others
66
67    virtual bool start( IOService * provider );
68    virtual IOReturn setProperties( OSObject * properties );
69    IOReturn extGetUserHidActivityState(void*,void*,void*,void*,void*,void*);
70};
71
72
73class IOHIDParamUserClient : public IOUserClient
74{
75    OSDeclareDefaultStructors(IOHIDParamUserClient)
76
77private:
78
79    IOHIDSystem     *owner;
80
81public:
82
83    // IOUserClient methods
84    virtual IOService * getService( void );
85
86    virtual IOExternalMethod * getTargetAndMethodForIndex(
87                        IOService ** targetP, UInt32 index );
88
89    // others
90
91    virtual bool start( IOService * provider );
92    virtual IOReturn setProperties( OSObject * properties );
93
94    IOReturn extGetUserHidActivityState(void*,void*,void*,void*,void*,void*);
95private:
96    virtual IOReturn extPostEvent(void*,void*,void*,void*,void*,void*);
97};
98
99class IOHIDStackShotUserClient : public IOUserClient
100{
101    OSDeclareDefaultStructors(IOHIDStackShotUserClient)
102
103private:
104
105    IOHIDSystem *	owner;
106    task_t          client;
107
108public:
109    virtual bool initWithTask(task_t owningTask, void * security_id, UInt32 type );
110
111    // IOUserClient methods
112    virtual IOReturn clientClose( void );
113
114    virtual IOService * getService( void );
115
116    virtual IOReturn registerNotificationPort(
117		mach_port_t 	port,
118		UInt32		type,
119		UInt32		refCon );
120    // others
121
122    virtual bool start( IOService * provider );
123
124};
125
126class IOHIDEventSystemUserClient : public IOUserClient
127{
128    OSDeclareDefaultStructors(IOHIDEventSystemUserClient)
129
130private:
131    IOHIDSystem *               owner;
132    task_t                      client;
133    IOHIDEventServiceQueue *    kernelQueue;
134    OSSet *						userQueues;
135
136	static void initialize(void);
137	static UInt32 createIDForDataQueue(IODataQueue * eventQueue);
138	static void removeIDForDataQueue(IODataQueue * eventQueue);
139	static IODataQueue * copyDataQueueWithID(UInt32 queueID);
140
141public:
142    virtual bool initWithTask(task_t owningTask, void * security_id, UInt32 type );
143    void free();
144
145    // IOUserClient methods
146    virtual IOReturn clientClose( void );
147
148    virtual IOExternalMethod * getTargetAndMethodForIndex(IOService ** targetP, UInt32 index );
149    virtual IOReturn createEventQueue(void*,void*,void*,void*,void*,void*);
150    virtual IOReturn destroyEventQueue(void*,void*,void*,void*,void*,void*);
151    virtual IOReturn tickle(void*,void*,void*,void*,void*,void*);
152
153    virtual IOReturn registerNotificationPort(mach_port_t port, UInt32 type, UInt32 refCon );
154    virtual IOReturn clientMemoryForType( UInt32 type, UInt32 * flags, IOMemoryDescriptor ** memory );
155
156    virtual IOService * getService( void );
157
158    virtual bool start( IOService * provider );
159
160};
161
162
163
164#endif /* ! _IOKIT_IOHIDUSERCLIENT_H */
165