]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h
ddc8ba74a7153411f6594e2f41546cee12669fdc
[apple/configd.git] / SystemConfiguration.fproj / SCNetworkConfigurationPrivate.h
1 /*
2 * Copyright (c) 2005-2013 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 <Availability.h>
28 #include <TargetConditionals.h>
29 #include <sys/cdefs.h>
30 #include <CoreFoundation/CoreFoundation.h>
31 #include <SystemConfiguration/SystemConfiguration.h>
32 #include <SystemConfiguration/SCValidation.h>
33 #include <IOKit/IOKitLib.h>
34
35 /*!
36 @header SCNetworkConfigurationPrivate
37 */
38
39 __BEGIN_DECLS
40
41
42 /*!
43 @group Interface configuration
44 */
45
46 #pragma mark -
47 #pragma mark SCNetworkInterface configuration (typedefs, consts, enums)
48
49 /*!
50 @const kSCNetworkInterfaceTypeBridge
51 */
52 extern const CFStringRef kSCNetworkInterfaceTypeBridge __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
53
54 /*!
55 @const kSCNetworkInterfaceTypeLoopback
56 */
57 extern const CFStringRef kSCNetworkInterfaceTypeLoopback __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
58
59 /*!
60 @const kSCNetworkInterfaceLoopback
61 @discussion A network interface representing the loopback
62 interface (lo0).
63 */
64 extern const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
65
66 /*!
67 @const kSCNetworkInterfaceTypeVPN
68 */
69 extern const CFStringRef kSCNetworkInterfaceTypeVPN __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
70
71 /*!
72 @group Interface configuration (Bridge)
73 */
74
75 /*!
76 @typedef SCBridgeInterfaceRef
77 @discussion This is the type of a reference to an object that represents
78 a bridge interface.
79 */
80 typedef SCNetworkInterfaceRef SCBridgeInterfaceRef;
81
82 enum {
83 kSCNetworkServicePrimaryRankDefault = 0,
84 kSCNetworkServicePrimaryRankFirst = 1,
85 kSCNetworkServicePrimaryRankLast = 2,
86 kSCNetworkServicePrimaryRankNever = 3
87 };
88 typedef uint32_t SCNetworkServicePrimaryRank;
89
90 #pragma mark -
91 #pragma mark SCNetworkInterface configuration (SPI)
92
93 /*!
94 @group Interface configuration
95 */
96
97 static __inline__ CFTypeRef
98 isA_SCNetworkInterface(CFTypeRef obj)
99 {
100 return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
101 }
102
103 static __inline__ CFTypeRef
104 isA_SCBondInterface(CFTypeRef obj)
105 {
106 CFStringRef interfaceType;
107
108 if (!isA_SCNetworkInterface(obj)) {
109 // if not an SCNetworkInterface
110 return NULL;
111 }
112
113 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
114 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
115 // if not a Bond
116 return NULL;
117 }
118
119 return obj;
120 }
121
122 static __inline__ CFTypeRef
123 isA_SCBridgeInterface(CFTypeRef obj)
124 {
125 CFStringRef interfaceType;
126
127 if (!isA_SCNetworkInterface(obj)) {
128 // if not an SCNetworkInterface
129 return NULL;
130 }
131
132 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
133 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBridge)) {
134 // if not a bridge
135 return NULL;
136 }
137
138 return obj;
139 }
140
141 static __inline__ CFTypeRef
142 isA_SCVLANInterface(CFTypeRef obj)
143 {
144 CFStringRef interfaceType;
145
146 if (!isA_SCNetworkInterface(obj)) {
147 // if not an SCNetworkInterface
148 return NULL;
149 }
150
151 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
152 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
153 // if not a VLAN
154 return NULL;
155 }
156
157 return obj;
158 }
159
160 /*!
161 @function _SCNetworkInterfaceCompare
162 @discussion Compares two SCNetworkInterface objects.
163 @param val1 The SCNetworkInterface object.
164 @param val2 The SCNetworkInterface object.
165 @param context Not used.
166 @result A comparison result.
167 */
168 CFComparisonResult
169 _SCNetworkInterfaceCompare (const void *val1,
170 const void *val2,
171 void *context) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
172
173 /*!
174 @function _SCNetworkInterfaceCopyActive
175 @discussion Creates an SCNetworkInterface and associated with interface name
176 and SCDynamicStoreRef
177 @param the interface name
178 @param the SCDynamicStoreRef
179 @result the SCNetworkInterface
180 */
181 SCNetworkInterfaceRef
182 _SCNetworkInterfaceCopyActive (SCDynamicStoreRef store,
183 CFStringRef bsdName) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0);
184
185 /*!
186 @function _SCNetworkInterfaceCopyAllWithPreferences
187 Returns all network capable interfaces on the system.
188 @param prefs The "preferences" session.
189 @result The list of interfaces on the system.
190 You must release the returned value.
191 */
192 CFArrayRef /* of SCNetworkInterfaceRef's */
193 _SCNetworkInterfaceCopyAllWithPreferences (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
194
195 /*!
196 @function _SCNetworkInterfaceCopyBTPANInterface
197 @discussion Returns the SCNetworkInterface associated with the BT-PAN interface
198 @result The BT-PAN interface; NULL if the interface is not (yet) known.
199 */
200 SCNetworkInterfaceRef
201 _SCNetworkInterfaceCopyBTPANInterface (void) __OSX_AVAILABLE_STARTING(__MAC_10_8/*FIXME*/,__IPHONE_NA);
202
203 /*!
204 @function _SCNetworkInterfaceCopySlashDevPath
205 @discussion Returns the /dev pathname for the interface.
206 @param interface The network interface.
207 @result The /dev pathname associated with the interface (e.g. "/dev/modem");
208 NULL if no path is available.
209 */
210 CFStringRef
211 _SCNetworkInterfaceCopySlashDevPath (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
212
213 #define kIncludeNoVirtualInterfaces 0x0
214 #define kIncludeVLANInterfaces 0x1
215 #define kIncludeBondInterfaces 0x2
216 #define kIncludeBridgeInterfaces 0x4
217 #define kIncludeAllVirtualInterfaces 0xffffffff
218
219 /*!
220 @function _SCNetworkInterfaceCreateWithBSDName
221 @discussion Create a new network interface associated with the provided
222 BSD interface name. This API supports Ethernet, FireWire, and
223 IEEE 802.11 interfaces.
224 @param bsdName The BSD interface name.
225 @param flags Indicates whether virtual (Bond, Bridge, VLAN)
226 network interfaces should be included.
227 @result A reference to the new SCNetworkInterface.
228 You must release the returned value.
229 */
230 SCNetworkInterfaceRef
231 _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator,
232 CFStringRef bsdName,
233 UInt32 flags) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
234
235 /*!
236 @function _SCNetworkInterfaceCreateWithEntity
237 @discussion Create a new network interface associated with the provided
238 SCDynamicStore service entity dictionary.
239 @param interface_entity The entity dictionary.
240 @param service The network service.
241 @result A reference to the new SCNetworkInterface.
242 You must release the returned value.
243 */
244 SCNetworkInterfaceRef
245 _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator,
246 CFDictionaryRef interface_entity,
247 SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
248
249 /*!
250 @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
251 @discussion Create a new network interface associated with the provided
252 IORegistry "IONetworkInterface" object.
253 @param if_obj The IONetworkInterface object.
254 @result A reference to the new SCNetworkInterface.
255 You must release the returned value.
256 */
257 SCNetworkInterfaceRef
258 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
259
260 /*!
261 @function SCNetworkInterfaceGetPrimaryRank
262 @discussion We allow caller to retrieve the rank on an interface.
263 The key is stored in State:/Network/Interface/<ifname>/Service
264 @param the interface to get the rank
265 @result SCNetworkServicePrimaryRank
266 */
267 SCNetworkServicePrimaryRank
268 SCNetworkInterfaceGetPrimaryRank (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0);
269
270 /*!
271 @function SCNetworkInterfaceSetPrimaryRank
272 @discussion We allow caller to set an assertion on an interface.
273 @param the interface to set the rank assertion
274 @param the new rank to be set
275 @result TRUE if operation is successful; FALSE if an error was encountered.
276 */
277 Boolean
278 SCNetworkInterfaceSetPrimaryRank (SCNetworkInterfaceRef interface,
279 SCNetworkServicePrimaryRank newRank) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0);
280
281 #define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action")
282 #define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None")
283 #define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt")
284 #define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure")
285
286 #define kSCNetworkInterfaceNetworkConfigurationOverridesKey CFSTR("NetworkConfigurationOverrides")
287 #define kSCNetworkInterfaceHiddenConfigurationKey CFSTR("HiddenConfiguration")
288 #define kSCNetworkInterfaceHiddenPortKey CFSTR("HiddenPort")
289
290 // IORegistry property to indicate that a [WWAN] interface is not yet ready
291 #define kSCNetworkInterfaceInitializingKey CFSTR("Initializing")
292
293 /*!
294 @function _SCNetworkInterfaceCopyInterfaceInfo
295 @discussion Returns interface details
296 @param interface The network interface.
297 @result A dictionary with details about the network interface.
298 */
299 CFDictionaryRef
300 _SCNetworkInterfaceCopyInterfaceInfo (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
301
302 /*!
303 @function _SCNetworkInterfaceGetConfigurationAction
304 @discussion Returns a user-notification / auto-configuration action for the interface.
305 @param interface The network interface.
306 @result The user-notification / auto-configuration action;
307 NULL if the default action should be used.
308 */
309 CFStringRef
310 _SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
311
312 /*!
313 @function _SCNetworkInterfaceGetHardwareAddress
314 @discussion Returns a link layer address for the interface.
315 @param interface The network interface.
316 @result The hardware (MAC) address for the interface.
317 NULL if no hardware address is available.
318 */
319 CFDataRef
320 _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
321
322 /*!
323 @function _SCNetworkInterfaceGetIOInterfaceNamePrefix
324 @discussion Returns the IOInterfaceNamePrefix for the interface.
325 @param interface The network interface.
326 @result The IOInterfaceNamePrefix associated with the interface;
327 NULL if no IOInterfaceNamePrefix is available.
328 */
329 CFStringRef
330 _SCNetworkInterfaceGetIOInterfaceNamePrefix (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_6_0);
331
332 /*!
333 @function _SCNetworkInterfaceGetIOInterfaceType
334 @discussion Returns the IOInterfaceType for the interface.
335 @param interface The network interface.
336 @result The IOInterfaceType associated with the interface
337 */
338 CFNumberRef
339 _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
340
341 /*!
342 @function _SCNetworkInterfaceGetIOInterfaceUnit
343 @discussion Returns the IOInterfaceUnit for the interface.
344 @param interface The network interface.
345 @result The IOInterfaceUnit associated with the interface;
346 NULL if no IOInterfaceUnit is available.
347 */
348 CFNumberRef
349 _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
350
351 /*!
352 @function _SCNetworkInterfaceGetIOPath
353 @discussion Returns the IOPath for the interface.
354 @param interface The network interface.
355 @result The IOPath associated with the interface;
356 NULL if no IOPath is available.
357 */
358 CFStringRef
359 _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
360
361 /*!
362 @function _SCNetworkInterfaceGetIORegistryEntryID
363 @discussion Returns the IORegistry entry ID for the interface.
364 @param interface The network interface.
365 @result The IORegistry entry ID associated with the interface;
366 Zero if no entry ID is available.
367 */
368 uint64_t
369 _SCNetworkInterfaceGetIORegistryEntryID (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0);
370
371 /*!
372 @function _SCNetworkInterfaceIsBluetoothPAN
373 @discussion Identifies if a network interface is a Bluetooth PAN (GN) device.
374 @param interface The network interface.
375 @result TRUE if the interface is a Bluetooth PAN device.
376 */
377 Boolean
378 _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
379
380 /*!
381 @function _SCNetworkInterfaceIsBluetoothPAN_NAP
382 @discussion Identifies if a network interface is a Bluetooth PAN-NAP device.
383 @param interface The network interface.
384 @result TRUE if the interface is a Bluetooth PAN-NAP device.
385 */
386 Boolean
387 _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
388
389 /*!
390 @function _SCNetworkInterfaceIsBluetoothP2P
391 @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device.
392 @param interface The network interface.
393 @result TRUE if the interface is a Bluetooth P2P device.
394 */
395 Boolean
396 _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
397
398 /*!
399 @function _SCNetworkInterfaceIsBuiltin
400 @discussion Identifies if a network interface is "built-in".
401 @param interface The network interface.
402 @result TRUE if the interface is "built-in".
403 */
404 Boolean
405 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
406
407 /*!
408 @function _SCNetworkInterfaceIsHiddenConfiguration
409 @discussion Identifies if the configuration of a network interface should be
410 hidden from any user interface (e.g. the "Network" pref pane).
411 @param interface The network interface.
412 @result TRUE if the interface configuration should be hidden.
413 */
414 Boolean
415 _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
416
417 /*!
418 @function _SCNetworkInterfaceIsModemV92
419 @discussion Identifies if a modem network interface supports
420 v.92 (hold).
421 @param interface The network interface.
422 @result TRUE if the interface is "v.92" modem.
423 */
424 Boolean
425 _SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
426
427 /*!
428 @function _SCNetworkInterfaceIsTethered
429 @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
430 @param interface The network interface.
431 @result TRUE if the interface is a tethered device.
432 */
433 Boolean
434 _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
435
436 /*!
437 @function _SCNetworkInterfaceIsThunderbolt
438 @discussion Identifies if a network interface is a Thunderbolt device
439 @param interface The network interface.
440 @result TRUE if the interface is a Thunderbolt device.
441 */
442 Boolean
443 _SCNetworkInterfaceIsThunderbolt (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
444
445 /*!
446 @function _SCNetworkInterfaceIsPhysicalEthernet
447 @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
448 @param interface The network interface.
449 @result TRUE if the interface is a real ethernet interface.
450 */
451 Boolean
452 _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
453
454 /*!
455 @function _SCNetworkInterfaceForceConfigurationRefresh
456 @discussion Forces a configuration refresh of the
457 specified interface.
458 @param ifName Network interface name.
459 @result TRUE if the refresh was successfully posted.
460 */
461 Boolean
462 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
463
464 /*!
465 @function SCNetworkInterfaceCopyCapability
466 @discussion For the specified network interface, returns information
467 about the currently requested capabilities, the active capabilities,
468 and the capabilities which are available.
469 @param interface The desired network interface.
470 @param capability The desired capability.
471 @result a CFTypeRef representing the current value of requested
472 capability;
473 NULL if the capability is not available for this
474 interface or if an error was encountered.
475 You must release the returned value.
476 */
477 CFTypeRef
478 SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface,
479 CFStringRef capability) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
480
481 /*!
482 @function SCNetworkInterfaceSetCapability
483 @discussion For the specified network interface, sets the requested
484 capabilities.
485 @param interface The desired network interface.
486 @param capability The desired capability.
487 @param newValue The new requested setting for the capability;
488 NULL to restore the default setting.
489 @result TRUE if the configuration was updated; FALSE if an error was encountered.
490 */
491 Boolean
492 SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface,
493 CFStringRef capability,
494 CFTypeRef newValue) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
495
496 #pragma mark -
497 #pragma mark SCBondInterface configuration (SPIs)
498
499 /*!
500 @function _SCBondInterfaceCopyActive
501 @discussion Returns all Ethernet Bond interfaces on the system.
502 @result The list of SCBondInterface interfaces on the system.
503 You must release the returned value.
504 */
505 CFArrayRef
506 _SCBondInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
507
508 /*!
509 @function _SCBondInterfaceUpdateConfiguration
510 @discussion Updates the bond interface configuration.
511 @param prefs The "preferences" session.
512 @result TRUE if the bond interface configuration was updated.; FALSE if the
513 an error was encountered.
514 */
515 Boolean
516 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
517
518 /*!
519 @function SCBondInterfaceGetMode
520 @discussion Return the mode for the given bond interface.
521 @param bond The bond interface to get the mode from.
522 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
523 */
524 CFNumberRef
525 SCBondInterfaceGetMode (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
526
527 /*!
528 @function SCBondInterfaceSetMode
529 @discussion Set the mode on the bond interface.
530 @param bond The bond interface on which to adjust the mode.
531 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
532 @result TRUE if operation succeeded.
533 */
534 Boolean
535 SCBondInterfaceSetMode (SCBondInterfaceRef bond,
536 CFNumberRef mode) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
537
538 #pragma mark -
539 #pragma mark SCBridgeInterface configuration (SPIs)
540
541 /*!
542 @function SCBridgeInterfaceCopyAll
543 @discussion Returns all bridge interfaces on the system.
544 @param prefs The "preferences" session.
545 @result The list of bridge interfaces on the system.
546 You must release the returned value.
547 */
548 CFArrayRef /* of SCBridgeInterfaceRef's */
549 SCBridgeInterfaceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
550
551 /*!
552 @function SCBridgeInterfaceCopyAvailableMemberInterfaces
553 @discussion Returns all network capable devices on the system
554 that can be added to an bridge interface.
555 @param prefs The "preferences" session.
556 @result The list of interfaces.
557 You must release the returned value.
558 */
559 CFArrayRef /* of SCNetworkInterfaceRef's */
560 SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
561
562 /*!
563 @function SCBridgeInterfaceCreate
564 @discussion Create a new SCBridgeInterface interface.
565 @param prefs The "preferences" session.
566 @result A reference to the new SCBridgeInterface.
567 You must release the returned value.
568 */
569 SCBridgeInterfaceRef
570 SCBridgeInterfaceCreate (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
571
572 /*!
573 @function SCBridgeInterfaceRemove
574 @discussion Removes the SCBridgeInterface from the configuration.
575 @param bridge The SCBridgeInterface interface.
576 @result TRUE if the interface was removed; FALSE if an error was encountered.
577 */
578 Boolean
579 SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
580
581 /*!
582 @function SCBridgeInterfaceGetMemberInterfaces
583 @discussion Returns the member interfaces for the specified bridge interface.
584 @param bridge The SCBridgeInterface interface.
585 @result The list of interfaces.
586 */
587 CFArrayRef /* of SCNetworkInterfaceRef's */
588 SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
589
590 /*!
591 @function SCBridgeInterfaceGetOptions
592 @discussion Returns the configuration settings associated with a bridge interface.
593 @param bridge The SCBridgeInterface interface.
594 @result The configuration settings associated with the bridge interface;
595 NULL if no changes to the default configuration have been saved.
596 */
597 CFDictionaryRef
598 SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
599
600 /*!
601 @function SCBridgeInterfaceSetMemberInterfaces
602 @discussion Sets the member interfaces for the specified bridge interface.
603 @param bridge The SCBridgeInterface interface.
604 @param members The desired member interfaces.
605 @result TRUE if the configuration was stored; FALSE if an error was encountered.
606 */
607 Boolean
608 SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge,
609 CFArrayRef members) /* of SCNetworkInterfaceRef's */
610 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
611
612 /*!
613 @function SCBridgeInterfaceSetLocalizedDisplayName
614 @discussion Sets the localized display name for the specified bridge interface.
615 @param bridge The SCBridgeInterface interface.
616 @param newName The new display name.
617 @result TRUE if the configuration was stored; FALSE if an error was encountered.
618 */
619 Boolean
620 SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge,
621 CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
622
623 /*!
624 @function SCBridgeInterfaceSetOptions
625 @discussion Sets the configuration settings for the specified bridge interface.
626 @param bridge The SCBridgeInterface interface.
627 @param newOptions The new configuration settings.
628 @result TRUE if the configuration was stored; FALSE if an error was encountered.
629 */
630 Boolean
631 SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge,
632 CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
633
634 #pragma mark -
635
636 /*!
637 @function _SCBridgeInterfaceCopyActive
638 @discussion Returns all bridge interfaces on the system.
639 @result The list of SCBridgeInterface interfaces on the system.
640 You must release the returned value.
641 */
642 CFArrayRef
643 _SCBridgeInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
644
645 /*!
646 @function _SCBridgeInterfaceUpdateConfiguration
647 @discussion Updates the bridge interface configuration.
648 @param prefs The "preferences" session.
649 @result TRUE if the bridge interface configuration was updated.; FALSE if the
650 an error was encountered.
651 */
652 Boolean
653 _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
654
655
656 #pragma mark -
657 #pragma mark SCVLANInterface configuration (SPIs)
658
659 /*!
660 @function _SCVLANInterfaceCopyActive
661 @discussion Returns all VLAN interfaces on the system.
662 @result The list of SCVLANInterface interfaces on the system.
663 You must release the returned value.
664 */
665 CFArrayRef
666 _SCVLANInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
667
668 /*!
669 @function _SCVLANInterfaceUpdateConfiguration
670 @discussion Updates the VLAN interface configuration.
671 @param prefs The "preferences" session.
672 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
673 an error was encountered.
674 */
675 Boolean
676 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
677
678
679 #pragma mark -
680 #pragma mark SCNetworkInterface Password SPIs
681
682
683 enum {
684 kSCNetworkInterfacePasswordTypePPP = 1,
685 kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
686 kSCNetworkInterfacePasswordTypeEAPOL,
687 kSCNetworkInterfacePasswordTypeIPSecXAuth,
688 kSCNetworkInterfacePasswordTypeVPN,
689 };
690 typedef uint32_t SCNetworkInterfacePasswordType;
691
692 Boolean
693 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface,
694 SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
695
696 CFDataRef
697 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface,
698 SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
699
700 Boolean
701 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface,
702 SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
703
704 Boolean
705 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface,
706 SCNetworkInterfacePasswordType passwordType,
707 CFDataRef password,
708 CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
709
710
711 #pragma mark -
712 #pragma mark SCNetworkProtocol configuration (SPI)
713
714
715 /*!
716 @group Protocol configuration
717 */
718
719
720 static __inline__ CFTypeRef
721 isA_SCNetworkProtocol(CFTypeRef obj)
722 {
723 return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
724 }
725
726
727 #pragma mark -
728 #pragma mark SCNetworkService configuration (SPI)
729
730
731 /*!
732 @group Service configuration
733 */
734
735
736 static __inline__ CFTypeRef
737 isA_SCNetworkService(CFTypeRef obj)
738 {
739 return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
740 }
741
742 /*!
743 @function _SCNetworkServiceCompare
744 @discussion Compares two SCNetworkService objects.
745 @param val1 The SCNetworkService object.
746 @param val2 The SCNetworkService object.
747 @param context The service order (from SCNetworkSetGetServiceOrder).
748 @result A comparison result.
749 */
750 CFComparisonResult
751 _SCNetworkServiceCompare (const void *val1,
752 const void *val2,
753 void *context) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
754
755 /*!
756 @function _SCNetworkServiceCopyActive
757 @discussion Returns the network service with the specified identifier.
758
759 Note: The service returned by this SPI differs from the SCNetworkServiceCopy
760 API in that queries and operations interact with the "active" service
761 represented in the SCDynamicStore. Only a limited subset of the
762 SCNetworkService APIs are supported.
763 @param prefs The dynamic store session.
764 @param serviceID The unique identifier for the service.
765 @result A reference to the SCNetworkService represented in the SCDynamicStore;
766 NULL if the serviceID does not exist in the SCDynamicStore or if an
767 error was encountered.
768 You must release the returned value.
769 */
770 SCNetworkServiceRef
771 _SCNetworkServiceCopyActive (SCDynamicStoreRef store,
772 CFStringRef serviceID) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_1);
773
774 /*!
775 @function SCNetworkServiceGetPrimaryRank
776 @discussion Returns the primary service rank associated with a service.
777 @param service The network service.
778 @result The primary service rank associated with the specified application;
779 kSCNetworkServicePrimaryRankDefault if no rank is associated with the
780 application or an error was encountered.
781 */
782 SCNetworkServicePrimaryRank
783 SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
784
785 /*!
786 @function SCNetworkServiceSetPrimaryRank
787 @discussion Updates the the primary service rank associated with a service.
788 @param service The network service.
789 @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
790 if the default service rank should be used.
791 @result TRUE if the rank was stored; FALSE if an error was encountered.
792
793 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
794 values can only valid as a transient setting.
795 */
796 Boolean
797 SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service,
798 SCNetworkServicePrimaryRank newRank) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
799
800 /*!
801 @function _SCNetworkServiceIsVPN
802 @discussion Identifies a VPN service.
803 @param service The network service.
804 @result TRUE if the service is a VPN.
805 */
806 Boolean
807 _SCNetworkServiceIsVPN (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
808
809 /*!
810 @function SCNetworkServiceSetExternalID
811 @discussion Set the external identifier for a network service.
812 @param service A reference to the network service.
813 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to set.
814 @param identifier The new external identifier to assign to the network service.
815 @result Returns TRUE if the external identifier was set successfully, FALSE if an error occurred.
816 */
817 Boolean
818 SCNetworkServiceSetExternalID (SCNetworkServiceRef service,
819 CFStringRef identifierDomain,
820 CFStringRef identifier);
821
822 /*!
823 @function SCNetworkServiceCopyExternalID
824 @discussion Copy the external identifier for a network service.
825 @param service The network service.
826 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to copy.
827 @result Returns the service's external identifier, or NULL if the service does not have an external identifier in the given domain.
828 */
829 CFStringRef
830 SCNetworkServiceCopyExternalID (SCNetworkServiceRef service,
831 CFStringRef identifierDomain);
832
833 #pragma mark -
834 #pragma mark SCNetworkSet configuration (SPI)
835
836
837 /*!
838 @group Set configuration
839 */
840
841
842 static __inline__ CFTypeRef
843 isA_SCNetworkSet(CFTypeRef obj)
844 {
845 return (isA_CFType(obj, SCNetworkSetGetTypeID()));
846 }
847
848
849 /*!
850 @function SCNetworkSetCopyAvailableInterfaces
851 @discussion Returns all available interfaces for the set.
852 The interfaces excludes those of bond and bridge members.
853 @param set The network set.
854 @result The list of SCNetworkInterfaces.
855 You must release the returned value.
856 */
857 CFArrayRef
858 SCNetworkSetCopyAvailableInterfaces (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/);
859
860 /*!
861 @function SCNetworkSetEstablishDefaultConfiguration
862 @discussion Updates a network set by adding services for
863 any network interface that is not currently
864 represented.
865 If the provided set contains one (or more) services, new
866 services will only be added for those interfaces that are
867 not represented in *any* set.
868 Otherwise, new services will be added for those interfaces
869 that are not represented in the provided set.
870 The new services are established with "default" configuration
871 options.
872 @param set The network set.
873 @result TRUE if the configuration was updated; FALSE if no
874 changes were required or if an error was encountered.
875 */
876 Boolean
877 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
878
879 /*!
880 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
881 @discussion Updates a network set by adding services for
882 the specified network interface if is not currently
883 represented.
884 If the provided set contains one (or more) services, new
885 services will only be added for interfaces that are not
886 represented in *any* set.
887 Otherwise, new services will be added for interfaces that
888 are not represented in the provided set.
889 The new services are established with "default" configuration
890 options.
891 @param set The network set.
892 @param interface The network interface.
893 @result TRUE if the configuration was updated; FALSE if no
894 changes were required or if an error was encountered.
895 */
896 Boolean
897 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set,
898 SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
899
900 /*!
901 @function SCNetworkSetCopySelectedVPNService
902 @discussion On the iPhone we only allow a single VPN network service
903 to be selected at any given time. This API will identify
904 the selected VPN service.
905 @param set The network set.
906 @result The selected VPN service; NULL if no service has been
907 selected.
908 You must release the returned value.
909 */
910 SCNetworkServiceRef
911 SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
912
913 /*!
914 @function SCNetworkSetSetSelectedVPNService
915 @discussion On the iPhone we only allow a single VPN network service
916 to be selected at any given time. This API should be used to
917 select a VPN service.
918 @param set The network set.
919 @param service The VPN service to be selected.
920 @result TRUE if the name was saved; FALSE if an error was encountered.
921 */
922 Boolean
923 SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set,
924 SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
925
926 /*!
927 @group VPN Service configuration
928 */
929
930 #pragma mark -
931 #pragma mark VPN Service configuration
932
933 typedef SCNetworkServiceRef VPNServiceRef;
934
935 /*!
936 @function VPNServiceCopyAllMatchingExternalID
937 @discussion Copy the VPN services with the given external identifier.
938 @param prefs A reference to the prefs where the VPN services are stored.
939 @param identifierDomain A service can have multiple external identifiers. This string specifies which one to match with the given identifier.
940 @param identifier The external identifier of the desired services.
941 @result A array of references to the VPN services with the given identifier, or NULL if no such service exists
942 */
943 CFArrayRef
944 VPNServiceCopyAllMatchingExternalID (SCPreferencesRef prefs,
945 CFStringRef identifierDomain,
946 CFStringRef identifier) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/);
947
948 /*!
949 @function VPNServiceCopyAll
950 @discussion Copy all VPN services.
951 @param prefs A reference to the prefs where the VPN services are stored.
952 @result An array containing VPNServiceRefs for all the VPN services.
953 */
954 CFArrayRef
955 VPNServiceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/);
956
957 /*!
958 @function VPNServiceCopyAppRuleIDs
959 @discussion Copy all the app rule identifiers for a VPN service.
960 @param service A reference to the VPN service.
961 @result An array of CFStringRefs, each string containing the identifier of a app rule in the given service.
962 */
963 CFArrayRef
964 VPNServiceCopyAppRuleIDs (VPNServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/);
965
966 /*!
967 @function VPNServiceSetAppRule
968 @discussion Add or modify an app rule in a VPN service. The ruleSettings dictionary must contain one of the following keys:
969 <pre>kSCValNetVPNAppRuleExecutableMatch</pre>
970 <pre>kSCValNetVPNAppRuleAccountIdentifierMatch</pre>
971 The ruleSettings dictionary may also contain the following keys:
972 <pre>kSCValNetVPNAppRuleDNSDomainMatch</pre>
973 See SCSchemaDefinitionsPrivate.h for more details.
974 @param service A reference to the VPN service.
975 @param ruleIdentifier The identifier of the new app rule.
976 @param ruleSettings The settings for the new app rule. See the dictionary keys defined above.
977 @result TRUE if the app rule was set successfully, FALSE if an error occurred.
978 */
979 Boolean
980 VPNServiceSetAppRule (VPNServiceRef service,
981 CFStringRef ruleIdentifier,
982 CFDictionaryRef ruleSettings) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/);
983
984 /*!
985 @function VPNServiceCopyAppRule
986 @discussion Copy the settings for a app rule in a VPN service.
987 @param service The app tunnel service.
988 @param ruleIdentifier The ID of the app rule.
989 @result The rule settings, or NULL if the app rule could not be found.
990 */
991 CFDictionaryRef
992 VPNServiceCopyAppRule (VPNServiceRef service,
993 CFStringRef ruleIdentifier) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/);
994
995 /*!
996 @function VPNServiceRemoveAppRule
997 @discussion Remove an app rule from a VPN service.
998 @param service The VPN service.
999 @param ruleIdentifier The ID of the app rule to remove.
1000 @result Returns TRUE if the app rule was removed successfully; FALSE otherwise.
1001 */
1002 Boolean
1003 VPNServiceRemoveAppRule (VPNServiceRef service,
1004 CFStringRef ruleIdentifier) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/);
1005
1006 __END_DECLS
1007 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */