2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
25 * IONetworkStack.h - An IOKit proxy for the BSD network stack.
31 #ifndef _IONETWORKSTACK_H
32 #define _IONETWORKSTACK_H
36 #define kIONetworkStackUserCommand "IONetworkStackUserCommand"
44 class IONetworkInterface
;
46 class IONetworkStack
: public IOService
48 OSDeclareDefaultStructors( IONetworkStack
)
51 OSOrderedSet
* _ifSet
;
52 OSDictionary
* _ifDict
;
53 IONotifier
* _interfaceNotifier
;
54 bool _registerPrimaryInterface
;
56 struct ExpansionData
{ };
58 Reserved for future use. (Internal use only) */
59 ExpansionData
*_reserved
;
62 static bool interfacePublished( void * target
,
64 IOService
* service
);
66 static void unregisterBSDInterface( IONetworkInterface
* netif
);
68 static void registerBSDInterface( IONetworkInterface
* netif
);
70 static SInt32
orderRegisteredInterfaces( const OSMetaClassBase
* obj1
,
71 const OSMetaClassBase
* obj2
,
74 static void completeRegistrationUsingArray( OSArray
* array
);
76 static void completeRegistration( OSArray
* array
, bool isSync
);
80 virtual bool addInterface( IONetworkInterface
* netif
);
82 virtual void removeInterface( IONetworkInterface
* netif
);
84 virtual IONetworkInterface
* getInterface( UInt32 index
);
86 virtual bool containsInterface( IONetworkInterface
* netif
);
88 virtual bool addRegisteredInterface( IONetworkInterface
* netif
);
90 virtual void removeRegisteredInterface( IONetworkInterface
* netif
);
92 virtual IONetworkInterface
* getRegisteredInterface( const char * name
,
95 virtual IONetworkInterface
* getLastRegisteredInterface(const char * name
);
97 virtual UInt32
getNextAvailableUnitNumber( const char * name
,
98 UInt32 startingUnit
= 0 );
100 virtual bool preRegisterInterface( IONetworkInterface
* netif
,
106 static IONetworkStack
* getNetworkStack();
108 static int bsdInterfaceWasUnregistered( struct ifnet
* ifp
);
110 virtual bool init( OSDictionary
* properties
);
112 virtual bool start( IOService
* provider
);
114 virtual void stop( IOService
* provider
);
116 virtual IOReturn
registerAllInterfaces();
118 virtual IOReturn
registerPrimaryInterface( bool enable
);
120 virtual IOReturn
registerInterface( IONetworkInterface
* netif
,
123 bool isSync
= true );
125 virtual IOReturn
message( UInt32 type
,
126 IOService
* provider
,
127 void * argument
= 0 );
129 virtual IOReturn
newUserClient( task_t owningTask
,
132 IOUserClient
** handler
);
134 // Virtual function padding
135 OSMetaClassDeclareReservedUnused( IONetworkStack
, 0);
136 OSMetaClassDeclareReservedUnused( IONetworkStack
, 1);
137 OSMetaClassDeclareReservedUnused( IONetworkStack
, 2);
138 OSMetaClassDeclareReservedUnused( IONetworkStack
, 3);
144 #endif /* !_IONETWORKSTACK_H */