]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/genSCPreferences.c
configd-53.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / genSCPreferences.c
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 /*
24 * genSCPreferences.c
25 * - generates System Configuration header/cfile
26 * - invoke with "header" to generate the header
27 * - invoke with "cfile" to generate the cfile
28 */
29
30 /*
31 * Modification History
32 *
33 * June 1, 2001 Allan Nathanson <ajn@apple.com>
34 * - public API conversion
35 *
36 * 27 Apr 2001 Allan Nathanson (ajn@apple.com)
37 * - switch from "extern const CFStringRef ..." to "#define ..."
38 *
39 * 3 Nov 2000 Dieter Siegmund (dieter@apple)
40 * - created
41 */
42 #include <stdio.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <unistd.h>
46 #include <mach/boolean.h>
47
48 char copyright_string[] =
49 "/*\n"
50 " * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.\n"
51 " *\n"
52 " * @APPLE_LICENSE_HEADER_START@\n"
53 " * \n"
54 " * The contents of this file constitute Original Code as defined in and\n"
55 " * are subject to the Apple Public Source License Version 1.1 (the\n"
56 " * \"License\"). You may not use this file except in compliance with the\n"
57 " * License. Please obtain a copy of the License at\n"
58 " * http://www.apple.com/publicsource and read it before using this file.\n"
59 " * \n"
60 " * This Original Code and all software distributed under the License are\n"
61 " * distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY KIND, EITHER\n"
62 " * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\n"
63 " * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\n"
64 " * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the\n"
65 " * License for the specific language governing rights and limitations\n"
66 " * under the License.\n"
67 " * \n"
68 " * @APPLE_LICENSE_HEADER_END@\n"
69 " */\n";
70
71
72 typedef enum {
73 COMMENT,
74 OBSOLETE,
75 REGULAR,
76 DEFINE,
77 FUTURE,
78 END
79 } controlType;
80
81 #define KEY_PREFIX "kSC"
82
83 #define COMP "Comp"
84 #define DYNAMICSTORE "DynamicStore"
85 #define PREF "Pref"
86 #define PROP "Prop"
87 #define PATH "Path"
88 #define NETENT "EntNet"
89 #define NETPROP "PropNet"
90 #define NETVAL "ValNet"
91 #define SETUPENT "EntSetup"
92 #define SETUPPROP "PropSetup"
93 #define SYSTEMENT "EntSystem"
94 #define SYSTEMPROP "PropSystem"
95 #define RESV "Resv"
96 #define USERSENT "EntUsers"
97 #define USERSPROP "PropUsers"
98 #define VERSION "Version"
99
100 #define CFARRAY_CFNUMBER "CFArray[CFNumber]"
101 #define CFARRAY_CFSTRING "CFArray[CFString]"
102 #define CFBOOLEAN "CFBoolean"
103 #define CFDATA "CFData"
104 #define CFDICTIONARY "CFDictionary"
105 #define CFNUMBER "CFNumber"
106 #define CFNUMBER_BOOL "CFNumber (0 or 1)"
107 #define CFSTRING "CFString"
108
109 #define ACTIVE "Active"
110 #define ADDRESSES "Addresses"
111 #define AIRPORT "AirPort"
112 #define ALERT "Alert"
113 #define ALLOWNETCREATION "AllowNetCreation"
114 #define ALTERNATEREMOTEADDRESS "AlternateRemoteAddress"
115 #define ANYREGEX "AnyRegex"
116 #define APPLETALK "AppleTalk"
117 #define AUTH "Auth"
118 #define AUTOMATIC "Automatic"
119 #define BINDINGMETHODS "BindingMethods"
120 #define BOOTP "BOOTP"
121 #define BROADCAST "Broadcast"
122 #define BROADCASTADDRESSES "BroadcastAddresses"
123 #define BROADCASTSERVERTAG "BroadcastServerTag"
124 #define CALLWAITINGAUDIBLEALERT "CallWaitingAudibleAlert"
125 #define CCP "CCP"
126 #define CHAP "CHAP"
127 #define COMM "Comm"
128 #define COMPRESSIONACFIELD "CompressionACField"
129 #define COMPRESSIONPFIELD "CompressionPField"
130 #define COMPRESSIONVJ "CompressionVJ"
131 #define COMPUTERNAME "ComputerName"
132 #define CONFIGMETHOD "ConfigMethod"
133 #define CONNECTDELAY "ConnectDelay"
134 #define CONNECTIONSCRIPT "ConnectionScript"
135 #define CONNECTSPEED "ConnectSpeed"
136 #define CONNECTTIME "ConnectTime"
137 #define CONSOLEUSER "ConsoleUser"
138 #define CURRENTSET "CurrentSet"
139 #define DATACOMPRESSION "DataCompression"
140 #define DEFAULTSERVERTAG "DefaultServerTag"
141 #define DEFAULTZONE "DefaultZone"
142 #define DESTADDRESSES "DestAddresses"
143 #define DETACHING "Detaching"
144 #define DEVICE "Device"
145 #define DEVICENAME "DeviceName"
146 #define DHCP "DHCP"
147 #define DHCPCLIENTID "DHCPClientID"
148 #define DIALMODE "DialMode"
149 #define DIALONDEMAND "DialOnDemand"
150 #define DISCONNECTONANSWER "DisconnectOnAnswer"
151 #define DISCONNECTONIDLE "DisconnectOnIdle"
152 #define DISCONNECTONIDLETIMER "DisconnectOnIdleTimer"
153 #define DISCONNECTONLOGOUT "DisconnectOnLogout"
154 #define DISCONNECTONSLEEP "DisconnectOnSleep"
155 #define DISPLAYTERMINALWINDOW "DisplayTerminalWindow"
156 #define DNS "DNS"
157 #define DOMAIN "Domain"
158 #define DOMAINNAME "DomainName"
159 #define DOMAINSEPARATOR "DomainSeparator"
160 #define ECHOENABLED "EchoEnabled"
161 #define ECHOFAILURE "EchoFailure"
162 #define ECHOINTERVAL "EchoInterval"
163 #define ENABLED "Enabled"
164 #define ENCODING "Encoding"
165 #define ENCRYPTION "Encryption"
166 #define ERRORCORRECTION "ErrorCorrection"
167 #define ETHERNET "Ethernet"
168 #define EXCEPTIONSLIST "ExceptionsList"
169 #define FILE "File"
170 #define FTPENABLE "FTPEnable"
171 #define FTPPASSIVE "FTPPassive"
172 #define FTPPORT "FTPPort"
173 #define FTPPROXY "FTPProxy"
174 #define GID "GID"
175 #define GLOBAL "Global"
176 #define GOPHERENABLE "GopherEnable"
177 #define GOPHERPORT "GopherPort"
178 #define GOPHERPROXY "GopherProxy"
179 #define HARDWARE "Hardware"
180 #define HOLD "Hold"
181 #define HOSTNAMES "HostNames"
182 #define HTTPENABLE "HTTPEnable"
183 #define HTTPPORT "HTTPPort"
184 #define HTTPPROXY "HTTPProxy"
185 #define HTTPSENABLE "HTTPSEnable"
186 #define HTTPSPORT "HTTPSPort"
187 #define HTTPSPROXY "HTTPSProxy"
188 #define IDLEREMINDER "IdleReminder"
189 #define IDLEREMINDERTIMER "IdleReminderTimer"
190 #define IGNOREDIALTONE "IgnoreDialTone"
191 #define INACTIVE "Inactive"
192 #define INFORM "INFORM"
193 #define INTERFACE "Interface"
194 #define INTERFACENAME "InterfaceName"
195 #define INTERFACES "Interfaces"
196 #define IPCP "IPCP"
197 #define IPV4 "IPv4"
198 #define IPV6 "IPv6"
199 #define JOINMODE "JoinMode"
200 #define LASTCAUSE "LastCause"
201 #define LASTUPDATED "LastUpdated"
202 #define LCP "LCP"
203 #define LINK "Link"
204 #define LINKLOCAL "LinkLocal"
205 #define LOCALHOSTNAME "LocalHostName"
206 #define LOGFILE "Logfile"
207 #define MACADDRESS "MACAddress"
208 #define MANUAL "Manual"
209 #define MEDIA "Media"
210 #define MODEM "Modem"
211 #define MRU "MRU"
212 #define MTU "MTU"
213 #define NAME "Name"
214 #define NETINFO "NetInfo"
215 #define NETWORK "Network"
216 #define NETWORKID "NetworkID"
217 #define NETWORKRANGE "NetworkRange"
218 #define NETWORKSERVICES "NetworkServices"
219 #define NIS "NIS"
220 #define NODE "Node"
221 #define NODEID "NodeID"
222 #define NOTE "Note"
223 #define OVERRIDEPRIMARY "OverridePrimary"
224 #define PAP "PAP"
225 #define PASSWORD "Password"
226 #define PLUGIN "Plugin"
227 #define PLUGINS "Plugins"
228 #define POWERENABLED "PowerEnabled"
229 #define PPP "PPP"
230 #define PPPOE "PPPoE"
231 #define PPPOVERRIDEPRIMARY "PPPOverridePrimary"
232 #define PPPSERIAL "PPPSerial"
233 #define PPTP "PPTP"
234 #define PREFERRED "Preferred"
235 #define PREFERREDNETWORK "PreferredNetwork"
236 #define PREFS "Prefs"
237 #define PRIMARYINTERFACE "PrimaryInterface"
238 #define PRIMARYSERVICE "PrimaryService"
239 #define PROTOCOL "Protocol"
240 #define PROXIES "Proxies"
241 #define PULSEDIAL "PulseDial"
242 #define RECEIVEACCM "ReceiveACCM"
243 #define RECENT "Recent"
244 #define REDIALCOUNT "RedialCount"
245 #define REDIALENABLED "RedialEnabled"
246 #define REDIALINTERVAL "RedialInterval"
247 #define REMINDER "Reminder"
248 #define REMINDERTIME "ReminderTime"
249 #define REMOTEADDRESS "RemoteAddress"
250 #define ROOTSEPARATOR "RootSeparator"
251 #define ROUTER "Router"
252 #define RTSPENABLE "RTSPEnable"
253 #define RTSPPORT "RTSPPort"
254 #define RTSPPROXY "RTSPProxy"
255 #define SAVEPASSWORDS "SavePasswords"
256 #define SEARCHDOMAINS "SearchDomains"
257 #define SEEDNETWORKRANGE "SeedNetworkRange"
258 #define SEEDROUTER "SeedRouter"
259 #define SEEDZONES "SeedZones"
260 #define SERVERADDRESSES "ServerAddresses"
261 #define SERVERTAGS "ServerTags"
262 #define SERVICE "Service"
263 #define SERVICEIDS "ServiceIDs"
264 #define SERVICEORDER "ServiceOrder"
265 #define SESSIONTIMER "SessionTimer"
266 #define SETS "Sets"
267 #define SETUP "Setup"
268 #define SOCKSENABLE "SOCKSEnable"
269 #define SOCKSPORT "SOCKSPort"
270 #define SOCKSPROXY "SOCKSProxy"
271 #define SORTLIST "SortList"
272 #define SPEAKER "Speaker"
273 #define SPEED "Speed"
274 #define STATE "State"
275 #define STATUS "Status"
276 #define STRONGEST "Strongest"
277 #define SUBNETMASKS "SubnetMasks"
278 #define SUBTYPE "SubType"
279 #define SUPPORTSMODEMONHOLD "SupportsModemOnHold"
280 #define SYSTEM "System"
281 #define TERMINALSCRIPT "TerminalScript"
282 #define TRANSMITACCM "TransmitACCM"
283 #define TYPE "Type"
284 #define UID "UID"
285 #define USERDEFINEDNAME "UserDefinedName"
286 #define USE "Use"
287 #define USERS "Users"
288 #define VERBOSELOGGING "VerboseLogging"
289 #define WAITFORDIALTONE "WaitForDialTone"
290
291 struct {
292 int control;
293 unsigned char * prefix;
294 unsigned char * key;
295 unsigned char * value;
296 unsigned char * type;
297 } names[] = {
298 { COMMENT, "/*\n * Reserved Keys\n */", NULL, NULL },
299 { REGULAR, RESV, LINK, "__LINK__", CFSTRING },
300 { REGULAR, RESV, INACTIVE, "__INACTIVE__", NULL },
301 { COMMENT, "", NULL, NULL, NULL },
302
303 { COMMENT, "/*\n * Generic Keys\n */", NULL },
304 { DEFINE , PROP, INTERFACENAME, NULL, CFSTRING },
305 { REGULAR, PROP, MACADDRESS, NULL, CFSTRING },
306 { REGULAR, PROP, USERDEFINEDNAME, NULL, CFSTRING },
307 { DEFINE , PROP, VERSION, NULL, CFSTRING },
308 { COMMENT, "", NULL, NULL, NULL },
309
310 { COMMENT, "/*\n * Preference Keys\n */", NULL },
311 { REGULAR, PREF, CURRENTSET, NULL, CFSTRING },
312 { REGULAR, PREF, NETWORKSERVICES, NULL, CFDICTIONARY },
313 { REGULAR, PREF, SETS, NULL, CFDICTIONARY },
314 { REGULAR, PREF, SYSTEM, NULL, CFDICTIONARY },
315 { COMMENT, "", NULL, NULL, NULL },
316
317 { COMMENT, "/*\n * Component Keys\n */", NULL },
318 { REGULAR, COMP, NETWORK, NULL, NULL },
319 { REGULAR, COMP, SERVICE, NULL, NULL },
320 { REGULAR, COMP, GLOBAL, NULL, NULL },
321 { DEFINE , COMP, HOSTNAMES, NULL, NULL },
322 { REGULAR, COMP, INTERFACE, NULL, NULL },
323 { REGULAR, COMP, SYSTEM, NULL, NULL },
324 { REGULAR, COMP, USERS, NULL, NULL },
325 { COMMENT, "", NULL, NULL, NULL },
326
327 { COMMENT, "/*\n * Regex key which matches any component\n */", NULL },
328 { REGULAR, COMP, ANYREGEX, "[^/]+", NULL },
329 { COMMENT, "", NULL, NULL, NULL },
330
331 { COMMENT, "/*\n * Network Entity Keys\n */", NULL },
332 { REGULAR, NETENT, AIRPORT, NULL, CFDICTIONARY },
333 { REGULAR, NETENT, APPLETALK, NULL, CFDICTIONARY },
334 { DEFINE , NETENT, DHCP, NULL, CFDICTIONARY },
335 { REGULAR, NETENT, DNS, NULL, CFDICTIONARY },
336 { REGULAR, NETENT, ETHERNET, NULL, CFDICTIONARY },
337 { REGULAR, NETENT, INTERFACE, NULL, CFDICTIONARY },
338 { REGULAR, NETENT, IPV4, NULL, CFDICTIONARY },
339 { REGULAR, NETENT, IPV6, NULL, CFDICTIONARY },
340 { REGULAR, NETENT, LINK, NULL, CFDICTIONARY },
341 { REGULAR, NETENT, MODEM, NULL, CFDICTIONARY },
342 { REGULAR, NETENT, NETINFO, NULL, CFDICTIONARY },
343 { FUTURE , NETENT, NIS, NULL, CFDICTIONARY },
344 { REGULAR, NETENT, PPP, NULL, CFDICTIONARY },
345 { REGULAR, NETENT, PPPOE, NULL, CFDICTIONARY },
346 { REGULAR, NETENT, PROXIES, NULL, CFDICTIONARY },
347 { COMMENT, "", NULL, NULL, NULL },
348
349 { COMMENT, "/*\n * " KEY_PREFIX COMP NETWORK " Properties\n */", NULL },
350 { DEFINE , NETPROP, OVERRIDEPRIMARY, NULL, CFNUMBER_BOOL },
351 { REGULAR, NETPROP, SERVICEORDER, NULL, CFARRAY_CFSTRING },
352 { REGULAR, NETPROP, PPPOVERRIDEPRIMARY, NULL, CFNUMBER_BOOL },
353 { COMMENT, "", NULL, NULL, NULL },
354
355 { COMMENT, "/*\n * " KEY_PREFIX COMP NETWORK INTERFACE " Properties\n */", NULL },
356 { DEFINE , NETPROP, INTERFACES, NULL, CFARRAY_CFSTRING },
357 { COMMENT, "", NULL, NULL, NULL },
358
359 { COMMENT, "/*\n * " KEY_PREFIX COMP NETWORK HOSTNAMES " Properties\n */", NULL },
360 { DEFINE , NETPROP, LOCALHOSTNAME, NULL, CFSTRING },
361 { COMMENT, "", NULL, NULL, NULL },
362
363 { COMMENT, "/*\n * " KEY_PREFIX NETENT AIRPORT " (Hardware) Entity Keys\n */", NULL, NULL, NULL },
364 { DEFINE , NETPROP AIRPORT, ALLOWNETCREATION, NULL, CFNUMBER_BOOL },
365 { REGULAR, NETPROP AIRPORT, AUTH PASSWORD, NULL, CFDATA },
366 { REGULAR, NETPROP AIRPORT, AUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
367 { DEFINE , NETPROP AIRPORT, JOINMODE, NULL, CFSTRING },
368 { REGULAR, NETPROP AIRPORT, POWERENABLED, NULL, CFNUMBER_BOOL },
369 { REGULAR, NETPROP AIRPORT, PREFERREDNETWORK, NULL, CFSTRING },
370 { DEFINE , NETPROP AIRPORT, SAVEPASSWORDS, NULL, CFNUMBER_BOOL },
371 { COMMENT, "", NULL, NULL, NULL },
372 { COMMENT, "/* " KEY_PREFIX NETPROP AIRPORT JOINMODE " values */", NULL, NULL, NULL },
373 { DEFINE , NETVAL AIRPORT JOINMODE, PREFERRED, NULL, NULL },
374 { DEFINE , NETVAL AIRPORT JOINMODE, RECENT, NULL, NULL },
375 { DEFINE , NETVAL AIRPORT JOINMODE, STRONGEST, NULL, NULL },
376 { COMMENT, "", NULL, NULL, NULL },
377
378 { COMMENT, "/*\n * " KEY_PREFIX NETENT APPLETALK " Entity Keys\n */", NULL, NULL, NULL },
379 { REGULAR, NETPROP APPLETALK, COMPUTERNAME, NULL, CFSTRING },
380 { REGULAR, NETPROP APPLETALK, COMPUTERNAME ENCODING, NULL, CFNUMBER },
381 { REGULAR, NETPROP APPLETALK, CONFIGMETHOD, NULL, CFSTRING },
382 { REGULAR, NETPROP APPLETALK, DEFAULTZONE, NULL, CFSTRING },
383 { REGULAR, NETPROP APPLETALK, NETWORKID, NULL, CFNUMBER },
384 { REGULAR, NETPROP APPLETALK, NETWORKRANGE, NULL, CFARRAY_CFNUMBER },
385 { REGULAR, NETPROP APPLETALK, NODEID, NULL, CFNUMBER },
386 { REGULAR, NETPROP APPLETALK, SEEDNETWORKRANGE, NULL, CFARRAY_CFNUMBER },
387 { REGULAR, NETPROP APPLETALK, SEEDZONES, NULL, CFARRAY_CFSTRING },
388 { COMMENT, "", NULL, NULL, NULL },
389 { COMMENT, "/* " KEY_PREFIX NETPROP APPLETALK CONFIGMETHOD " values */", NULL, NULL, NULL },
390 { REGULAR, NETVAL APPLETALK CONFIGMETHOD, NODE, NULL, NULL },
391 { REGULAR, NETVAL APPLETALK CONFIGMETHOD, ROUTER, NULL, NULL },
392 { REGULAR, NETVAL APPLETALK CONFIGMETHOD, SEEDROUTER, NULL, NULL },
393 { COMMENT, "", NULL, NULL, NULL },
394
395 { COMMENT, "/*\n * " KEY_PREFIX NETENT DNS " Entity Keys\n */", NULL, NULL, NULL },
396 { REGULAR, NETPROP DNS, DOMAINNAME, NULL, CFSTRING },
397 { REGULAR, NETPROP DNS, SEARCHDOMAINS, NULL, CFARRAY_CFSTRING},
398 { REGULAR, NETPROP DNS, SERVERADDRESSES, NULL, CFARRAY_CFSTRING },
399 { DEFINE , NETPROP DNS, SORTLIST, NULL, CFARRAY_CFSTRING },
400 { COMMENT, "", NULL, NULL, NULL },
401
402 { COMMENT, "/*\n * " KEY_PREFIX NETENT ETHERNET " (Hardware) Entity Keys\n */", NULL, NULL, NULL },
403 { COMMENT, "", NULL, NULL, NULL },
404
405 { COMMENT, "/*\n * " KEY_PREFIX NETENT INTERFACE " Entity Keys\n */", NULL },
406 { REGULAR, NETPROP INTERFACE, DEVICENAME, NULL, CFSTRING },
407 { REGULAR, NETPROP INTERFACE, HARDWARE, NULL, CFSTRING },
408 { REGULAR, NETPROP INTERFACE, TYPE, NULL, CFSTRING },
409 { REGULAR, NETPROP INTERFACE, SUBTYPE, NULL, CFSTRING },
410 { DEFINE , NETPROP INTERFACE, SUPPORTSMODEMONHOLD, NULL, CFNUMBER_BOOL },
411 { COMMENT, "", NULL, NULL, NULL },
412 { COMMENT, "/* " KEY_PREFIX NETPROP INTERFACE TYPE " values */", NULL, NULL, NULL },
413 { REGULAR, NETVAL INTERFACE TYPE, ETHERNET, NULL, NULL },
414 { REGULAR, NETVAL INTERFACE TYPE, PPP, NULL, NULL },
415 { COMMENT, "", NULL, NULL, NULL },
416 { COMMENT, "/* " KEY_PREFIX NETPROP SERVICE SUBTYPE " values (for " PPP ") */", NULL, NULL, NULL },
417 { REGULAR, NETVAL INTERFACE SUBTYPE, PPPOE, NULL, NULL },
418 { REGULAR, NETVAL INTERFACE SUBTYPE, PPPSERIAL, NULL, NULL },
419 { DEFINE , NETVAL INTERFACE SUBTYPE, PPTP, NULL, NULL },
420 { COMMENT, "", NULL, NULL, NULL },
421
422 { COMMENT, "/*\n * " KEY_PREFIX NETENT IPV4 " Entity Keys\n */", NULL, NULL, NULL },
423 { REGULAR, NETPROP IPV4, ADDRESSES, NULL, CFARRAY_CFSTRING },
424 { REGULAR, NETPROP IPV4, CONFIGMETHOD, NULL, CFSTRING },
425 { REGULAR, NETPROP IPV4, DHCPCLIENTID, NULL, CFSTRING },
426 { REGULAR, NETPROP IPV4, ROUTER, NULL, CFSTRING },
427 { REGULAR, NETPROP IPV4, SUBNETMASKS, NULL, CFARRAY_CFSTRING },
428 { REGULAR, NETPROP IPV4, DESTADDRESSES, NULL, CFARRAY_CFSTRING },
429 { REGULAR, NETPROP IPV4, BROADCASTADDRESSES, NULL, CFARRAY_CFSTRING },
430 { COMMENT, "", NULL, NULL, NULL },
431 { COMMENT, "/* " KEY_PREFIX NETPROP IPV4 CONFIGMETHOD " values */", NULL, NULL, NULL },
432 { REGULAR, NETVAL IPV4 CONFIGMETHOD, BOOTP, NULL, NULL },
433 { REGULAR, NETVAL IPV4 CONFIGMETHOD, DHCP, NULL, NULL },
434 { REGULAR, NETVAL IPV4 CONFIGMETHOD, INFORM, NULL, NULL },
435 { REGULAR, NETVAL IPV4 CONFIGMETHOD, LINKLOCAL, NULL, NULL },
436 { REGULAR, NETVAL IPV4 CONFIGMETHOD, MANUAL, NULL, NULL },
437 { REGULAR, NETVAL IPV4 CONFIGMETHOD, PPP, NULL, NULL },
438 { COMMENT, "", NULL, NULL, NULL },
439
440 { COMMENT, "/*\n * " KEY_PREFIX NETENT IPV6 " Entity Keys\n */", NULL, NULL, NULL },
441 { REGULAR, NETPROP IPV6, ADDRESSES, NULL, CFARRAY_CFSTRING },
442 { REGULAR, NETPROP IPV6, CONFIGMETHOD, NULL, CFSTRING },
443 { COMMENT, "", NULL, NULL, NULL },
444
445 { COMMENT, "/*\n * " KEY_PREFIX NETENT LINK " Entity Keys\n */", NULL, NULL, NULL },
446 { REGULAR, NETPROP LINK, ACTIVE, NULL, CFBOOLEAN },
447 { DEFINE , NETPROP LINK, DETACHING, NULL, CFBOOLEAN },
448 { COMMENT, "", NULL, NULL, NULL },
449
450 { COMMENT, "/*\n * " KEY_PREFIX NETENT MODEM " (Hardware) Entity Keys\n */", NULL, NULL, NULL },
451 { REGULAR, NETPROP MODEM, CONNECTIONSCRIPT, NULL, CFSTRING },
452 { DEFINE , NETPROP MODEM, CONNECTSPEED, NULL, CFNUMBER },
453 { DEFINE , NETPROP MODEM, DATACOMPRESSION, NULL, CFNUMBER_BOOL },
454 { REGULAR, NETPROP MODEM, DIALMODE, NULL, CFSTRING },
455 { DEFINE , NETPROP MODEM, ERRORCORRECTION, NULL, CFNUMBER_BOOL },
456 { DEFINE , NETPROP MODEM, HOLD CALLWAITINGAUDIBLEALERT, NULL, CFNUMBER_BOOL },
457 { DEFINE , NETPROP MODEM, HOLD DISCONNECTONANSWER, NULL, CFNUMBER_BOOL },
458 { DEFINE , NETPROP MODEM, HOLD ENABLED, NULL, CFNUMBER_BOOL },
459 { DEFINE , NETPROP MODEM, HOLD REMINDER, NULL, CFNUMBER_BOOL },
460 { DEFINE , NETPROP MODEM, HOLD REMINDERTIME, NULL, CFNUMBER },
461 { DEFINE , NETPROP MODEM, NOTE, NULL, CFSTRING },
462 { REGULAR, NETPROP MODEM, PULSEDIAL, NULL, CFNUMBER_BOOL },
463 { REGULAR, NETPROP MODEM, SPEAKER, NULL, CFNUMBER_BOOL },
464 { REGULAR, NETPROP MODEM, SPEED, NULL, CFNUMBER },
465 { COMMENT, "", NULL, NULL, NULL },
466 { COMMENT, "/* " KEY_PREFIX NETPROP MODEM DIALMODE " values */", NULL, NULL, NULL },
467 { REGULAR, NETVAL MODEM DIALMODE, IGNOREDIALTONE, NULL, NULL },
468 { REGULAR, NETVAL MODEM DIALMODE, MANUAL, NULL, NULL },
469 { REGULAR, NETVAL MODEM DIALMODE, WAITFORDIALTONE, NULL, NULL },
470 { COMMENT, "", NULL, NULL, NULL },
471
472 { COMMENT, "/*\n * " KEY_PREFIX NETENT NETINFO " Entity Keys\n */", NULL, NULL, NULL },
473 { REGULAR, NETPROP NETINFO, BINDINGMETHODS, NULL, CFSTRING },
474 { REGULAR, NETPROP NETINFO, SERVERADDRESSES, NULL, CFARRAY_CFSTRING },
475 { REGULAR, NETPROP NETINFO, SERVERTAGS, NULL, CFARRAY_CFSTRING },
476 { REGULAR, NETPROP NETINFO, BROADCASTSERVERTAG, NULL, CFSTRING },
477 { COMMENT, "", NULL, NULL, NULL },
478 { COMMENT, "/* " KEY_PREFIX NETPROP NETINFO BINDINGMETHODS " values */", NULL, NULL, NULL },
479 { REGULAR, NETVAL NETINFO BINDINGMETHODS, BROADCAST, NULL, NULL },
480 { REGULAR, NETVAL NETINFO BINDINGMETHODS, DHCP, NULL, NULL },
481 { REGULAR, NETVAL NETINFO BINDINGMETHODS, MANUAL, NULL, NULL },
482 { COMMENT, "", NULL, NULL, NULL },
483 { COMMENT, "/* " KEY_PREFIX NETPROP NETINFO BROADCASTSERVERTAG " default value */", NULL, NULL, NULL },
484 { REGULAR, NETVAL NETINFO, DEFAULTSERVERTAG, "network", NULL },
485 { COMMENT, "", NULL, NULL, NULL },
486
487 { COMMENT, "/*\n * " KEY_PREFIX NETENT NIS " Entity Keys\n */", NULL, NULL, NULL },
488 { COMMENT, "/* RESERVED FOR FUTURE USE */", NULL, NULL, NULL },
489 { COMMENT, "", NULL, NULL, NULL },
490
491 { COMMENT, "/*\n * " KEY_PREFIX NETENT PPP " Entity Keys\n */", NULL, NULL, NULL },
492 { DEFINE , NETPROP PPP, CONNECTTIME, NULL, CFNUMBER },
493 { DEFINE , NETPROP PPP, DEVICE LASTCAUSE, NULL, CFNUMBER },
494 { REGULAR, NETPROP PPP, DIALONDEMAND, NULL, CFNUMBER_BOOL },
495 { REGULAR, NETPROP PPP, DISCONNECTONIDLE, NULL, CFNUMBER_BOOL },
496 { REGULAR, NETPROP PPP, DISCONNECTONIDLETIMER, NULL, CFNUMBER },
497 { REGULAR, NETPROP PPP, DISCONNECTONLOGOUT, NULL, CFNUMBER_BOOL },
498 { DEFINE , NETPROP PPP, DISCONNECTONSLEEP, NULL, CFNUMBER_BOOL },
499 { REGULAR, NETPROP PPP, IDLEREMINDERTIMER, NULL, CFNUMBER },
500 { REGULAR, NETPROP PPP, IDLEREMINDER, NULL, CFNUMBER_BOOL },
501 { DEFINE , NETPROP PPP, LASTCAUSE, NULL, CFNUMBER },
502 { REGULAR, NETPROP PPP, LOGFILE, NULL, CFSTRING },
503 { DEFINE , NETPROP PPP, PLUGINS, NULL, CFARRAY_CFSTRING },
504 { DEFINE , NETPROP PPP, SESSIONTIMER, NULL, CFNUMBER },
505 { DEFINE , NETPROP PPP, STATUS, NULL, CFSTRING },
506 { DEFINE , NETPROP PPP, USE SESSIONTIMER, NULL, CFNUMBER_BOOL },
507 { REGULAR, NETPROP PPP, VERBOSELOGGING, NULL, CFNUMBER_BOOL },
508 { COMMENT, "", NULL, NULL, NULL },
509
510 { COMMENT, "/* " AUTH ": */", NULL, NULL, NULL },
511 { REGULAR, NETPROP PPP, AUTH NAME, NULL, CFSTRING },
512 { REGULAR, NETPROP PPP, AUTH PASSWORD, NULL, CFSTRING },
513 { REGULAR, NETPROP PPP, AUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
514 { REGULAR, NETPROP PPP, AUTH PROTOCOL, NULL, CFARRAY_CFSTRING },
515 { COMMENT, "", NULL, NULL, NULL },
516 { COMMENT, "/* " KEY_PREFIX NETPROP PPP AUTH PROTOCOL " values */", NULL, NULL, NULL },
517 { REGULAR, NETVAL PPP AUTH PROTOCOL, CHAP, NULL, CFSTRING },
518 { REGULAR, NETVAL PPP AUTH PROTOCOL, PAP, NULL, CFSTRING },
519
520 { COMMENT, "\n/* " COMM ": */", NULL, NULL, NULL },
521 { REGULAR, NETPROP PPP, COMM ALTERNATEREMOTEADDRESS, NULL, CFSTRING },
522 { REGULAR, NETPROP PPP, COMM CONNECTDELAY, NULL, CFNUMBER },
523 { REGULAR, NETPROP PPP, COMM DISPLAYTERMINALWINDOW, NULL, CFNUMBER_BOOL },
524 { REGULAR, NETPROP PPP, COMM REDIALCOUNT, NULL, CFNUMBER },
525 { REGULAR, NETPROP PPP, COMM REDIALENABLED, NULL, CFNUMBER_BOOL },
526 { REGULAR, NETPROP PPP, COMM REDIALINTERVAL, NULL, CFNUMBER },
527 { REGULAR, NETPROP PPP, COMM REMOTEADDRESS, NULL, CFSTRING },
528 { REGULAR, NETPROP PPP, COMM TERMINALSCRIPT, NULL, CFSTRING },
529 { DEFINE , NETPROP PPP, COMM USE TERMINALSCRIPT, NULL, CFNUMBER_BOOL },
530
531 { COMMENT, "\n/* " CCP ": */", NULL, NULL, NULL },
532 { DEFINE , NETPROP PPP, CCP ENABLED, NULL, CFNUMBER_BOOL },
533
534 { COMMENT, "\n/* " IPCP ": */", NULL, NULL, NULL },
535 { REGULAR, NETPROP PPP, IPCP COMPRESSIONVJ, NULL, CFNUMBER_BOOL },
536
537 { COMMENT, "\n/* " LCP ": */", NULL, NULL, NULL },
538 { REGULAR, NETPROP PPP, LCP ECHOENABLED, NULL, CFNUMBER_BOOL },
539 { REGULAR, NETPROP PPP, LCP ECHOFAILURE, NULL, CFNUMBER },
540 { REGULAR, NETPROP PPP, LCP ECHOINTERVAL, NULL, CFNUMBER },
541 { REGULAR, NETPROP PPP, LCP COMPRESSIONACFIELD, NULL, CFNUMBER_BOOL },
542 { REGULAR, NETPROP PPP, LCP COMPRESSIONPFIELD, NULL, CFNUMBER_BOOL },
543 { REGULAR, NETPROP PPP, LCP MRU, NULL, CFNUMBER },
544 { REGULAR, NETPROP PPP, LCP MTU, NULL, CFNUMBER },
545 { REGULAR, NETPROP PPP, LCP RECEIVEACCM, NULL, CFNUMBER },
546 { REGULAR, NETPROP PPP, LCP TRANSMITACCM, NULL, CFNUMBER },
547 { COMMENT, "", NULL, NULL, NULL },
548
549 { COMMENT, "/*\n * " KEY_PREFIX NETENT PPPOE " Entity Keys\n */", NULL, NULL, NULL },
550 { COMMENT, "/* RESERVED FOR FUTURE USE */", NULL, NULL, NULL },
551 { COMMENT, "", NULL, NULL, NULL },
552
553 { COMMENT, "/*\n * " KEY_PREFIX NETENT PPPSERIAL " Entity Keys\n */", NULL, NULL, NULL },
554 { COMMENT, "/* RESERVED FOR FUTURE USE */", NULL, NULL, NULL },
555 { COMMENT, "", NULL, NULL, NULL },
556
557 { COMMENT, "/*\n * " KEY_PREFIX NETENT PROXIES " Entity Keys\n */", NULL, NULL, NULL },
558 { REGULAR, NETPROP PROXIES, EXCEPTIONSLIST, NULL, CFARRAY_CFSTRING },
559 { REGULAR, NETPROP PROXIES, FTPENABLE, NULL, CFNUMBER_BOOL },
560 { REGULAR, NETPROP PROXIES, FTPPASSIVE, NULL, CFNUMBER_BOOL },
561 { REGULAR, NETPROP PROXIES, FTPPORT, NULL, CFNUMBER },
562 { REGULAR, NETPROP PROXIES, FTPPROXY, NULL, CFSTRING },
563 { REGULAR, NETPROP PROXIES, GOPHERENABLE, NULL, CFNUMBER_BOOL },
564 { REGULAR, NETPROP PROXIES, GOPHERPORT, NULL, CFNUMBER },
565 { REGULAR, NETPROP PROXIES, GOPHERPROXY, NULL, CFSTRING },
566 { REGULAR, NETPROP PROXIES, HTTPENABLE, NULL, CFNUMBER_BOOL },
567 { REGULAR, NETPROP PROXIES, HTTPPORT, NULL, CFNUMBER },
568 { REGULAR, NETPROP PROXIES, HTTPPROXY, NULL, CFSTRING },
569 { DEFINE , NETPROP PROXIES, HTTPSENABLE, NULL, CFNUMBER_BOOL },
570 { DEFINE , NETPROP PROXIES, HTTPSPORT, NULL, CFNUMBER },
571 { DEFINE , NETPROP PROXIES, HTTPSPROXY, NULL, CFSTRING },
572 { REGULAR, NETPROP PROXIES, RTSPENABLE, NULL, CFNUMBER_BOOL },
573 { REGULAR, NETPROP PROXIES, RTSPPORT, NULL, CFNUMBER },
574 { REGULAR, NETPROP PROXIES, RTSPPROXY, NULL, CFSTRING },
575 { REGULAR, NETPROP PROXIES, SOCKSENABLE, NULL, CFNUMBER_BOOL },
576 { REGULAR, NETPROP PROXIES, SOCKSPORT, NULL, CFNUMBER },
577 { REGULAR, NETPROP PROXIES, SOCKSPROXY, NULL, CFSTRING },
578 { COMMENT, "", NULL, NULL, NULL },
579
580 { COMMENT, "/*\n " KEY_PREFIX COMP USERS " Entity Keys\n */", NULL, NULL, NULL },
581 { REGULAR, USERSENT, CONSOLEUSER, NULL, NULL },
582 { COMMENT, "", NULL, NULL, NULL },
583
584 { COMMENT, "/*\n " KEY_PREFIX USERSPROP CONSOLEUSER " Properties\n */", NULL, NULL, NULL },
585 { REGULAR, USERSPROP CONSOLEUSER, NAME, NULL, CFSTRING },
586 { REGULAR, USERSPROP CONSOLEUSER, UID, NULL, CFSTRING },
587 { REGULAR, USERSPROP CONSOLEUSER, GID, NULL, CFSTRING },
588 { COMMENT, "", NULL, NULL, NULL },
589
590 { COMMENT, "/*\n * " KEY_PREFIX COMP SYSTEM " Properties\n */", NULL, NULL, NULL },
591 { REGULAR, SYSTEMPROP, COMPUTERNAME, NULL, CFSTRING },
592 { REGULAR, SYSTEMPROP, COMPUTERNAME ENCODING, NULL, CFNUMBER },
593 { COMMENT, "", NULL, NULL, NULL },
594
595 { COMMENT, "/*\n * Configuration Store Definitions\n */", NULL },
596 { COMMENT, "/* domain prefixes */", NULL },
597 { DEFINE , DYNAMICSTORE DOMAIN, FILE, "File:", NULL },
598 { DEFINE , DYNAMICSTORE DOMAIN, PLUGIN, "Plugin:", NULL },
599 { DEFINE , DYNAMICSTORE DOMAIN, SETUP, "Setup:", NULL },
600 { DEFINE , DYNAMICSTORE DOMAIN, STATE, "State:", NULL },
601 { DEFINE , DYNAMICSTORE DOMAIN, PREFS, "Prefs:", NULL },
602 { COMMENT, "", NULL, NULL, NULL },
603
604 { COMMENT, "/* " KEY_PREFIX DYNAMICSTORE DOMAIN SETUP " Properties */", NULL },
605 { DEFINE , DYNAMICSTORE SETUPPROP, CURRENTSET, NULL, CFSTRING },
606 { DEFINE , DYNAMICSTORE SETUPPROP, LASTUPDATED, NULL, NULL },
607 { COMMENT, "", NULL, NULL, NULL },
608
609 { COMMENT, "/* Properties */", NULL },
610 { DEFINE , DYNAMICSTORE NETPROP, INTERFACES, NULL, CFARRAY_CFSTRING },
611 { DEFINE , DYNAMICSTORE NETPROP, PRIMARYINTERFACE, NULL, CFSTRING },
612 { DEFINE , DYNAMICSTORE NETPROP, PRIMARYSERVICE, NULL, CFSTRING },
613 { DEFINE , DYNAMICSTORE NETPROP, SERVICEIDS, NULL, CFARRAY_CFSTRING },
614 { COMMENT, "", NULL, NULL, NULL },
615
616 /* obsolete keys */
617 { OBSOLETE, "Cache" DOMAIN, FILE, "File:", NULL },
618 { OBSOLETE, "Cache" DOMAIN, PLUGIN, "Plugin:", NULL },
619 { OBSOLETE, "Cache" DOMAIN, SETUP, "Setup:", NULL },
620 { OBSOLETE, "Cache" DOMAIN, STATE, "State:", NULL },
621 { OBSOLETE, "Cache" DOMAIN, PREFS, "Prefs:", NULL },
622 { OBSOLETE, "Cache" SETUPPROP, CURRENTSET, NULL, CFSTRING },
623 { OBSOLETE, "Cache" SETUPPROP, LASTUPDATED, NULL, NULL },
624 { OBSOLETE, "Cache" NETPROP, INTERFACES, NULL, CFARRAY_CFSTRING },
625 { OBSOLETE, "Cache" NETPROP, PRIMARYINTERFACE, NULL, CFSTRING },
626 { OBSOLETE, "Cache" NETPROP, SERVICEIDS, NULL, CFARRAY_CFSTRING },
627
628 { END, NULL, NULL, NULL, NULL },
629 };
630
631 enum {
632 gen_extern_e,
633 gen_init_e,
634 gen_header_e,
635 };
636
637 void
638 dump_names(int type)
639 {
640 int i;
641
642 for (i = 0; TRUE; i++) {
643 switch (names[i].control) {
644 case END: {
645 goto done;
646 break;
647 }
648 case COMMENT: {
649 if (type != gen_extern_e && type != gen_init_e) {
650 if (names[i].prefix)
651 printf("%s\n", names[i].prefix);
652 }
653 break;
654 }
655 case DEFINE: {
656 char kbuf[256];
657 char vbuf[256];
658
659 switch (type) {
660 case gen_header_e:
661 snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
662 names[i].prefix, names[i].key);
663
664 if (names[i].value)
665 snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
666 names[i].value);
667 else
668 snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
669 names[i].key);
670
671 if (names[i].type)
672 printf("#define %-40s %-40s /* %s */\n",
673 kbuf, vbuf, names[i].type);
674 else
675 printf("#define %-40s %-40s\n",
676 kbuf, vbuf);
677 break;
678 default:
679 break;
680 }
681 break;
682 }
683 case REGULAR: {
684 char kbuf[256];
685 char vbuf[256];
686
687 switch (type) {
688 case gen_header_e:
689 snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
690 names[i].prefix, names[i].key);
691
692 if (names[i].value)
693 snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
694 names[i].value);
695 else
696 snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
697 names[i].key);
698
699 if (names[i].type)
700 printf("#define %-40s %-40s /* %s */\n",
701 kbuf, vbuf, names[i].type);
702 else
703 printf("#define %-40s %-40s\n",
704 kbuf, vbuf);
705 break;
706 case gen_extern_e:
707 snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
708 names[i].prefix, names[i].key);
709
710 printf("volatile CFStringRef " KEY_PREFIX "%s%s = NULL;\n",
711 names[i].prefix, names[i].key);
712 break;
713 case gen_init_e:
714 snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
715 names[i].prefix, names[i].key);
716 if (names[i].value)
717 printf(" *((void **)&%s) = (void *)CFSTR(\"%s\");\n",
718 kbuf, names[i].value);
719 else
720 printf(" *((void **)&%s) = (void *)CFSTR(\"%s\");\n",
721 kbuf, names[i].key);
722 break;
723 default:
724 break;
725 }
726 break;
727 }
728 case OBSOLETE: {
729 char kbuf[256];
730
731 switch (type) {
732 case gen_extern_e:
733 snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
734 names[i].prefix, names[i].key);
735
736 printf("volatile CFStringRef " KEY_PREFIX "%s%s = NULL;\n",
737 names[i].prefix, names[i].key);
738 break;
739 case gen_init_e:
740 snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
741 names[i].prefix, names[i].key);
742 if (names[i].value)
743 printf(" *((void **)&%s) = (void *)CFSTR(\"%s\");\n",
744 kbuf, names[i].value);
745 else
746 printf(" *((void **)&%s) = (void *)CFSTR(\"%s\");\n",
747 kbuf, names[i].key);
748 break;
749 default:
750 break;
751 }
752 break;
753 }
754 case FUTURE: {
755 char kbuf[256];
756
757 if (type == gen_header_e) {
758 snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
759 names[i].prefix, names[i].key);
760
761 printf("/* #define %-37s %-40s /* %s */\n",
762 kbuf,
763 "SCSTR(\"???\") */",
764 "RESERVED FOR FUTURE USE");
765 }
766 break;
767 }
768 default: {
769 break;
770 }
771 }
772 }
773 done:
774 return;
775 }
776
777 int
778 main(int argc, char * argv[])
779 {
780 char * type = "";
781
782 if (argc >= 2)
783 type = argv[1];
784
785 if (strcmp(type, "header") == 0) {
786 printf("%s\n", copyright_string);
787 printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n");
788
789 printf("/*\n");
790 printf(" * Note: For Cocoa/Obj-C/Foundation programs accessing these preference\n");
791 printf(" * keys you may want to consider the following:\n");
792 printf(" *\n");
793 printf(" * #define SCSTR(s) (NSString *)CFSTR(s)\n");
794 printf(" * #import <SystemConfiguration/SystemConfiguration.h>\n");
795 printf(" */\n\n");
796
797 printf("#ifndef _SCSCHEMADEFINITIONS_H\n#define _SCSCHEMADEFINITIONS_H\n\n");
798
799 printf("#ifndef SCSTR\n");
800 printf("#include <CoreFoundation/CFString.h>\n");
801 printf("#define SCSTR(s) CFSTR(s)\n");
802 printf("#endif\n");
803
804 printf("\n");
805 dump_names(gen_header_e);
806 printf("#endif /* _SCSCHEMADEFINITIONS_H */\n");
807 }
808 else if (strcmp(type, "cfile") == 0) {
809 printf("/*\n");
810 printf(" * This file is automatically generated\n");
811 printf(" * DO NOT EDIT!\n");
812 printf(" */\n");
813 printf("\n");
814 printf("#include <CoreFoundation/CFString.h>\n");
815 printf("\n");
816 dump_names(gen_extern_e);
817 printf("\n");
818 printf("__private_extern__\nvoid\n__Initialize(void)\n");
819 printf("{\n");
820 printf(" static Boolean initialized = FALSE;\n");
821 printf("\n");
822 printf(" if (initialized)\n");
823 printf(" return;\n");
824 printf("\n");
825 dump_names(gen_init_e);
826 printf("\n");
827 printf(" initialized = TRUE;\n");
828 printf(" return;\n");
829 printf("}\n");
830 }
831 exit(0);
832 return (0);
833 }
834