]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
24 | * | |
25 | * IONetworkStack.h - An IOKit proxy for the BSD network stack. | |
26 | * | |
27 | * HISTORY | |
28 | * | |
29 | */ | |
30 | ||
31 | #ifndef _IONETWORKSTACK_H | |
32 | #define _IONETWORKSTACK_H | |
33 | ||
34 | // User-client keys | |
35 | // | |
36 | #define kIONetworkStackUserCommand "IONetworkStackUserCommand" | |
37 | enum { | |
38 | kIORegisterOne = 1, | |
39 | kIORegisterAll | |
40 | }; | |
41 | ||
42 | #ifdef KERNEL | |
43 | ||
44 | class IONetworkInterface; | |
45 | ||
46 | class IONetworkStack : public IOService | |
47 | { | |
48 | OSDeclareDefaultStructors( IONetworkStack ) | |
49 | ||
50 | protected: | |
51 | OSOrderedSet * _ifSet; | |
52 | OSDictionary * _ifDict; | |
53 | IONotifier * _interfaceNotifier; | |
54 | bool _registerPrimaryInterface; | |
55 | ||
56 | struct ExpansionData { }; | |
57 | /*! @var reserved | |
58 | Reserved for future use. (Internal use only) */ | |
59 | ExpansionData *_reserved; | |
60 | ||
61 | ||
62 | static bool interfacePublished( void * target, | |
63 | void * param, | |
64 | IOService * service ); | |
65 | ||
66 | static void unregisterBSDInterface( IONetworkInterface * netif ); | |
67 | ||
68 | static void registerBSDInterface( IONetworkInterface * netif ); | |
69 | ||
70 | static SInt32 orderRegisteredInterfaces( const OSMetaClassBase * obj1, | |
71 | const OSMetaClassBase * obj2, | |
72 | void * ref ); | |
73 | ||
74 | static void completeRegistrationUsingArray( OSArray * array ); | |
75 | ||
76 | static void completeRegistration( OSArray * array, bool isSync ); | |
77 | ||
78 | virtual void free(); | |
79 | ||
80 | virtual bool addInterface( IONetworkInterface * netif ); | |
81 | ||
82 | virtual void removeInterface( IONetworkInterface * netif ); | |
83 | ||
84 | virtual IONetworkInterface * getInterface( UInt32 index ); | |
85 | ||
86 | virtual bool containsInterface( IONetworkInterface * netif ); | |
87 | ||
88 | virtual bool addRegisteredInterface( IONetworkInterface * netif ); | |
89 | ||
90 | virtual void removeRegisteredInterface( IONetworkInterface * netif ); | |
91 | ||
92 | virtual IONetworkInterface * getRegisteredInterface( const char * name, | |
93 | UInt32 unit ); | |
94 | ||
95 | virtual IONetworkInterface * getLastRegisteredInterface(const char * name); | |
96 | ||
97 | virtual UInt32 getNextAvailableUnitNumber( const char * name, | |
98 | UInt32 startingUnit = 0 ); | |
99 | ||
100 | virtual bool preRegisterInterface( IONetworkInterface * netif, | |
101 | const char * name, | |
102 | UInt32 unit, | |
103 | OSArray * array ); | |
104 | ||
105 | public: | |
106 | static IONetworkStack * getNetworkStack(); | |
107 | ||
108 | static int bsdInterfaceWasUnregistered( struct ifnet * ifp ); | |
109 | ||
110 | virtual bool init( OSDictionary * properties ); | |
111 | ||
112 | virtual bool start( IOService * provider ); | |
113 | ||
114 | virtual void stop( IOService * provider ); | |
115 | ||
116 | virtual IOReturn registerAllInterfaces(); | |
117 | ||
118 | virtual IOReturn registerPrimaryInterface( bool enable ); | |
119 | ||
120 | virtual IOReturn registerInterface( IONetworkInterface * netif, | |
121 | const char * name, | |
122 | UInt32 unit = 0, | |
123 | bool isSync = true ); | |
124 | ||
125 | virtual IOReturn message( UInt32 type, | |
126 | IOService * provider, | |
127 | void * argument = 0 ); | |
128 | ||
129 | virtual IOReturn newUserClient( task_t owningTask, | |
130 | void * security_id, | |
131 | UInt32 type, | |
132 | IOUserClient ** handler ); | |
133 | ||
134 | // Virtual function padding | |
135 | OSMetaClassDeclareReservedUnused( IONetworkStack, 0); | |
136 | OSMetaClassDeclareReservedUnused( IONetworkStack, 1); | |
137 | OSMetaClassDeclareReservedUnused( IONetworkStack, 2); | |
138 | OSMetaClassDeclareReservedUnused( IONetworkStack, 3); | |
139 | ||
140 | }; | |
141 | ||
142 | #endif /* KERNEL */ | |
143 | ||
144 | #endif /* !_IONETWORKSTACK_H */ |