1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved.
30 *
31 * HISTORY
32 *
33 */
34
35
36#ifndef _IOKIT_IOSERVICEPRIVATE_H
37#define _IOKIT_IOSERVICEPRIVATE_H
38
39// options for getExistingServices()
40enum {
41    kIONotifyOnce	      = 0x00000001,
42    kIOServiceExistingSet     = 0x00000002,
43    kIOServiceChangesOK       = 0x00000004,
44    kIOServiceInternalDone    = 0x00000008,
45    kIOServiceClassDone       = 0x00000010,
46};
47
48// masks for __state[1]
49enum {
50    kIOServiceBusyStateMask	= 0x000000ff,
51    kIOServiceBusyMax		= 255,
52    kIOServiceNeedConfigState	= 0x80000000,
53    kIOServiceSynchronousState	= 0x40000000,
54    kIOServiceModuleStallState	= 0x20000000,
55    kIOServiceBusyWaiterState	= 0x10000000,
56
57    kIOServiceSyncPubState	= 0x08000000,
58    kIOServiceConfigState	= 0x04000000,
59    kIOServiceTermPhase2State	= 0x01000000,
60    kIOServiceTermPhase3State	= 0x00800000,
61    kIOServiceTermPhase1State	= 0x00400000,
62    kIOServiceTerm1WaiterState  = 0x00200000
63};
64
65// options for terminate()
66enum {
67    kIOServiceRecursing		= 0x00100000,
68};
69
70// notify state
71enum {
72    kIOServiceNotifyEnable	= 0x00000001,
73    kIOServiceNotifyWaiter	= 0x00000002
74};
75
76struct _IOServiceNotifierInvocation
77{
78    IOThread		thread;
79    queue_chain_t	link;
80};
81
82class _IOServiceNotifier : public IONotifier
83{
84    friend class IOService;
85
86    OSDeclareDefaultStructors(_IOServiceNotifier)
87
88public:
89    OSOrderedSet *			whence;
90
91    OSDictionary *			matching;
92    IOServiceMatchingNotificationHandler handler;
93    IOServiceNotificationHandler	compatHandler;
94    void *				target;
95    void *				ref;
96    SInt32				priority;
97    queue_head_t			handlerInvocations;
98    IOOptionBits			state;
99
100    virtual void free();
101    virtual void remove();
102    virtual bool disable();
103    virtual void enable( bool was );
104    virtual void wait();
105};
106
107class _IOServiceInterestNotifier : public IONotifier
108{
109    friend class IOService;
110
111    OSDeclareDefaultStructors(_IOServiceInterestNotifier)
112
113public:
114    queue_chain_t		chain;
115
116    IOServiceInterestHandler	handler;
117    void *			target;
118    void *			ref;
119    queue_head_t		handlerInvocations;
120    IOOptionBits		state;
121
122    virtual void free();
123    virtual void remove();
124    virtual bool disable();
125    virtual void enable( bool was );
126    virtual void wait();
127};
128
129class _IOConfigThread : public OSObject
130{
131    friend class IOService;
132
133    OSDeclareDefaultStructors(_IOConfigThread)
134
135public:
136    virtual void free();
137
138    static void configThread( void );
139    static void main( void * arg, wait_result_t result );
140};
141
142enum {
143	kMaxConfigThreads	= CONFIG_MAX_THREADS,
144};
145
146enum {
147    kMatchNubJob	= 10,
148};
149
150class _IOServiceJob : public OSObject
151{
152    friend class IOService;
153
154    OSDeclareDefaultStructors(_IOServiceJob)
155
156public:
157    int			type;
158    IOService *		nub;
159    IOOptionBits	options;
160
161    static _IOServiceJob * startJob( IOService * nub, int type,
162                          IOOptionBits options = 0 );
163    static void pingConfig( class _IOServiceJob * job );
164
165};
166
167class IOResources : public IOService
168{
169    friend class IOService;
170
171    OSDeclareDefaultStructors(IOResources)
172
173public:
174    static IOService * resources( void );
175    virtual bool init( OSDictionary * dictionary = 0 );
176    virtual IOWorkLoop * getWorkLoop( ) const;
177    virtual bool matchPropertyTable( OSDictionary * table );
178    virtual IOReturn setProperties( OSObject * properties );
179};
180
181class _IOOpenServiceIterator : public OSIterator
182{
183    friend class IOService;
184
185    OSDeclareDefaultStructors(_IOOpenServiceIterator)
186
187    OSIterator *	iter;
188    const IOService *	client;
189    const IOService *	provider;
190    IOService *		last;
191
192public:
193    static OSIterator * iterator( OSIterator * _iter,
194                                  const IOService * client,
195                                  const IOService * provider );
196    virtual void free();
197    virtual void reset();
198    virtual bool isValid();
199    virtual OSObject * getNextObject();
200};
201
202extern const OSSymbol * gIOConsoleUsersKey;
203extern const OSSymbol * gIOConsoleSessionUIDKey;
204extern const OSSymbol *	gIOConsoleSessionAuditIDKey;
205extern const OSSymbol * gIOConsoleSessionOnConsoleKey;
206extern const OSSymbol * gIOConsoleSessionSecureInputPIDKey;
207
208#endif /* ! _IOKIT_IOSERVICEPRIVATE_H */
209
210