]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/genSCPreferences.c
configd-24.1.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / genSCPreferences.c
1 /*
2 * Copyright (c) 2000 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 * 3 Nov 2000 Dieter Siegmund (dieter@apple)
33 * - created
34 */
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <unistd.h>
38 #include <mach/boolean.h>
39
40 char copyright_string[] =
41 "/*\n"
42 " * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.\n"
43 " *\n"
44 " * @APPLE_LICENSE_HEADER_START@\n"
45 " * \n"
46 " * The contents of this file constitute Original Code as defined in and\n"
47 " * are subject to the Apple Public Source License Version 1.1 (the\n"
48 " * \"License\"). You may not use this file except in compliance with the\n"
49 " * License. Please obtain a copy of the License at\n"
50 " * http://www.apple.com/publicsource and read it before using this file.\n"
51 " * \n"
52 " * This Original Code and all software distributed under the License are\n"
53 " * distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY KIND, EITHER\n"
54 " * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\n"
55 " * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\n"
56 " * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the\n"
57 " * License for the specific language governing rights and limitations\n"
58 " * under the License.\n"
59 " * \n"
60 " * @APPLE_LICENSE_HEADER_END@\n"
61 " */\n";
62
63
64 #define REGULAR 0
65 #define COMMENT 1
66 #define END 2
67
68 #define STRING_MACRO_NAME "STRING_DECL"
69
70 #define KEY_PREFIX "kSC"
71
72 #define CACHE "Cache"
73 #define COMP "Comp"
74 #define PREF "Pref"
75 #define PROP "Prop"
76 #define PATH "Path"
77 #define NETENT "EntNet"
78 #define NETPROP "PropNet"
79 #define NETVAL "ValNet"
80 #define SETUPENT "EntSetup"
81 #define SETUPPROP "PropSetup"
82 #define SYSTEMENT "EntSystem"
83 #define SYSTEMPROP "PropSystem"
84 #define RESV "Resv"
85 #define USERSENT "EntUsers"
86 #define USERSPROP "PropUsers"
87
88 #define CFNUMBER "CFNumber"
89 #define CFSTRING "CFString"
90 #define CFNUMBER_BOOL "CFNumber (0 or 1)"
91 #define CFARRAY_CFSTRING "CFArray[CFString]"
92
93 #define ACTIVE "Active"
94 #define ADDRESSES "Addresses"
95 #define AIRPORT "AirPort"
96 #define ALERT "Alert"
97 #define ANYREGEX "AnyRegex"
98 #define AUTOMATIC "Automatic"
99 #define APPLETALK "AppleTalk"
100 #define AUTH "Auth"
101 #define BINDINGMETHODS "BindingMethods"
102 #define BOOTP "BOOTP"
103 #define BROADCAST "Broadcast"
104 #define BROADCASTADDRESSES "BroadcastAddresses"
105 #define BROADCASTSERVERTAG "BroadcastServerTag"
106 #define COMM "Comm"
107 #define COMPONENTSEPARATOR "ComponentSeparator"
108 #define COMPUTERNAME "ComputerName"
109 #define CONFIGMETHOD "ConfigMethod"
110 #define CONSOLEUSER "ConsoleUser"
111 #define CURRENTSET "CurrentSet"
112 #define DEFAULTSERVERTAG "DefaultServerTag"
113 #define DEFAULTZONE "DefaultZone"
114 #define DESTADDRESSES "DestAddresses"
115 #define DHCP "DHCP"
116 #define DHCPCLIENTID "DHCPClientID"
117 #define DEVICENAME "DeviceName"
118 #define DIALMODE "DialMode"
119 #define DNS "DNS"
120 #define DOMAIN "Domain"
121 #define DOMAINNAME "DomainName"
122 #define DOMAINSEPARATOR "DomainSeparator"
123 #define DUPLEX "Duplex"
124 #define ENCODING "Encoding"
125 #define ENCRYPTION "Encryption"
126 #define ETHERNET "Ethernet"
127 #define EXCEPTIONSLIST "ExceptionsList"
128 #define FILE "File"
129 #define FTPENABLE "FTPEnable"
130 #define FTPPASSIVE "FTPPassive"
131 #define FTPPORT "FTPPort"
132 #define FTPPROXY "FTPProxy"
133 #define GID "GID"
134 #define GLOBAL "Global"
135 #define GOPHERENABLE "GopherEnable"
136 #define GOPHERPORT "GopherPort"
137 #define GOPHERPROXY "GopherProxy"
138 #define HARDWARE "Hardware"
139 #define HTTPENABLE "HTTPEnable"
140 #define HTTPPORT "HTTPPort"
141 #define HTTPPROXY "HTTPProxy"
142 #define INACTIVE "Inactive"
143 #define INCLUDEPRIVATENETS "IncludePrivateNets"
144 #define INFORM "INFORM"
145 #define INTERFACE "Interface"
146 #define INTERFACES "Interfaces"
147 #define IPCP "IPCP"
148 #define IPV4 "IPv4"
149 #define IPV6 "IPv6"
150 #define LASTUPDATED "LastUpdated"
151 #define LCP "LCP"
152 #define LINK "Link"
153 #define MACADDRESS "MACAddress"
154 #define MANUAL "Manual"
155 #define MEDIA "Media"
156 #define MODEM "Modem"
157 #define NAME "Name"
158 #define NETINFO "NetInfo"
159 #define NETWORK "Network"
160 #define NETWORKSERVICES "NetworkServices"
161 #define NETWORKID "NetworkID"
162 #define NIS "NIS"
163 #define NODE "Node"
164 #define NODEID "NodeID"
165 #define PASSWORD "Password"
166 #define PLUGIN "Plugin"
167 #define PORTNAME "PortName"
168 #define PPP "PPP"
169 #define PPPOE "PPPoE"
170 #define PPPSERIAL "PPPSerial"
171 #define PPPOVERRIDEPRIMARY "PPPOverridePrimary"
172 #define PREFS "Prefs"
173 #define PRIMARYINTERFACE "PrimaryInterface"
174 #define PROTOCOL "Protocol"
175 #define PROXIES "Proxies"
176 #define ROOTSEPARATOR "RootSeparator"
177 #define ROUTER "Router"
178 #define RTSPENABLE "RTSPEnable"
179 #define RTSPPORT "RTSPPort"
180 #define RTSPPROXY "RTSPProxy"
181 #define SEARCHDOMAINS "SearchDomains"
182 #define SEEDNETWORKRANGE "SeedNetworkRange"
183 #define SEEDROUTER "SeedRouter"
184 #define SEEDZONES "SeedZones"
185 #define SERVICE "Service"
186 #define SERVERADDRESSES "ServerAddresses"
187 #define SERVERTAGS "ServerTags"
188 #define SERVICEORDER "ServiceOrder"
189 #define SERVICEIDS "ServiceIDs"
190 #define SETS "Sets"
191 #define SETUP "Setup"
192 #define SPEED "Speed"
193 #define STATE "State"
194 #define SOCKSENABLE "SOCKSEnable"
195 #define SOCKSPORT "SOCKSPort"
196 #define SOCKSPROXY "SOCKSProxy"
197 #define SUBNETMASKS "SubnetMasks"
198 #define SUBTYPE "SubType"
199 #define SYSTEM "System"
200 #define TYPE "Type"
201 #define UID "UID"
202 #define USERS "Users"
203 #define USERDEFINEDNAME "UserDefinedName"
204 #define VERBOSELOGGING "VerboseLogging"
205
206 struct {
207 int control;
208 unsigned char * prefix;
209 unsigned char * key;
210 unsigned char * value;
211 unsigned char * type;
212 } names[] = {
213 { COMMENT, "/*\n * Reserved Keys\n */", NULL, NULL },
214 { REGULAR, RESV, LINK, "__LINK__", CFSTRING },
215 { REGULAR, RESV, INACTIVE, "__INACTIVE__", NULL },
216 { COMMENT, "", NULL, NULL, NULL },
217
218 { COMMENT, "/*\n * Generic Keys\n */", NULL },
219 { REGULAR, PROP, MACADDRESS, NULL, CFSTRING },
220 { REGULAR, PROP, USERDEFINEDNAME, NULL, CFSTRING },
221 { COMMENT, "", NULL, NULL, NULL },
222
223 { COMMENT, "/*\n * Preference Keys\n */", NULL },
224 { REGULAR, PREF, CURRENTSET, NULL, NULL },
225 { REGULAR, PREF, HARDWARE, NULL, NULL },
226 { REGULAR, PREF, NETWORKSERVICES, NULL, NULL },
227 { REGULAR, PREF, SETS, NULL, NULL },
228 { REGULAR, PREF, SYSTEM, NULL, NULL },
229 { COMMENT, "", NULL, NULL, NULL },
230
231 { COMMENT, "/*\n * Component Keys\n */", NULL },
232 { REGULAR, COMP, NETWORK, NULL, NULL },
233 { REGULAR, COMP, SERVICE, NULL, NULL },
234 { REGULAR, COMP, GLOBAL, NULL, NULL },
235 { REGULAR, COMP, INTERFACE, NULL, NULL },
236 { REGULAR, COMP, SYSTEM, NULL, NULL },
237 { REGULAR, COMP, USERS, "users", NULL }, /* FIX ME! */
238 { COMMENT, "", NULL, NULL, NULL },
239
240 { COMMENT, "/*\n * Regex key which matches any component\n */", NULL },
241 { REGULAR, COMP, ANYREGEX, "[^/]+", NULL },
242 { COMMENT, "", NULL, NULL, NULL },
243
244 { COMMENT, "/*\n * Network Entity Keys\n */", NULL },
245 { REGULAR, NETENT, AIRPORT, NULL, NULL },
246 { REGULAR, NETENT, APPLETALK, NULL, NULL },
247 { REGULAR, NETENT, DNS, NULL, NULL },
248 { REGULAR, NETENT, ETHERNET, NULL, NULL },
249 { REGULAR, NETENT, INTERFACE, NULL, NULL },
250 { REGULAR, NETENT, IPV4, NULL, NULL },
251 { REGULAR, NETENT, IPV6, NULL, NULL },
252 { REGULAR, NETENT, LINK, NULL, NULL },
253 { REGULAR, NETENT, MODEM, NULL, NULL },
254 { REGULAR, NETENT, NETINFO, NULL, NULL },
255 { REGULAR, NETENT, NIS, NULL, NULL },
256 { REGULAR, NETENT, PPP, NULL, NULL },
257 { REGULAR, NETENT, PPPOE, NULL, NULL },
258 { REGULAR, NETENT, PROXIES, NULL, NULL },
259 { COMMENT, "", NULL, NULL, NULL },
260
261 { COMMENT, "/*\n * " NETWORK " Properties\n */", NULL },
262 { REGULAR, NETPROP, SERVICEORDER, NULL, CFARRAY_CFSTRING },
263 { REGULAR, NETPROP, PPPOVERRIDEPRIMARY, NULL, CFNUMBER_BOOL },
264 { COMMENT, "", NULL, NULL, NULL },
265
266 { COMMENT, "/*\n * " AIRPORT " (Hardware) Entity Keys\n */", NULL, NULL, NULL },
267 { REGULAR, NETPROP AIRPORT, "PowerEnabled", NULL, CFNUMBER_BOOL },
268 { REGULAR, NETPROP AIRPORT, AUTH PASSWORD, NULL, CFSTRING },
269 { REGULAR, NETPROP AIRPORT, AUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
270 { REGULAR, NETPROP AIRPORT, "PreferredNetwork", NULL, CFSTRING },
271 { COMMENT, "", NULL, NULL, NULL },
272
273 { COMMENT, "/*\n * " APPLETALK " Entity Keys\n */", NULL, NULL, NULL },
274 { REGULAR, NETPROP APPLETALK, COMPUTERNAME, NULL, CFSTRING },
275 { REGULAR, NETPROP APPLETALK, COMPUTERNAME ENCODING, NULL, CFNUMBER },
276 { REGULAR, NETPROP APPLETALK, CONFIGMETHOD, NULL, CFSTRING },
277 { REGULAR, NETPROP APPLETALK, DEFAULTZONE, NULL, CFSTRING },
278 { REGULAR, NETPROP APPLETALK, NETWORKID, NULL, CFNUMBER },
279 { REGULAR, NETPROP APPLETALK, NODEID, NULL, CFNUMBER },
280 { REGULAR, NETPROP APPLETALK, SEEDNETWORKRANGE, NULL, CFARRAY_CFSTRING },
281 { REGULAR, NETPROP APPLETALK, SEEDZONES, NULL, CFARRAY_CFSTRING },
282 { COMMENT, "", NULL, NULL, NULL },
283 { COMMENT, "/* " KEY_PREFIX NETPROP APPLETALK CONFIGMETHOD " values */", NULL, NULL, NULL },
284 { REGULAR, NETVAL APPLETALK CONFIGMETHOD, NODE, NULL, NULL },
285 { REGULAR, NETVAL APPLETALK CONFIGMETHOD, ROUTER, NULL, NULL },
286 { REGULAR, NETVAL APPLETALK CONFIGMETHOD, SEEDROUTER, NULL, NULL },
287 { COMMENT, "", NULL, NULL, NULL },
288
289 { COMMENT, "/*\n * " DNS " Entity Keys\n */", NULL, NULL, NULL },
290 { REGULAR, NETPROP DNS, DOMAINNAME, NULL, CFSTRING },
291 { REGULAR, NETPROP DNS, SEARCHDOMAINS, NULL, CFARRAY_CFSTRING},
292 { REGULAR, NETPROP DNS, SERVERADDRESSES, NULL, CFARRAY_CFSTRING },
293 { COMMENT, "", NULL, NULL, NULL },
294
295 { COMMENT, "/*\n * " ETHERNET " (Hardware) Entity Keys\n */", NULL, NULL, NULL },
296 { COMMENT, "", NULL, NULL, NULL },
297
298 { COMMENT, "/*\n * " INTERFACE " Entity Keys\n */", NULL },
299 { REGULAR, NETPROP INTERFACE, DEVICENAME, NULL, CFSTRING },
300 { REGULAR, NETPROP INTERFACE, HARDWARE, NULL, CFSTRING },
301 { REGULAR, NETPROP INTERFACE, TYPE, NULL, CFSTRING },
302 { REGULAR, NETPROP INTERFACE, SUBTYPE, NULL, CFSTRING },
303 { COMMENT, "", NULL, NULL, NULL },
304 { COMMENT, "/* " KEY_PREFIX NETPROP INTERFACE TYPE " values */", NULL, NULL, NULL },
305 { REGULAR, NETVAL INTERFACE TYPE, ETHERNET, NULL, NULL },
306 { REGULAR, NETVAL INTERFACE TYPE, PPP, NULL, NULL },
307 { COMMENT, "", NULL, NULL, NULL },
308 { COMMENT, "/* " KEY_PREFIX NETPROP SERVICE SUBTYPE " values (for " PPP ") */", NULL, NULL, NULL },
309 { REGULAR, NETVAL INTERFACE SUBTYPE, PPPOE, NULL, NULL },
310 { REGULAR, NETVAL INTERFACE SUBTYPE, PPPSERIAL, NULL, NULL },
311 { COMMENT, "", NULL, NULL, NULL },
312
313 { COMMENT, "/*\n * " IPV4 " Entity Keys\n */", NULL, NULL, NULL },
314 { REGULAR, NETPROP IPV4, ADDRESSES, NULL, CFARRAY_CFSTRING },
315 { REGULAR, NETPROP IPV4, CONFIGMETHOD, NULL, CFSTRING },
316 { REGULAR, NETPROP IPV4, DHCPCLIENTID, NULL, CFSTRING },
317 { REGULAR, NETPROP IPV4, ROUTER, NULL, CFSTRING },
318 { REGULAR, NETPROP IPV4, SUBNETMASKS, NULL, CFARRAY_CFSTRING },
319 { REGULAR, NETPROP IPV4, DESTADDRESSES, NULL, CFARRAY_CFSTRING },
320 { REGULAR, NETPROP IPV4, BROADCASTADDRESSES, NULL, CFARRAY_CFSTRING },
321 { COMMENT, "", NULL, NULL, NULL },
322 { COMMENT, "/* " KEY_PREFIX NETPROP IPV4 CONFIGMETHOD " values */", NULL, NULL, NULL },
323 { REGULAR, NETVAL IPV4 CONFIGMETHOD, BOOTP, NULL, NULL },
324 { REGULAR, NETVAL IPV4 CONFIGMETHOD, DHCP, NULL, NULL },
325 { REGULAR, NETVAL IPV4 CONFIGMETHOD, INFORM, NULL, NULL },
326 { REGULAR, NETVAL IPV4 CONFIGMETHOD, MANUAL, NULL, NULL },
327 { REGULAR, NETVAL IPV4 CONFIGMETHOD, PPP, NULL, NULL },
328 { COMMENT, "", NULL, NULL, NULL },
329
330 { COMMENT, "/*\n * " IPV6 " Entity Keys\n */", NULL, NULL, NULL },
331 { REGULAR, NETPROP IPV6, ADDRESSES, NULL, CFARRAY_CFSTRING },
332 { REGULAR, NETPROP IPV6, CONFIGMETHOD, NULL, CFSTRING },
333 { COMMENT, "", NULL, NULL, NULL },
334
335 { COMMENT, "/*\n * " LINK " Entity Keys\n */", NULL, NULL, NULL },
336 { REGULAR, NETPROP LINK, ACTIVE, NULL, CFNUMBER_BOOL },
337 { COMMENT, "", NULL, NULL, NULL },
338
339 { COMMENT, "/*\n * " MODEM " (Hardware) Entity Keys\n */", NULL, NULL, NULL },
340 { REGULAR, NETPROP MODEM, "ConnectionScript", NULL, CFSTRING },
341 { REGULAR, NETPROP MODEM, DIALMODE, NULL, CFSTRING },
342 { REGULAR, NETPROP MODEM, "PulseDial", NULL, CFNUMBER_BOOL },
343 { REGULAR, NETPROP MODEM, "Speaker", NULL, CFNUMBER_BOOL },
344 { COMMENT, "", NULL, NULL, NULL },
345 { COMMENT, "/* " KEY_PREFIX NETPROP MODEM DIALMODE " values */", NULL, NULL, NULL },
346 { REGULAR, NETVAL MODEM DIALMODE, "IgnoreDialTone", NULL, NULL },
347 { REGULAR, NETVAL MODEM DIALMODE, MANUAL, NULL, NULL },
348 { REGULAR, NETVAL MODEM DIALMODE, "WaitForDialTone", NULL, NULL },
349 { COMMENT, "", NULL, NULL, NULL },
350
351 { COMMENT, "/*\n * " NETINFO " Entity Keys\n */", NULL, NULL, NULL },
352 { REGULAR, NETPROP NETINFO, BINDINGMETHODS, NULL, CFSTRING },
353 { REGULAR, NETPROP NETINFO, SERVERADDRESSES, NULL, CFARRAY_CFSTRING },
354 { REGULAR, NETPROP NETINFO, SERVERTAGS, NULL, CFARRAY_CFSTRING },
355 { REGULAR, NETPROP NETINFO, BROADCASTSERVERTAG, NULL, CFSTRING },
356 { COMMENT, "", NULL, NULL, NULL },
357 { COMMENT, "/* " KEY_PREFIX NETPROP NETINFO BINDINGMETHODS " values */", NULL, NULL, NULL },
358 { REGULAR, NETVAL NETINFO BINDINGMETHODS, BROADCAST, NULL, NULL },
359 { REGULAR, NETVAL NETINFO BINDINGMETHODS, DHCP, NULL, NULL },
360 { REGULAR, NETVAL NETINFO BINDINGMETHODS, MANUAL, NULL, NULL },
361 { COMMENT, "", NULL, NULL, NULL },
362 { COMMENT, "/* " KEY_PREFIX NETPROP NETINFO BROADCASTSERVERTAG " default value */", NULL, NULL, NULL },
363 { REGULAR, NETVAL NETINFO, DEFAULTSERVERTAG, "network", NULL },
364 { COMMENT, "", NULL, NULL, NULL },
365
366 { COMMENT, "/*\n * " NIS " Entity Keys\n */", NULL, NULL, NULL },
367 { REGULAR, NETPROP NIS, DOMAINNAME, NULL, CFSTRING },
368 { COMMENT, "", NULL, NULL, NULL },
369
370 { COMMENT, "/*\n * " PPP " Entity Keys\n */", NULL, NULL, NULL },
371 { REGULAR, NETPROP PPP, "DialOnDemand", NULL, CFNUMBER_BOOL },
372 { REGULAR, NETPROP PPP, "DisconnectOnIdle", NULL, CFNUMBER_BOOL },
373 { REGULAR, NETPROP PPP, "DisconnectOnIdleTimer", NULL, CFNUMBER },
374 { REGULAR, NETPROP PPP, "DisconnectOnLogout", NULL, CFNUMBER_BOOL },
375 { REGULAR, NETPROP PPP, "IdleReminderTimer", NULL, CFNUMBER },
376 { REGULAR, NETPROP PPP, "IdleReminder", NULL, CFNUMBER_BOOL },
377 { REGULAR, NETPROP PPP, "Logfile", NULL, CFSTRING },
378 { REGULAR, NETPROP PPP, VERBOSELOGGING, NULL, CFNUMBER_BOOL },
379 { COMMENT, "", NULL, NULL, NULL },
380
381 { COMMENT, "/* " AUTH ": */", NULL, NULL, NULL },
382 { REGULAR, NETPROP PPP, AUTH NAME, NULL, CFSTRING },
383 { REGULAR, NETPROP PPP, AUTH PASSWORD, NULL, CFSTRING },
384 { REGULAR, NETPROP PPP, AUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
385 { REGULAR, NETPROP PPP, AUTH PROTOCOL, NULL, CFARRAY_CFSTRING },
386 { COMMENT, "", NULL, NULL, NULL },
387 { COMMENT, "/* " KEY_PREFIX NETPROP PPP AUTH PROTOCOL " values */", NULL, NULL, NULL },
388 { REGULAR, NETVAL PPP AUTH PROTOCOL, "CHAP", NULL, CFSTRING },
389 { REGULAR, NETVAL PPP AUTH PROTOCOL, "PAP", NULL, CFSTRING },
390
391 { COMMENT, "\n/* " COMM ": */", NULL, NULL, NULL },
392 { REGULAR, NETPROP PPP, COMM "AlternateRemoteAddress", NULL, CFSTRING },
393 { REGULAR, NETPROP PPP, COMM "ConnectDelay", NULL, CFNUMBER },
394 { REGULAR, NETPROP PPP, COMM "DisplayTerminalWindow", NULL, CFNUMBER_BOOL },
395 { REGULAR, NETPROP PPP, COMM "RedialCount", NULL, CFNUMBER },
396 { REGULAR, NETPROP PPP, COMM "RedialEnabled", NULL, CFNUMBER_BOOL },
397 { REGULAR, NETPROP PPP, COMM "RedialInterval", NULL, CFNUMBER },
398 { REGULAR, NETPROP PPP, COMM "RemoteAddress", NULL, CFSTRING },
399 { REGULAR, NETPROP PPP, COMM "TerminalScript", NULL, CFSTRING },
400
401 { COMMENT, "\n/* " IPCP ": */", NULL, NULL, NULL },
402 { REGULAR, NETPROP PPP, IPCP "CompressionVJ", NULL, CFNUMBER_BOOL },
403
404 { COMMENT, "\n/* " LCP ": */", NULL, NULL, NULL },
405 { REGULAR, NETPROP PPP, LCP "EchoEnabled", NULL, CFNUMBER_BOOL },
406 { REGULAR, NETPROP PPP, LCP "EchoFailure", NULL, CFNUMBER },
407 { REGULAR, NETPROP PPP, LCP "EchoInterval", NULL, CFNUMBER },
408 { REGULAR, NETPROP PPP, LCP "CompressionACField", NULL, CFNUMBER_BOOL },
409 { REGULAR, NETPROP PPP, LCP "CompressionPField", NULL, CFNUMBER_BOOL },
410 { REGULAR, NETPROP PPP, LCP "MRU", NULL, CFNUMBER },
411 { REGULAR, NETPROP PPP, LCP "MTU", NULL, CFNUMBER },
412 { REGULAR, NETPROP PPP, LCP "ReceiveACCM", NULL, CFNUMBER },
413 { REGULAR, NETPROP PPP, LCP "TransmitACCM", NULL, CFNUMBER },
414 { COMMENT, "", NULL, NULL, NULL },
415
416 { COMMENT, "/*\n * " PPPOE " Entity Keys\n */", NULL, NULL, NULL },
417 { COMMENT, "/* RESERVED FOR FUTURE USE */", NULL, NULL, NULL },
418 { COMMENT, "", NULL, NULL, NULL },
419
420 { COMMENT, "/*\n * " PPPSERIAL " Entity Keys\n */", NULL, NULL, NULL },
421 { COMMENT, "/* RESERVED FOR FUTURE USE */", NULL, NULL, NULL },
422 { COMMENT, "", NULL, NULL, NULL },
423
424 { COMMENT, "/*\n * " PROXIES " Entity Keys\n */", NULL, NULL, NULL },
425 { REGULAR, NETPROP PROXIES, EXCEPTIONSLIST, NULL, CFARRAY_CFSTRING },
426 { REGULAR, NETPROP PROXIES, FTPENABLE, NULL, CFNUMBER_BOOL },
427 { REGULAR, NETPROP PROXIES, FTPPASSIVE, NULL, CFNUMBER_BOOL },
428 { REGULAR, NETPROP PROXIES, FTPPORT, NULL, CFNUMBER },
429 { REGULAR, NETPROP PROXIES, FTPPROXY, NULL, CFSTRING },
430 { REGULAR, NETPROP PROXIES, GOPHERENABLE, NULL, CFNUMBER_BOOL },
431 { REGULAR, NETPROP PROXIES, GOPHERPORT, NULL, CFNUMBER },
432 { REGULAR, NETPROP PROXIES, GOPHERPROXY, NULL, CFSTRING },
433 { REGULAR, NETPROP PROXIES, HTTPENABLE, NULL, CFNUMBER_BOOL },
434 { REGULAR, NETPROP PROXIES, HTTPPORT, NULL, CFNUMBER },
435 { REGULAR, NETPROP PROXIES, HTTPPROXY, NULL, CFSTRING },
436 { REGULAR, NETPROP PROXIES, RTSPENABLE, NULL, CFNUMBER_BOOL },
437 { REGULAR, NETPROP PROXIES, RTSPPORT, NULL, CFNUMBER },
438 { REGULAR, NETPROP PROXIES, RTSPPROXY, NULL, CFSTRING },
439 { REGULAR, NETPROP PROXIES, SOCKSENABLE, NULL, CFNUMBER_BOOL },
440 { REGULAR, NETPROP PROXIES, SOCKSPORT, NULL, CFNUMBER },
441 { REGULAR, NETPROP PROXIES, SOCKSPROXY, NULL, CFSTRING },
442 { COMMENT, "", NULL, NULL, NULL },
443
444 { COMMENT, "/*\n * Users Entity Keys\n */", NULL, NULL, NULL },
445 { REGULAR, USERSENT, CONSOLEUSER, NULL, NULL },
446 { COMMENT, "", NULL, NULL, NULL },
447
448 { COMMENT, "/*\n " CONSOLEUSER " Entity Keys\n */", NULL, NULL, NULL },
449 { REGULAR, USERSPROP CONSOLEUSER, NAME, "username", CFSTRING }, /* FIX ME! */
450 { REGULAR, USERSPROP CONSOLEUSER, UID, "uid", CFSTRING }, /* FIX ME! */
451 { REGULAR, USERSPROP CONSOLEUSER, GID, "gid", CFSTRING }, /* FIX ME! */
452 { COMMENT, "", NULL, NULL, NULL },
453
454 { COMMENT, "/*\n * " SYSTEM " Entity Keys\n */", NULL, NULL, NULL },
455 { REGULAR, SYSTEMPROP, COMPUTERNAME, NULL, CFSTRING },
456 { REGULAR, SYSTEMPROP, COMPUTERNAME ENCODING, NULL, CFNUMBER },
457 { COMMENT, "", NULL, NULL, NULL },
458
459 { COMMENT, "/*\n * Configuration Cache Definitions\n */", NULL },
460 { COMMENT, "/* domain prefixes */", NULL },
461 { REGULAR, CACHE DOMAIN, FILE, "File:", NULL },
462 { REGULAR, CACHE DOMAIN, PLUGIN, "Plugin:", NULL },
463 { REGULAR, CACHE DOMAIN, SETUP, "Setup:", NULL },
464 { REGULAR, CACHE DOMAIN, STATE, "State:", NULL },
465 { REGULAR, CACHE DOMAIN, PREFS, "Prefs:", NULL },
466 { COMMENT, "", NULL, NULL, NULL },
467
468 { COMMENT, "/* Setup: properties */", NULL },
469 { REGULAR, CACHE SETUPPROP, CURRENTSET, NULL, NULL },
470 { REGULAR, CACHE SETUPPROP, LASTUPDATED, NULL, NULL },
471 { COMMENT, "", NULL, NULL, NULL },
472
473 { COMMENT, "/* properties */", NULL },
474 { REGULAR, CACHE NETPROP, INTERFACES, NULL, CFARRAY_CFSTRING },
475 { REGULAR, CACHE NETPROP, PRIMARYINTERFACE, NULL, CFSTRING },
476 { REGULAR, CACHE NETPROP, SERVICEIDS, NULL, CFARRAY_CFSTRING },
477 { COMMENT, "", NULL, NULL, NULL },
478
479 // XXX OBSOLETE XXX
480 { COMMENT, "/* OBSOLETE " NETPROP AIRPORT ": */", NULL, NULL, NULL },
481 { REGULAR, NETPROP AIRPORT, INCLUDEPRIVATENETS, NULL, CFNUMBER_BOOL },
482 { REGULAR, NETPROP AIRPORT, "PreferredAirportNetwork", NULL, CFSTRING },
483
484 { COMMENT, "/* OBSOLETE " NETPROP ETHERNET ": */", NULL, NULL, NULL },
485 { REGULAR, NETPROP ETHERNET, SPEED, NULL, CFNUMBER },
486 { REGULAR, NETPROP ETHERNET, DUPLEX, NULL, CFSTRING },
487 { REGULAR, NETPROP ETHERNET, "WakeOnSignal", NULL, CFNUMBER_BOOL },
488 { REGULAR, NETPROP ETHERNET, "WakeOnTraffic", NULL, CFNUMBER_BOOL },
489 { COMMENT, "/* " KEY_PREFIX NETPROP ETHERNET DUPLEX " values */", NULL, NULL, NULL },
490 { REGULAR, NETVAL ETHERNET DUPLEX, AUTOMATIC, NULL, NULL },
491 { REGULAR, NETVAL ETHERNET DUPLEX, "FULL", NULL, NULL },
492 { REGULAR, NETVAL ETHERNET DUPLEX, "HALF", NULL, NULL },
493
494 { COMMENT, "/* OBSOLETE " NETPROP INTERFACE ": */", NULL, NULL, NULL },
495 { REGULAR, NETPROP INTERFACE, INTERFACE NAME, NULL, CFSTRING },
496 { REGULAR, NETPROP INTERFACE, MACADDRESS, NULL, CFSTRING },
497 { REGULAR, NETPROP INTERFACE, PORTNAME, NULL, CFSTRING },
498
499 { COMMENT, "/* OBSOLETE " NETPROP MODEM ": */", NULL, NULL, NULL },
500 { REGULAR, NETPROP MODEM, "IgnoreDialTone", NULL, CFNUMBER_BOOL },
501 { REGULAR, NETPROP MODEM, "InitString", NULL, CFNUMBER_BOOL },
502 { REGULAR, NETPROP MODEM, "Port", NULL, CFNUMBER_BOOL },
503 { REGULAR, NETPROP MODEM, PORTNAME, NULL, CFSTRING },
504 { REGULAR, NETPROP MODEM, "RedialCount", NULL, CFNUMBER_BOOL },
505 { REGULAR, NETPROP MODEM, "RedialEnabled", NULL, CFNUMBER_BOOL },
506 { REGULAR, NETPROP MODEM, "RedialTimeout", NULL, CFNUMBER_BOOL },
507 { REGULAR, NETPROP MODEM, "Script", NULL, CFSTRING },
508 { REGULAR, NETPROP MODEM, "SpeakerEnable", NULL, CFNUMBER },
509 { REGULAR, NETPROP MODEM, SPEED, NULL, CFNUMBER },
510 { REGULAR, NETPROP MODEM, "ToneDial", NULL, CFNUMBER },
511 { REGULAR, NETPROP MODEM, "WaitForTone", NULL, CFNUMBER },
512
513 { COMMENT, "/* OBSOLETE " NETPROP PPP ": */", NULL, NULL, NULL },
514 { REGULAR, NETPROP PPP, ALERT, NULL, CFARRAY_CFSTRING },
515 { REGULAR, NETVAL PPP ALERT, "Password", NULL, CFSTRING },
516 { REGULAR, NETVAL PPP ALERT, "Reminder", NULL, CFSTRING },
517 { REGULAR, NETVAL PPP ALERT, "Status", NULL, CFSTRING },
518 { REGULAR, NETPROP PPP, "CompressionEnable", NULL, CFNUMBER_BOOL },
519 { REGULAR, NETPROP PPP, "DeviceEntity", NULL, CFSTRING },
520 { REGULAR, NETPROP PPP, "HeaderCompression", NULL, CFNUMBER_BOOL },
521 { REGULAR, NETPROP PPP, "IdleDisconnect", NULL, CFNUMBER_BOOL },
522 { REGULAR, NETPROP PPP, "IdlePrompt", NULL, CFNUMBER_BOOL },
523 { REGULAR, NETPROP PPP, "IdleTimeout", NULL, CFSTRING },
524 { REGULAR, NETPROP PPP, "PromptTimeout", NULL, CFNUMBER },
525 { REGULAR, NETPROP PPP, "ReminderTimer", NULL, CFNUMBER },
526 { REGULAR, NETPROP PPP, "SessionTimer", NULL, CFNUMBER },
527 { REGULAR, NETPROP PPP, COMM "IdleTimer", NULL, CFNUMBER },
528 { REGULAR, NETPROP PPP, IPCP "LocalAddress", NULL, CFSTRING },
529 { REGULAR, NETPROP PPP, IPCP "RemoteAddress", NULL, CFSTRING },
530 { REGULAR, NETPROP PPP, IPCP "UseServerDNS", NULL, CFNUMBER_BOOL },
531
532 { COMMENT, "/* OBSOLETE " NETPROP PPPOE ": */", NULL, NULL, NULL },
533 { REGULAR, NETPROP PPPOE, PORTNAME, NULL, CFSTRING },
534
535 { COMMENT, "", NULL, NULL, NULL },
536 // XXX OBSOLETE XXX
537
538 { END, NULL, NULL, NULL, NULL },
539 };
540
541 enum {
542 gen_extern_e,
543 gen_init_e,
544 gen_header_e,
545 };
546
547 void
548 dump_names(int type)
549 {
550 int i;
551
552 for (i = 0; TRUE; i++) {
553 switch (names[i].control) {
554 case END: {
555 goto done;
556 break;
557 }
558 case COMMENT: {
559 if (type != gen_extern_e && type != gen_init_e) {
560 if (names[i].prefix)
561 printf("%s\n", names[i].prefix);
562 }
563 break;
564 }
565 case REGULAR: {
566 char buf[256];
567
568 switch (type) {
569 case gen_header_e:
570 snprintf(buf, sizeof(buf), KEY_PREFIX "%s%s;",
571 names[i].prefix, names[i].key);
572
573 if (names[i].type)
574 printf(STRING_MACRO_NAME " %-40s /* %s */\n",
575 buf, names[i].type);
576 else
577 printf(STRING_MACRO_NAME " %s\n", buf);
578 break;
579 case gen_extern_e:
580 snprintf(buf, sizeof(buf), KEY_PREFIX "%s%s",
581 names[i].prefix, names[i].key);
582
583 printf("volatile CFStringRef " KEY_PREFIX "%s%s = NULL;\n",
584 names[i].prefix, names[i].key);
585 break;
586 case gen_init_e:
587 snprintf(buf, sizeof(buf), KEY_PREFIX "%s%s",
588 names[i].prefix, names[i].key);
589 if (names[i].value)
590 printf(" *((void **)&%s) = (void *)CFSTR(\"%s\");\n",
591 buf, names[i].value);
592 else
593 printf(" *((void **)&%s) = (void *)CFSTR(\"%s\");\n",
594 buf, names[i].key);
595 break;
596 default:
597 break;
598 }
599 }
600 default: {
601 break;
602 }
603 }
604 }
605 done:
606 return;
607 }
608
609 int
610 main(int argc, char * argv[])
611 {
612 char * type = "";
613
614 if (argc >= 2)
615 type = argv[1];
616
617 if (strcmp(type, "header") == 0) {
618 printf("%s\n", copyright_string);
619 printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n");
620 printf("#ifndef _SCPREFERENCES_H\n#define _SCPREFERENCES_H\n\n");
621 //printf("#ifndef " STRING_MACRO_NAME "\n");
622 printf("#ifndef __OBJC__\n");
623 printf("#define " STRING_MACRO_NAME "\t\textern const CFStringRef\n");
624 printf("#else\n");
625 printf("#define " STRING_MACRO_NAME "\t\textern NSString *\n");
626 printf("#endif\n");
627 //printf("#endif " STRING_MACRO_NAME "\n");
628 printf("\n");
629 dump_names(gen_header_e);
630 printf("#endif /* _SCPREFERENCES_H */\n");
631 }
632 else if (strcmp(type, "cfile") == 0) {
633 printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n");
634 printf("\n#include <CoreFoundation/CFString.h>\n\n");
635 dump_names(gen_extern_e);
636 printf("\n\nvoid\n__private_extern__\n__Initialize(void)\n{\n");
637 dump_names(gen_init_e);
638 printf("}\n");
639 }
640 exit(0);
641 return (0);
642 }
643