]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h
9d00ed522fd7c703ded5edfc0ed778271d0c613c
[apple/configd.git] / SystemConfiguration.fproj / SCNetworkConfigurationPrivate.h
1 /*
2 * Copyright (c) 2005-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_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. 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 #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H
25 #define _SCNETWORKCONFIGURATIONPRIVATE_H
26
27 #include <AvailabilityMacros.h>
28 #include <sys/cdefs.h>
29 #include <CoreFoundation/CoreFoundation.h>
30 #include <SystemConfiguration/SystemConfiguration.h>
31 #include <SystemConfiguration/SCValidation.h>
32 #include <IOKit/IOKitLib.h>
33
34 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
35
36 /*!
37 @header SCNetworkConfigurationPrivate
38 */
39
40 __BEGIN_DECLS
41
42
43 #pragma mark -
44 #pragma mark SCNetworkInterface configuration (SPI)
45
46
47 /*!
48 @group Interface configuration
49 */
50
51 static __inline__ CFTypeRef
52 isA_SCNetworkInterface(CFTypeRef obj)
53 {
54 return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
55 }
56
57 static __inline__ CFTypeRef
58 isA_SCBondInterface(CFTypeRef obj)
59 {
60 CFStringRef interfaceType;
61
62 if (!isA_SCNetworkInterface(obj)) {
63 // if not an SCNetworkInterface
64 return NULL;
65 }
66
67 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
68 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
69 // if not a Bond
70 return NULL;
71 }
72
73 return obj;
74 }
75
76 static __inline__ CFTypeRef
77 isA_SCVLANInterface(CFTypeRef obj)
78 {
79 CFStringRef interfaceType;
80
81 if (!isA_SCNetworkInterface(obj)) {
82 // if not an SCNetworkInterface
83 return NULL;
84 }
85
86 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
87 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
88 // if not a VLAN
89 return NULL;
90 }
91
92 return obj;
93 }
94
95 /*!
96 @function _SCNetworkInterfaceCompare
97 @discussion Compares two SCNetworkInterface objects.
98 @param val1 The SCNetworkInterface object.
99 @param val2 The SCNetworkInterface object.
100 @param context Not used.
101 @result A comparison result.
102 */
103 CFComparisonResult
104 _SCNetworkInterfaceCompare (const void *val1,
105 const void *val2,
106 void *context) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
107
108 #define kIncludeNoVirtualInterfaces 0x0
109 #define kIncludeVLANInterfaces 0x1
110 #define kIncludeBondInterfaces 0x2
111 #define kIncludeAllVirtualInterfaces 0xffffffff
112
113 /*!
114 @function _SCNetworkInterfaceCreateWithBSDName
115 @discussion Create a new network interface associated with the provided
116 BSD interface name. This API supports Ethhernet, FireWire, and
117 IEEE 802.11 interfaces.
118 @param bsdName The BSD interface name.
119 @param flags Indicates whether virtual (Bond, VLAN)
120 network interfaces should be included.
121 @result A reference to the new SCNetworkInterface.
122 You must release the returned value.
123 */
124 SCNetworkInterfaceRef
125 _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator,
126 CFStringRef bsdName,
127 UInt32 flags) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
128
129 /*!
130 @function _SCNetworkInterfaceCreateWithEntity
131 @discussion Create a new network interface associated with the provided
132 SCDynamicStore service entity dictionary.
133 @param interface_entity The entity dictionary.
134 @param service The network service.
135 @result A reference to the new SCNetworkInterface.
136 You must release the returned value.
137 */
138 SCNetworkInterfaceRef
139 _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator,
140 CFDictionaryRef interface_entity,
141 SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
142
143 /*!
144 @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
145 @discussion Create a new network interface associated with the provided
146 IORegistry "IONetworkInterface" object.
147 @param if_obj The IONetworkInterface object.
148 @result A reference to the new SCNetworkInterface.
149 You must release the returned value.
150 */
151 SCNetworkInterfaceRef
152 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
153
154 /*!
155 @function _SCNetworkInterfaceGetHardwareAddress
156 @discussion Returns a link layer address for the interface.
157 @param interface The network interface.
158 @result The hardware (MAC) address for the interface.
159 NULL if no hardware address is available.
160 */
161 CFDataRef
162 _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
163
164 /*!
165 @function _SCNetworkInterfaceGetIOInterfaceType
166 @discussion Returns the IOInterfaceType for the interface.
167 @param interface The network interface.
168 @result The IOInterfaceType associated with the interface
169 */
170 CFNumberRef
171 _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
172
173 /*!
174 @function _SCNetworkInterfaceGetIOInterfaceUnit
175 @discussion Returns the IOInterfaceUnit for the interface.
176 @param interface The network interface.
177 @result The IOInterfaceUnit associated with the interface;
178 NULL if no IOLocation is available.
179 */
180 CFNumberRef
181 _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
182
183 /*!
184 @function _SCNetworkInterfaceGetIOPath
185 @discussion Returns the IOPath for the interface.
186 @param interface The network interface.
187 @result The IOPath associated with the interface;
188 NULL if no IOPath is available.
189 */
190 CFStringRef
191 _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
192
193 /*!
194 @function _SCNetworkInterfaceIsBuiltin
195 @discussion Identifies if a network interface is "built-in".
196 @param interface The network interface.
197 @result TRUE if the interface is "built-in".
198 */
199 Boolean
200 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
201
202 /*!
203 @function _SCNetworkInterfaceIsModemV92
204 @discussion Identifies if a modem network interface supports
205 v.92 (hold).
206 @param interface The network interface.
207 @result TRUE if the interface is "v.92" modem.
208 */
209 Boolean
210 _SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
211
212 /*!
213 @function _SCNetworkInterfaceForceConfigurationRefresh
214 @discussion Forces a configuration refresh of the
215 specified interface.
216 @param ifName Network interface name.
217 @result TRUE if the refresh was successfully posted.
218 */
219 Boolean
220 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
221
222 /*!
223 @function _SCBondInterfaceCopyActive
224 @discussion Returns all Ethernet Bond interfaces on the system.
225 @result The list of SCBondInterface interfaces on the system.
226 You must release the returned value.
227 */
228 CFArrayRef
229 _SCBondInterfaceCopyActive (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
230
231 /*!
232 @function _SCBondInterfaceUpdateConfiguration
233 @discussion Updates the bond interface configuration.
234 @param prefs The "preferences" session.
235 @result TRUE if the bond interface configuration was updated.; FALSE if the
236 an error was encountered.
237 */
238 Boolean
239 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
240
241 /*!
242 @function SCBondInterfaceSetMode
243 @discussion Set the mode on the bond interface.
244 @param bond The bond interface on which to adjust the mode.
245 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
246 @result TRUE if operation succeeded.
247 */
248 Boolean
249 SCBondInterfaceSetMode (SCBondInterfaceRef bond,
250 CFNumberRef mode) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
251
252 /*!
253 @function SCBondInterfaceSetMode
254 @discussion Return the mode for the given bond interface.
255 @param bond The bond interface to get the mode from.
256 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
257 */
258 CFNumberRef
259 SCBondInterfaceGetMode (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
260
261 /*!
262 @function _SCVLANInterfaceCopyActive
263 @discussion Returns all VLAN interfaces on the system.
264 @result The list of SCVLANInterface interfaces on the system.
265 You must release the returned value.
266 */
267 CFArrayRef
268 _SCVLANInterfaceCopyActive (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
269
270 /*!
271 @function _SCVLANInterfaceUpdateConfiguration
272 @discussion Updates the VLAN interface configuration.
273 @param prefs The "preferences" session.
274 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
275 an error was encountered.
276 */
277 Boolean
278 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
279
280
281 #pragma mark -
282 #pragma mark SCNetworkInterface Password SPIs
283
284
285 enum {
286 kSCNetworkInterfacePasswordTypePPP = 1,
287 kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
288 kSCNetworkInterfacePasswordTypeEAPOL,
289 };
290 typedef uint32_t SCNetworkInterfacePasswordType;
291
292 Boolean
293 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface,
294 SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
295
296 CFDataRef
297 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface,
298 SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
299
300 Boolean
301 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface,
302 SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
303
304 Boolean
305 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface,
306 SCNetworkInterfacePasswordType passwordType,
307 CFDataRef password,
308 CFDictionaryRef options) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
309
310
311 #pragma mark -
312 #pragma mark SCNetworkProtocol configuration (SPI)
313
314
315 /*!
316 @group Protocol configuration
317 */
318
319
320 static __inline__ CFTypeRef
321 isA_SCNetworkProtocol(CFTypeRef obj)
322 {
323 return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
324 }
325
326
327 #pragma mark -
328 #pragma mark SCNetworkService configuration (SPI)
329
330
331 /*!
332 @group Service configuration
333 */
334
335
336 static __inline__ CFTypeRef
337 isA_SCNetworkService(CFTypeRef obj)
338 {
339 return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
340 }
341
342
343 #pragma mark -
344 #pragma mark SCNetworkSet configuration (SPI)
345
346
347 /*!
348 @group Set configuration
349 */
350
351
352 static __inline__ CFTypeRef
353 isA_SCNetworkSet(CFTypeRef obj)
354 {
355 return (isA_CFType(obj, SCNetworkSetGetTypeID()));
356 }
357
358
359 /*!
360 @function SCNetworkSetEstablishDefaultConfiguration
361 @discussion Updates a network set by adding services for
362 any network interface that is not currently
363 represented.
364 If the provided set contains one (or more) services, new
365 services will only be added for those interfaces that are
366 not represented in *any* set.
367 Otherwise, new services will be added for those interfaces
368 that are not represented in the provided set.
369 The new services are established with "default" configuration
370 options.
371 @param set The network set.
372 @result TRUE if the configuration was updated; FALSE if no
373 changes were required or if an error was encountered.
374 */
375 Boolean
376 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set);
377
378 /*!
379 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
380 @discussion Updates a network set by adding services for
381 the specified network interface if is not currently
382 represented.
383 If the provided set contains one (or more) services, new
384 services will only be added for interfaces that are not
385 represented in *any* set.
386 Otherwise, new services will be added for interfaces that
387 are not represented in the provided set.
388 The new services are established with "default" configuration
389 options.
390 @param set The network set.
391 @param interface The network interface.
392 @result TRUE if the configuration was updated; FALSE if no
393 changes were required or if an error was encountered.
394 */
395 Boolean
396 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set,
397 SCNetworkInterfaceRef interface);
398
399 __END_DECLS
400
401 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
402
403 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */