Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
15 kB · 563 lines
C
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564/* * Copyright (c) 2004-2018 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */
#ifndef _SCNETWORKCONFIGURATIONINTERNAL_H#define _SCNETWORKCONFIGURATIONINTERNAL_H
#include <TargetConditionals.h>#include <CoreFoundation/CoreFoundation.h>#include <CoreFoundation/CFRuntime.h>
#ifndef SC_LOG_HANDLE#define SC_LOG_HANDLE __log_SCNetworkConfiguration#endif // SC_LOG_HANDLE#include <SystemConfiguration/SystemConfiguration.h>#include <SystemConfiguration/SCPrivate.h>#include <SystemConfiguration/SCValidation.h>#include "SCPreferencesPathKey.h"#include "IPMonitorControl.h"#include <IOKit/IOKitLib.h>
typedef struct {
// base CFType information CFRuntimeBase cfBase;
// set id CFStringRef setID;
// prefs SCPreferencesRef prefs;
// name CFStringRef name;
// misc Boolean established;
} SCNetworkSetPrivate, *SCNetworkSetPrivateRef;
typedef struct {
// base CFType information CFRuntimeBase cfBase;
// service id CFStringRef serviceID;
// interface SCNetworkInterfaceRef interface;
// prefs SCPreferencesRef prefs;
// store (for live SCNetworkService) SCDynamicStoreRef store;
// name CFStringRef name;
// external identifiers CFMutableDictionaryRef externalIDs;
} SCNetworkServicePrivate, *SCNetworkServicePrivateRef;
typedef struct {
// base CFType information CFRuntimeBase cfBase;
// entity id CFStringRef entityID;
// service SCNetworkServiceRef service;
} SCNetworkProtocolPrivate, *SCNetworkProtocolPrivateRef;
typedef struct {
// base CFType information CFRuntimeBase cfBase;
// interface information CFStringRef interface_type; // interface type
Boolean active;
// [non-localized] name CFStringRef name; // non-localized [display] name
// localized name CFStringRef localized_name; // localized [display] name CFStringRef localized_key; CFStringRef localized_arg1; CFStringRef localized_arg2;
// [layered] interface SCNetworkInterfaceRef interface;
// prefs (for associated service, BOND interfaces, and VLAN interfaces) SCPreferencesRef prefs;
// SCDynamicStore SCDynamicStoreRef store;
// serviceID (NULL if not associated with a service) CFStringRef serviceID;
// unsaved configuration (when prefs not [yet] available) CFMutableDictionaryRef unsaved;
// [SCPreferences] interface entity information CFStringRef entity_device; // interface device CFStringRef entity_device_unique; // ... UniqueIdentifier CFStringRef entity_type; // interface type CFStringRef entity_subtype; // interface subtype
// configuration information CFMutableArrayRef supported_interface_types; CFMutableArrayRef supported_protocol_types;
// IORegistry (service plane) information CFDataRef address; CFStringRef addressString; Boolean builtin; CFStringRef configurationAction; Boolean hidden; CFStringRef location; CFStringRef path; uint64_t entryID; CFMutableDictionaryRef overrides; CFStringRef prefix; Boolean trustRequired; CFNumberRef type; CFNumberRef unit; CFNumberRef family; CFNumberRef subfamily; struct { CFStringRef name; CFNumberRef vid; CFNumberRef pid; } usb;
// misc unsigned int sort_order; // sort order for this interface
// for BOND interfaces Boolean supportsBond; struct { CFArrayRef interfaces; CFNumberRef mode; CFDictionaryRef options; } bond;
// for Bridge interfaces Boolean supportsBridge; struct { CFArrayRef interfaces; CFDictionaryRef options; } bridge;
// for VLAN interfaces Boolean supportsVLAN; struct { SCNetworkInterfaceRef interface; CFNumberRef tag; // e.g. 1 <= tag <= 4094 CFDictionaryRef options; } vlan;
// for interface rank assertions IPMonitorControlRef IPMonitorControl;
} SCNetworkInterfacePrivate, *SCNetworkInterfacePrivateRef;
__BEGIN_DECLS
#pragma mark -#pragma mark SCNetworkInterface configuration (internal)
Boolean__SCNetworkInterfaceMatchesName (CFStringRef name, CFStringRef key);
CFArrayRef__SCNetworkInterfaceCopyAll_IONetworkInterface (Boolean keep_pre_configured);
/*! @function __SCNetworkInterfaceCopyStorageEntity @discussion Create interface entity of network interface as seen in NetworkInterfaces.plist @param interface The network interface from which interface entity is create @result Dictionary which contains information about interface entity You must release the returned value. */CFDictionaryRef__SCNetworkInterfaceCopyStorageEntity (SCNetworkInterfaceRef interface);
/*! @function __SCNetworkInterfaceCopyStoredWithPreferences @discussion Create an array of network interfaces, which is present in the preferences in NetworkInteraces.plist @param ni_prefs Preference for network interfaces @result Array which contains SCNetworkInterfaceRef. You must release the returned value. */
CFArrayRef // SCNetworkInterfaceRef__SCNetworkInterfaceCopyStoredWithPreferences (SCPreferencesRef ni_prefs);
SCNetworkInterfacePrivateRef__SCNetworkInterfaceCreateCopy (CFAllocatorRef allocator, SCNetworkInterfaceRef interface, SCPreferencesRef prefs, CFStringRef serviceID);
/*! @function __SCNetworkInterfaceCreateMappingUsingBSDName @discussion This function creates mapping of BSD name and network interface using preferences which point to the NetworkInterfaces.plist file. @param interfaces An array of network interfaces to use for the mapping. @result BSD Mapping in a dictionary. You must release the returned value. */CFDictionaryRef__SCNetworkInterfaceCreateMappingUsingBSDName (CFArrayRef interfaces);
SCNetworkInterfaceRef__SCNetworkInterfaceCreateWithNIPreferencesUsingBSDName(CFAllocatorRef allocator, SCPreferencesRef ni_prefs, CFStringRef bsdName);
SCNetworkInterfacePrivateRef__SCNetworkInterfaceCreatePrivate (CFAllocatorRef allocator, SCNetworkInterfaceRef interface, SCPreferencesRef prefs, CFStringRef serviceID);
SCNetworkInterfacePrivateRef_SCBondInterfaceCreatePrivate (CFAllocatorRef allocator, CFStringRef bond_if);
SCNetworkInterfacePrivateRef_SCBridgeInterfaceCreatePrivate (CFAllocatorRef allocator, CFStringRef bridge_if);
SCNetworkInterfacePrivateRef_SCVLANInterfaceCreatePrivate (CFAllocatorRef allocator, CFStringRef vlan_if);
CFDictionaryRef__SCNetworkInterfaceCopyInterfaceEntity (SCNetworkInterfaceRef interface);
CFArrayRef__SCNetworkInterfaceCopyDeepConfiguration (SCNetworkSetRef set, SCNetworkInterfaceRef interface);
#if !TARGET_OS_IPHONECFStringRef__SCNetworkInterfaceCopyXLocalizedDisplayName (SCNetworkInterfaceRef interface);
CFStringRef__SCNetworkInterfaceCopyXNonLocalizedDisplayName(SCNetworkInterfaceRef interface);#endif // !TARGET_OS_IPHONE
CFStringRef__SCNetworkInterfaceGetDefaultConfigurationType (SCNetworkInterfaceRef interface);
CFStringRef__SCNetworkInterfaceGetEntitySubType (SCNetworkInterfaceRef interface);
CFStringRef__SCNetworkInterfaceGetEntityType (SCNetworkInterfaceRef interface);
CFStringRef__SCNetworkInterfaceGetNonLocalizedDisplayName (SCNetworkInterfaceRef interface);
void__SCNetworkInterfaceSetUserDefinedName(SCNetworkInterfaceRef interface, CFStringRef name);
/*! @function __SCNetworkInterfaceGetUserDefinedName @discussion This function returns the user defined name of the interface if available @param interface The network interface. @result String containing the user defined name. */CFStringRef__SCNetworkInterfaceGetUserDefinedName(SCNetworkInterfaceRef interface);
/*! @function __SCNetworkInterfaceIsActive @discussion Identifies if the configuration of network interface is active or not @param interface The network interface @result TRUE if the interface configuration is active. */Boolean__SCNetworkInterfaceIsActive (SCNetworkInterfaceRef interface);
Boolean__SCNetworkInterfaceIsMember (SCPreferencesRef prefs, SCNetworkInterfaceRef interface);
Boolean__SCNetworkInterfaceEntityIsPPTP (CFDictionaryRef entity);
Boolean__SCNetworkInterfaceIsValidExtendedConfigurationType (SCNetworkInterfaceRef interface, CFStringRef extendedType, Boolean requirePerInterface);
CFPropertyListRef__SCNetworkInterfaceGetTemplateOverrides (SCNetworkInterfaceRef interface, CFStringRef overrideType);
int__SCNetworkInterfaceOrder (SCNetworkInterfaceRef interface);
/*! @function __SCNetworkInterfaceSaveStoredWithPreferences @discussion Saves the array of interfaces in the preferences passed in the function. The interfaces which are already present in the prefs file are replaced. @param prefs Preferences which contain the interfaces to be replaced. If NULL, then preferences on the system are used. @param interfacesToSave The new interfaces array which is to be stored in preferences. @result TRUE if saving of the new interfaces was successful. */
Boolean__SCNetworkInterfaceSaveStoredWithPreferences (SCPreferencesRef prefs, CFArrayRef interfacesToSave);
Boolean__SCNetworkInterfaceSetConfiguration (SCNetworkInterfaceRef interface, CFStringRef extendedType, CFDictionaryRef config, Boolean okToHold);
void__SCNetworkInterfaceSetDeepConfiguration (SCNetworkSetRef set, SCNetworkInterfaceRef interface, CFArrayRef configs);
/*! @function __SCNetworkInterfaceSetIOInterfaceUnity @discussion Will allow the caller to set IO Interface Unit @param interface The network interface @param unit The new interface unit to set
*/void__SCNetworkInterfaceSetIOInterfaceUnit (SCNetworkInterfaceRef interface, CFNumberRef unit);
Boolean__SCNetworkInterfaceSupportsVLAN (CFStringRef bsd_if);
void__SCBondInterfaceListCollectMembers (CFArrayRef interfaces, CFMutableSetRef set);
Boolean__SCBondInterfaceSetMemberInterfaces (SCBondInterfaceRef bond, CFArrayRef members);
void__SCBridgeInterfaceListCollectMembers (CFArrayRef interfaces, CFMutableSetRef set);
Boolean__SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge, CFArrayRef members);
void_SCNetworkInterfaceCacheOpen(void);
void_SCNetworkInterfaceCacheClose(void);
#pragma mark -#pragma mark SCNetworkProtocol configuration (internal)
SCNetworkProtocolPrivateRef__SCNetworkProtocolCreatePrivate (CFAllocatorRef allocator, CFStringRef entityID, SCNetworkServiceRef service);
Boolean__SCNetworkProtocolIsValidType (CFStringRef protocolType);
#pragma mark -#pragma mark SCNetworkService configuration (internal)
CFArrayRef /* of SCNetworkServiceRef's */__SCNetworkServiceCopyAllEnabled (SCPreferencesRef prefs);
CFArrayRef /* of SCNetworkInterfaceRef's */__SCNetworkServiceCopyAllInterfaces (SCPreferencesRef prefs);
SCNetworkServicePrivateRef__SCNetworkServiceCreatePrivate (CFAllocatorRef allocator, SCPreferencesRef prefs, CFStringRef serviceID, SCNetworkInterfaceRef interface);
Boolean__SCNetworkServiceExists (SCNetworkServiceRef service);
Boolean__SCNetworkServiceExistsForInterface (CFArrayRef services, SCNetworkInterfaceRef interface);
Boolean__SCNetworkServiceCreate (SCPreferencesRef prefs, SCNetworkInterfaceRef interface, CFStringRef userDefinedName);
Boolean__SCNetworkServiceIsPPTP (SCNetworkServiceRef service);
SCPreferencesRef__SCNetworkCreateDefaultNIPrefs (CFStringRef prefsID);
/*! @function __SCNetworkServiceMigrateNew @discussion Adds network service to SCPreferencesRef if it doesn't exists @param prefs SCPreferencesRef @param service The network service @param bsdMapping Mapping of interface names between configurations @result TRUE if add service to prefs is successful */Boolean__SCNetworkServiceMigrateNew (SCPreferencesRef prefs, SCNetworkServiceRef service, CFDictionaryRef bsdMapping, CFDictionaryRef setMapping, CFDictionaryRef serviceSetMapping);
void__SCNetworkServiceAddProtocolToService (SCNetworkServiceRef service, CFStringRef protocolType, CFDictionaryRef configuration, Boolean enabled);
#pragma mark -#pragma mark SCNetworkSet configuration (internal)
Boolean__SCNetworkSetExists (SCNetworkSetRef set);
#pragma mark -#pragma mark Logging
os_log_t__log_SCNetworkConfiguration (void);
#pragma mark -#pragma mark Miscellaneous (internal)
CFDictionaryRef__copyInterfaceTemplate (CFStringRef interfaceType, CFStringRef childInterfaceType);
CFDictionaryRef__copyProtocolTemplate (CFStringRef interfaceType, CFStringRef childInterfaceType, CFStringRef protocolType);
CFDictionaryRef__getPrefsConfiguration (SCPreferencesRef prefs, CFStringRef path);
Boolean__setPrefsConfiguration (SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef config, Boolean keepInactive);
Boolean__getPrefsEnabled (SCPreferencesRef prefs, CFStringRef path);
Boolean__setPrefsEnabled (SCPreferencesRef prefs, CFStringRef path, Boolean enabled);
Boolean__createInterface (int s, CFStringRef interface);
Boolean__destroyInterface (int s, CFStringRef interface);
CFStringRef__SCPreferencesPathCreateUniqueChild_WithMoreSCFCompatibility (SCPreferencesRef prefs, CFStringRef prefix);
Boolean__extract_password (SCPreferencesRef prefs, CFDictionaryRef config, CFStringRef passwordKey, CFStringRef encryptionKey, CFStringRef encryptionKeyChainValue, CFStringRef unique_id, CFDataRef *password);
Boolean__remove_password (SCPreferencesRef prefs, CFDictionaryRef config, CFStringRef passwordKey, CFStringRef encryptionKey, CFStringRef encryptionKeyChainValue, CFStringRef unique_id, CFDictionaryRef *newConfig);
Boolean__rank_to_str (SCNetworkServicePrimaryRank rank, CFStringRef *rankStr);
Boolean__str_to_rank (CFStringRef rankStr, SCNetworkServicePrimaryRank *rank);
__END_DECLS
#endif /* _SCNETWORKCONFIGURATIONINTERNAL_H */