this repo has no description
at fixPythonPipStalling 249 lines 5.2 kB view raw
1/* 2 * Copyright (c) 2001, 2004, 2005, 2010, 2015 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/* 25 * Modification History 26 * 27 * October 29, 2001 Allan Nathanson <ajn@apple.com> 28 * - initial revision 29 */ 30 31#include <SystemConfiguration/SystemConfiguration.h> 32 33#include <stdarg.h> 34 35CFStringRef 36SCPreferencesPathKeyCreate(CFAllocatorRef allocator, 37 CFStringRef fmt, 38 ...) 39{ 40 va_list args; 41 CFStringRef result; 42 43 va_start(args, fmt); 44 result = CFStringCreateWithFormatAndArguments(allocator, 45 NULL, 46 fmt, 47 args); 48 va_end(args); 49 50 return result; 51} 52 53 54CFStringRef 55SCPreferencesPathKeyCreateNetworkServices(CFAllocatorRef allocator) 56{ 57 /* 58 * create "/NetworkServices" 59 */ 60 return CFStringCreateWithFormat(allocator, 61 NULL, 62 CFSTR("/%@"), 63 kSCPrefNetworkServices); 64} 65 66 67CFStringRef 68SCPreferencesPathKeyCreateNetworkServiceEntity(CFAllocatorRef allocator, 69 CFStringRef service, 70 CFStringRef entity) 71{ 72 CFStringRef path; 73 74 if (entity == NULL) { 75 /* 76 * create "/NetworkServices/service-id" 77 */ 78 path = CFStringCreateWithFormat(allocator, 79 NULL, 80 CFSTR("/%@/%@"), 81 kSCPrefNetworkServices, 82 service); 83 } else { 84 /* 85 * create "/NetworkServices/service-id/entity" 86 */ 87 path = CFStringCreateWithFormat(allocator, 88 NULL, 89 CFSTR("/%@/%@/%@"), 90 kSCPrefNetworkServices, 91 service, 92 entity); 93 } 94 95 return path; 96} 97 98 99CFStringRef 100SCPreferencesPathKeyCreateSets(CFAllocatorRef allocator) 101{ 102 /* 103 * create "/Sets" 104 */ 105 return (CFStringCreateWithFormat(allocator, 106 NULL, 107 CFSTR("/%@"), 108 kSCPrefSets)); 109} 110 111 112CFStringRef 113SCPreferencesPathKeyCreateSet(CFAllocatorRef allocator, 114 CFStringRef set) 115{ 116 /* 117 * create "/Sets/set-id" 118 */ 119 return (CFStringCreateWithFormat(allocator, 120 NULL, 121 CFSTR("/%@/%@"), 122 kSCPrefSets, 123 set)); 124} 125 126 127CFStringRef 128SCPreferencesPathKeyCreateSetNetworkGlobalEntity(CFAllocatorRef allocator, 129 CFStringRef set, 130 CFStringRef entity) 131{ 132 /* 133 * create "/Sets/set-id/Network/Global/entity" 134 */ 135 return CFStringCreateWithFormat(allocator, 136 NULL, 137 CFSTR("/%@/%@/%@/%@/%@"), 138 kSCPrefSets, 139 set, 140 kSCCompNetwork, 141 kSCCompGlobal, 142 entity); 143} 144 145 146CFStringRef 147SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(CFAllocatorRef allocator, 148 CFStringRef set, 149 CFStringRef ifname, 150 CFStringRef entity) 151{ 152 /* 153 * create "/Sets/set-id/Network/Interface/interface-name/entity" 154 */ 155 if (entity == NULL) { 156 return CFStringCreateWithFormat(allocator, 157 NULL, 158 CFSTR("/%@/%@/%@/%@/%@"), 159 kSCPrefSets, 160 set, 161 kSCCompNetwork, 162 kSCCompInterface, 163 ifname); 164 } 165 return CFStringCreateWithFormat(allocator, 166 NULL, 167 CFSTR("/%@/%@/%@/%@/%@/%@"), 168 kSCPrefSets, 169 set, 170 kSCCompNetwork, 171 kSCCompInterface, 172 ifname, 173 entity); 174} 175 176 177CFStringRef 178SCPreferencesPathKeyCreateSetNetworkService(CFAllocatorRef allocator, 179 CFStringRef set, 180 CFStringRef service) 181{ 182 CFStringRef path; 183 184 if (service == NULL) { 185 /* 186 * create "/Sets/set-id/Network/Service" 187 */ 188 path = CFStringCreateWithFormat(allocator, 189 NULL, 190 CFSTR("/%@/%@/%@/%@"), 191 kSCPrefSets, 192 set, 193 kSCCompNetwork, 194 kSCCompService); 195 } else { 196 /* 197 * create "/Sets/set-id/Network/Service/service-id" 198 */ 199 path = CFStringCreateWithFormat(allocator, 200 NULL, 201 CFSTR("/%@/%@/%@/%@/%@"), 202 kSCPrefSets, 203 set, 204 kSCCompNetwork, 205 kSCCompService, 206 service); 207 } 208 209 return path; 210} 211 212 213CFStringRef 214SCPreferencesPathKeyCreateSetNetworkServiceEntity(CFAllocatorRef allocator, 215 CFStringRef set, 216 CFStringRef service, 217 CFStringRef entity) 218{ 219 CFStringRef path; 220 221 if (entity == NULL) { 222 /* 223 * create "/Sets/set-id/Network/Service/service-id" 224 */ 225 path = CFStringCreateWithFormat(allocator, 226 NULL, 227 CFSTR("/%@/%@/%@/%@/%@"), 228 kSCPrefSets, 229 set, 230 kSCCompNetwork, 231 kSCCompService, 232 service); 233 } else { 234 /* 235 * create "/Sets/set-id/Network/Service/service-id/entity" 236 */ 237 path = CFStringCreateWithFormat(allocator, 238 NULL, 239 CFSTR("/%@/%@/%@/%@/%@/%@"), 240 kSCPrefSets, 241 set, 242 kSCCompNetwork, 243 kSCCompService, 244 service, 245 entity); 246 } 247 248 return path; 249}