3 Lexical scanner for dhcpd config file... */
6 * Copyright (c) 1995-2001 Internet Software Consortium.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of The Internet Software Consortium nor the names
19 * of its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * This software has been written for the Internet Software Consortium
37 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
38 * To learn more about the Internet Software Consortium, see
39 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
40 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
41 * ``http://www.nominum.com''.
45 static char copyright
[] =
46 "$Id: conflex.c,v 1.94 2001/06/27 00:29:42 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
52 static int get_char
PROTO ((struct parse
*));
53 static enum dhcp_token get_token
PROTO ((struct parse
*));
54 static void skip_to_eol
PROTO ((struct parse
*));
55 static enum dhcp_token read_string
PROTO ((struct parse
*));
56 static enum dhcp_token read_number
PROTO ((int, struct parse
*));
57 static enum dhcp_token read_num_or_name
PROTO ((int, struct parse
*));
58 static enum dhcp_token intern
PROTO ((char *, enum dhcp_token
));
60 isc_result_t
new_parse (cfile
, file
, inbuf
, buflen
, name
, eolp
)
70 tmp
= dmalloc (sizeof (struct parse
), MDL
);
72 return ISC_R_NOMEMORY
;
73 memset (tmp
, 0, sizeof *tmp
);
77 tmp
-> lpos
= tmp
-> line
= 1;
78 tmp
-> cur_line
= tmp
-> line1
;
79 tmp
-> prev_line
= tmp
-> line2
;
80 tmp
-> token_line
= tmp
-> cur_line
;
81 tmp
-> cur_line
[0] = tmp
-> prev_line
[0] = 0;
82 tmp
-> warnings_occurred
= 0;
84 tmp
-> eol_token
= eolp
;
87 tmp
-> buflen
= buflen
;
92 tmp
-> inbuf
= dmalloc (8192, MDL
);
95 return ISC_R_NOMEMORY
;
101 return ISC_R_SUCCESS
;
104 isc_result_t
end_parse (cfile
)
105 struct parse
**cfile
;
107 if ((*cfile
) -> bufsiz
)
108 dfree ((*cfile
) -> inbuf
, MDL
);
110 *cfile
= (struct parse
*)0;
111 return ISC_R_SUCCESS
;
114 static int get_char (cfile
)
117 /* My kingdom for WITH... */
120 if (cfile
-> bufix
== cfile
-> buflen
) {
121 if (cfile
-> file
!= -1) {
124 cfile
-> inbuf
, cfile
-> bufsiz
);
125 if (cfile
-> buflen
== 0) {
128 } else if (cfile
-> buflen
< 0) {
130 cfile
-> bufix
= cfile
-> buflen
= 0;
132 c
= cfile
-> inbuf
[0];
138 c
= cfile
-> inbuf
[cfile
-> bufix
];
142 if (!cfile
-> ugflag
) {
144 if (cfile
-> cur_line
== cfile
-> line1
) {
145 cfile
-> cur_line
= cfile
-> line2
;
146 cfile
-> prev_line
= cfile
-> line1
;
148 cfile
-> cur_line
= cfile
-> line1
;
149 cfile
-> prev_line
= cfile
-> line2
;
153 cfile
-> cur_line
[0] = 0;
154 } else if (c
!= EOF
) {
155 if (cfile
-> lpos
<= 80) {
156 cfile
-> cur_line
[cfile
-> lpos
- 1] = c
;
157 cfile
-> cur_line
[cfile
-> lpos
] = 0;
166 static enum dhcp_token
get_token (cfile
)
170 enum dhcp_token ttok
;
179 c
= get_char (cfile
);
181 if (c
== '\n' && p
== 1 && !u
182 && cfile
-> comment_index
< sizeof cfile
-> comments
)
183 cfile
-> comments
[cfile
-> comment_index
++] = '\n';
186 if (!(c
== '\n' && cfile
-> eol_token
)
187 && isascii (c
) && isspace (c
))
191 if (cfile
-> comment_index
< sizeof cfile
-> comments
)
192 cfile
-> comments
[cfile
-> comment_index
++] = '#';
198 cfile
-> lexline
= l
;
199 cfile
-> lexchar
= p
;
200 ttok
= read_string (cfile
);
203 if ((isascii (c
) && isdigit (c
)) || c
== '-') {
204 cfile
-> lexline
= l
;
205 cfile
-> lexchar
= p
;
206 ttok
= read_number (c
, cfile
);
208 } else if (isascii (c
) && isalpha (c
)) {
209 cfile
-> lexline
= l
;
210 cfile
-> lexchar
= p
;
211 ttok
= read_num_or_name (c
, cfile
);
213 } else if (c
== EOF
) {
218 cfile
-> lexline
= l
;
219 cfile
-> lexchar
= p
;
231 enum dhcp_token
next_token (rval
, rlen
, cfile
)
238 if (cfile
-> token
) {
239 if (cfile
-> lexline
!= cfile
-> tline
)
240 cfile
-> token_line
= cfile
-> cur_line
;
241 cfile
-> lexchar
= cfile
-> tlpos
;
242 cfile
-> lexline
= cfile
-> tline
;
246 rv
= get_token (cfile
);
247 cfile
-> token_line
= cfile
-> cur_line
;
250 *rval
= cfile
-> tval
;
252 *rlen
= cfile
-> tlen
;
254 fprintf (stderr
, "%s:%d ", cfile
-> tval
, rv
);
259 enum dhcp_token
peek_token (rval
, rlen
, cfile
)
266 if (!cfile
-> token
) {
267 cfile
-> tlpos
= cfile
-> lexchar
;
268 cfile
-> tline
= cfile
-> lexline
;
269 cfile
-> token
= get_token (cfile
);
270 if (cfile
-> lexline
!= cfile
-> tline
)
271 cfile
-> token_line
= cfile
-> prev_line
;
273 x
= cfile
-> lexchar
;
274 cfile
-> lexchar
= cfile
-> tlpos
;
277 x
= cfile
-> lexline
;
278 cfile
-> lexline
= cfile
-> tline
;
282 *rval
= cfile
-> tval
;
284 *rlen
= cfile
-> tlen
;
286 fprintf (stderr
, "(%s:%d) ", cfile
-> tval
, cfile
-> token
);
288 return cfile
-> token
;
291 static void skip_to_eol (cfile
)
296 c
= get_char (cfile
);
300 if (cfile
-> comment_index
< sizeof (cfile
-> comments
))
301 comments
[cfile
-> comment_index
++] = c
;
309 static enum dhcp_token
read_string (cfile
)
318 for (i
= 0; i
< sizeof cfile
-> tokbuf
; i
++) {
320 c
= get_char (cfile
);
322 parse_warn (cfile
, "eof in string constant");
328 cfile
-> tokbuf
[i
] = '\t';
331 cfile
-> tokbuf
[i
] = '\r';
334 cfile
-> tokbuf
[i
] = '\n';
337 cfile
-> tokbuf
[i
] = '\b';
353 cfile
-> tokbuf
[i
] = c
;
360 if (c
>= '0' && c
<= '9') {
361 value
= value
* 16 + (c
- '0');
362 } else if (c
>= 'a' && c
<= 'f') {
363 value
= value
* 16 + (c
- 'a' + 10);
364 } else if (c
>= 'A' && c
<= 'F') {
365 value
= value
* 16 + (c
- 'A' + 10);
368 "invalid hex digit: %x",
374 cfile
-> tokbuf
[i
] = value
;
379 if (c
>= '0' && c
<= '9') {
380 value
= value
* 8 + (c
- '0');
384 "invalid octal digit %x",
388 cfile
-> tokbuf
[i
] = 0;
392 cfile
-> tokbuf
[i
] = value
;
397 } else if (c
== '\\') {
403 cfile
-> tokbuf
[i
] = c
;
405 /* Normally, I'd feel guilty about this, but we're talking about
406 strings that'll fit in a DHCP packet here... */
407 if (i
== sizeof cfile
-> tokbuf
) {
409 "string constant larger than internal buffer");
412 cfile
-> tokbuf
[i
] = 0;
414 cfile
-> tval
= cfile
-> tokbuf
;
418 static enum dhcp_token
read_number (c
, cfile
)
426 cfile
-> tokbuf
[i
++] = c
;
427 for (; i
< sizeof cfile
-> tokbuf
; i
++) {
428 c
= get_char (cfile
);
429 if (!seenx
&& c
== 'x') {
432 } else if (isascii (c
) && !isxdigit (c
) &&
433 (c
== '-' || c
== '_' || isalpha (c
))) {
435 } else if (isascii (c
) && !isdigit (c
) && isxdigit (c
)) {
436 token
= NUMBER_OR_NAME
;
438 } else if (!isascii (c
) || !isxdigit (c
)) {
443 cfile
-> tokbuf
[i
] = c
;
445 if (i
== sizeof cfile
-> tokbuf
) {
447 "numeric token larger than internal buffer");
450 cfile
-> tokbuf
[i
] = 0;
452 cfile
-> tval
= cfile
-> tokbuf
;
456 static enum dhcp_token
read_num_or_name (c
, cfile
)
461 enum dhcp_token rv
= NUMBER_OR_NAME
;
462 cfile
-> tokbuf
[i
++] = c
;
463 for (; i
< sizeof cfile
-> tokbuf
; i
++) {
464 c
= get_char (cfile
);
466 (c
!= '-' && c
!= '_' && !isalnum (c
))) {
473 cfile
-> tokbuf
[i
] = c
;
475 if (i
== sizeof cfile
-> tokbuf
) {
476 parse_warn (cfile
, "token larger than internal buffer");
479 cfile
-> tokbuf
[i
] = 0;
481 cfile
-> tval
= cfile
-> tokbuf
;
482 return intern (cfile
-> tval
, rv
);
485 static enum dhcp_token
intern (atom
, dfv
)
489 if (!isascii (atom
[0]))
492 switch (tolower (atom
[0])) {
499 if (!strncasecmp (atom
+ 1, "uth", 3)) {
500 if (!strncasecmp (atom
+ 3, "uthenticat", 10)) {
501 if (!strcasecmp (atom
+ 13, "ed"))
502 return AUTHENTICATED
;
503 if (!strcasecmp (atom
+ 13, "ion"))
504 return AUTHENTICATION
;
507 if (!strcasecmp (atom
+ 1, "uthoritative"))
508 return AUTHORITATIVE
;
511 if (!strcasecmp (atom
+ 1, "nd"))
513 if (!strcasecmp (atom
+ 1, "ppend"))
515 if (!strcasecmp (atom
+ 1, "llow"))
517 if (!strcasecmp (atom
+ 1, "lias"))
519 if (!strcasecmp (atom
+ 1, "lgorithm"))
521 if (!strcasecmp (atom
+ 1, "bandoned"))
522 return TOKEN_ABANDONED
;
523 if (!strcasecmp (atom
+ 1, "dd"))
525 if (!strcasecmp (atom
+ 1, "ll"))
527 if (!strcasecmp (atom
+ 1, "t"))
529 if (!strcasecmp (atom
+ 1, "rray"))
531 if (!strcasecmp (atom
+ 1, "ddress"))
533 if (!strcasecmp (atom
+ 1, "ctive"))
537 if (!strcasecmp (atom
+ 1, "ackup"))
539 if (!strcasecmp (atom
+ 1, "ootp"))
541 if (!strcasecmp (atom
+ 1, "inding"))
543 if (!strcasecmp (atom
+ 1, "inary-to-ascii"))
544 return BINARY_TO_ASCII
;
545 if (!strcasecmp (atom
+ 1, "ackoff-cutoff"))
546 return BACKOFF_CUTOFF
;
547 if (!strcasecmp (atom
+ 1, "ooting"))
549 if (!strcasecmp (atom
+ 1, "oot-unknown-clients"))
550 return BOOT_UNKNOWN_CLIENTS
;
551 if (!strcasecmp (atom
+ 1, "reak"))
553 if (!strcasecmp (atom
+ 1, "illing"))
555 if (!strcasecmp (atom
+ 1, "oolean"))
557 if (!strcasecmp (atom
+ 1, "alance"))
559 if (!strcasecmp (atom
+ 1, "ound"))
563 if (!strcasecmp (atom
+ 1, "ase"))
565 if (!strcasecmp (atom
+ 1, "ommit"))
567 if (!strcasecmp (atom
+ 1, "ode"))
569 if (!strcasecmp (atom
+ 1, "onfig-option"))
570 return CONFIG_OPTION
;
571 if (!strcasecmp (atom
+ 1, "heck"))
573 if (!strcasecmp (atom
+ 1, "lass"))
575 if (!strcasecmp (atom
+ 1, "lose"))
577 if (!strcasecmp (atom
+ 1, "reate"))
579 if (!strcasecmp (atom
+ 1, "iaddr"))
581 if (!strncasecmp (atom
+ 1, "lient", 5)) {
582 if (!strcasecmp (atom
+ 6, "-identifier"))
583 return CLIENT_IDENTIFIER
;
584 if (!strcasecmp (atom
+ 6, "-hostname"))
585 return CLIENT_HOSTNAME
;
586 if (!strcasecmp (atom
+ 6, "-state"))
588 if (!strcasecmp (atom
+ 6, "-updates"))
589 return CLIENT_UPDATES
;
590 if (!strcasecmp (atom
+ 6, "s"))
593 if (!strcasecmp (atom
+ 1, "oncat"))
595 if (!strcasecmp (atom
+ 1, "onnect"))
597 if (!strcasecmp (atom
+ 1, "ommunications-interrupted"))
598 return COMMUNICATIONS_INTERRUPTED
;
599 if (!strcasecmp (atom
+ 1, "ltt"))
603 if (!strcasecmp (atom
+ 1, "ns-update"))
605 if (!strcasecmp (atom
+ 1, "ns-delete"))
607 if (!strcasecmp (atom
+ 1, "omain"))
609 if (!strcasecmp (atom
+ 1, "omain-name"))
611 if (!strcasecmp (atom
+ 1, "ebug"))
613 if (!strcasecmp (atom
+ 1, "eny"))
615 if (!strcasecmp (atom
+ 1, "eleted"))
616 return TOKEN_DELETED
;
617 if (!strcasecmp (atom
+ 1, "elete"))
619 if (!strncasecmp (atom
+ 1, "efault", 6)) {
622 if (!strcasecmp (atom
+ 7, "-lease-time"))
623 return DEFAULT_LEASE_TIME
;
626 if (!strncasecmp (atom
+ 1, "ynamic", 6)) {
629 if (!strncasecmp (atom
+ 7, "-bootp", 6)) {
631 return DYNAMIC_BOOTP
;
632 if (!strcasecmp (atom
+ 13, "-lease-cutoff"))
633 return DYNAMIC_BOOTP_LEASE_CUTOFF
;
634 if (!strcasecmp (atom
+ 13, "-lease-length"))
635 return DYNAMIC_BOOTP_LEASE_LENGTH
;
639 if (!strcasecmp (atom
+ 1, "uplicates"))
641 if (!strcasecmp (atom
+ 1, "eclines"))
643 if (!strncasecmp (atom
+ 1, "efine", 5)) {
644 if (!strcasecmp (atom
+ 6, "d"))
651 if (isascii (atom
[1]) && tolower (atom
[1]) == 'x') {
652 if (!strcasecmp (atom
+ 2, "tract-int"))
654 if (!strcasecmp (atom
+ 2, "ists"))
656 if (!strcasecmp (atom
+ 2, "piry"))
658 if (!strcasecmp (atom
+ 2, "pire"))
660 if (!strcasecmp (atom
+ 2, "pired"))
661 return TOKEN_EXPIRED
;
663 if (!strcasecmp (atom
+ 1, "ncode-int"))
665 if (!strcasecmp (atom
+ 1, "thernet"))
667 if (!strcasecmp (atom
+ 1, "nds"))
669 if (!strncasecmp (atom
+ 1, "ls", 2)) {
670 if (!strcasecmp (atom
+ 3, "e"))
672 if (!strcasecmp (atom
+ 3, "if"))
676 if (!strcasecmp (atom
+ 1, "rror"))
678 if (!strcasecmp (atom
+ 1, "val"))
680 if (!strcasecmp (atom
+ 1, "ncapsulate"))
684 if (!strcasecmp (atom
+ 1, "atal"))
686 if (!strcasecmp (atom
+ 1, "ilename"))
688 if (!strcasecmp (atom
+ 1, "ixed-address"))
690 if (!strcasecmp (atom
+ 1, "ddi"))
692 if (!strcasecmp (atom
+ 1, "ormerr"))
694 if (!strcasecmp (atom
+ 1, "unction"))
696 if (!strcasecmp (atom
+ 1, "ailover"))
698 if (!strcasecmp (atom
+ 1, "ree"))
702 if (!strcasecmp (atom
+ 1, "iaddr"))
704 if (!strcasecmp (atom
+ 1, "roup"))
706 if (!strcasecmp (atom
+ 1, "et-lease-hostnames"))
707 return GET_LEASE_HOSTNAMES
;
710 if (!strcasecmp (atom
+ 1, "ba"))
712 if (!strcasecmp (atom
+ 1, "ost"))
714 if (!strcasecmp (atom
+ 1, "ost-decl-name"))
715 return HOST_DECL_NAME
;
716 if (!strcasecmp (atom
+ 1, "ardware"))
718 if (!strcasecmp (atom
+ 1, "ostname"))
720 if (!strcasecmp (atom
+ 1, "elp"))
724 if (!strcasecmp (atom
+ 1, "nclude"))
726 if (!strcasecmp (atom
+ 1, "nteger"))
728 if (!strcasecmp (atom
+ 1, "nfinite"))
730 if (!strcasecmp (atom
+ 1, "nfo"))
732 if (!strcasecmp (atom
+ 1, "p-address"))
734 if (!strcasecmp (atom
+ 1, "nitial-interval"))
735 return INITIAL_INTERVAL
;
736 if (!strcasecmp (atom
+ 1, "nterface"))
738 if (!strcasecmp (atom
+ 1, "dentifier"))
740 if (!strcasecmp (atom
+ 1, "f"))
742 if (!strcasecmp (atom
+ 1, "s"))
744 if (!strcasecmp (atom
+ 1, "gnore"))
748 if (!strcasecmp (atom
+ 1, "nown"))
750 if (!strcasecmp (atom
+ 1, "ey"))
754 if (!strcasecmp (atom
+ 1, "ease"))
756 if (!strcasecmp (atom
+ 1, "eased-address"))
757 return LEASED_ADDRESS
;
758 if (!strcasecmp (atom
+ 1, "ease-time"))
760 if (!strcasecmp (atom
+ 1, "imit"))
762 if (!strcasecmp (atom
+ 1, "et"))
764 if (!strcasecmp (atom
+ 1, "oad"))
766 if (!strcasecmp (atom
+ 1, "og"))
770 if (!strncasecmp (atom
+ 1, "ax", 2)) {
773 if (!strcasecmp (atom
+ 3, "-lease-time"))
774 return MAX_LEASE_TIME
;
775 if (!strcasecmp (atom
+ 3, "-transmit-idle"))
776 return MAX_TRANSMIT_IDLE
;
777 if (!strcasecmp (atom
+ 3, "-response-delay"))
778 return MAX_RESPONSE_DELAY
;
779 if (!strcasecmp (atom
+ 3, "-unacked-updates"))
780 return MAX_UNACKED_UPDATES
;
782 if (!strncasecmp (atom
+ 1, "in-", 3)) {
783 if (!strcasecmp (atom
+ 4, "lease-time"))
784 return MIN_LEASE_TIME
;
785 if (!strcasecmp (atom
+ 4, "secs"))
789 if (!strncasecmp (atom
+ 1, "edi", 3)) {
790 if (!strcasecmp (atom
+ 4, "a"))
792 if (!strcasecmp (atom
+ 4, "um"))
796 if (!strcasecmp (atom
+ 1, "atch"))
798 if (!strcasecmp (atom
+ 1, "embers"))
800 if (!strcasecmp (atom
+ 1, "y"))
802 if (!strcasecmp (atom
+ 1, "clt"))
806 if (!strcasecmp (atom
+ 1, "ormal"))
808 if (!strcasecmp (atom
+ 1, "ameserver"))
810 if (!strcasecmp (atom
+ 1, "etmask"))
812 if (!strcasecmp (atom
+ 1, "ever"))
814 if (!strcasecmp (atom
+ 1, "ext-server"))
816 if (!strcasecmp (atom
+ 1, "ot"))
818 if (!strcasecmp (atom
+ 1, "o"))
820 if (!strcasecmp (atom
+ 1, "s-update"))
822 if (!strcasecmp (atom
+ 1, "oerror"))
824 if (!strcasecmp (atom
+ 1, "otauth"))
826 if (!strcasecmp (atom
+ 1, "otimp"))
828 if (!strcasecmp (atom
+ 1, "otzone"))
830 if (!strcasecmp (atom
+ 1, "xdomain"))
832 if (!strcasecmp (atom
+ 1, "xrrset"))
834 if (!strcasecmp (atom
+ 1, "ull"))
836 if (!strcasecmp (atom
+ 1, "ext"))
838 if (!strcasecmp (atom
+ 1, "ew"))
842 if (!strcasecmp (atom
+ 1, "mapi"))
844 if (!strcasecmp (atom
+ 1, "r"))
846 if (!strcasecmp (atom
+ 1, "n"))
848 if (!strcasecmp (atom
+ 1, "pen"))
850 if (!strcasecmp (atom
+ 1, "ption"))
852 if (!strcasecmp (atom
+ 1, "ne-lease-per-client"))
853 return ONE_LEASE_PER_CLIENT
;
854 if (!strcasecmp (atom
+ 1, "f"))
856 if (!strcasecmp (atom
+ 1, "wner"))
860 if (!strcasecmp (atom
+ 1, "repend"))
862 if (!strcasecmp (atom
+ 1, "acket"))
864 if (!strcasecmp (atom
+ 1, "ool"))
866 if (!strcasecmp (atom
+ 1, "seudo"))
868 if (!strcasecmp (atom
+ 1, "eer"))
870 if (!strcasecmp (atom
+ 1, "rimary"))
872 if (!strncasecmp (atom
+ 1, "artner", 6)) {
875 if (!strcasecmp (atom
+ 7, "-down"))
878 if (!strcasecmp (atom
+ 1, "ort"))
880 if (!strcasecmp (atom
+ 1, "otential-conflict"))
881 return POTENTIAL_CONFLICT
;
882 if (!strcasecmp (atom
+ 1, "ick-first-value") ||
883 !strcasecmp (atom
+ 1, "ick"))
885 if (!strcasecmp (atom
+ 1, "aused"))
889 if (!strcasecmp (atom
+ 1, "esolution-interrupted"))
890 return RESOLUTION_INTERRUPTED
;
891 if (!strcasecmp (atom
+ 1, "ange"))
893 if (!strcasecmp (atom
+ 1, "ecover"))
895 if (!strcasecmp (atom
+ 1, "ecover-done"))
897 if (!strcasecmp (atom
+ 1, "ecover-wait"))
899 if (!strcasecmp (atom
+ 1, "econtact-interval"))
900 return RECONTACT_INTERVAL
;
901 if (!strcasecmp (atom
+ 1, "equest"))
903 if (!strcasecmp (atom
+ 1, "equire"))
905 if (!strcasecmp (atom
+ 1, "equire"))
907 if (!strcasecmp (atom
+ 1, "etry"))
909 if (!strcasecmp (atom
+ 1, "eturn"))
911 if (!strcasecmp (atom
+ 1, "enew"))
913 if (!strcasecmp (atom
+ 1, "ebind"))
915 if (!strcasecmp (atom
+ 1, "eboot"))
917 if (!strcasecmp (atom
+ 1, "eject"))
919 if (!strcasecmp (atom
+ 1, "everse"))
921 if (!strcasecmp (atom
+ 1, "elease"))
923 if (!strcasecmp (atom
+ 1, "efused"))
925 if (!strcasecmp (atom
+ 1, "eleased"))
926 return TOKEN_RELEASED
;
927 if (!strcasecmp (atom
+ 1, "eset"))
929 if (!strcasecmp (atom
+ 1, "eserved"))
930 return TOKEN_RESERVED
;
931 if (!strcasecmp (atom
+ 1, "emove"))
933 if (!strcasecmp (atom
+ 1, "efresh"))
937 if (!strcasecmp (atom
+ 1, "tate"))
939 if (!strcasecmp (atom
+ 1, "ecret"))
941 if (!strcasecmp (atom
+ 1, "ervfail"))
943 if (!strcasecmp (atom
+ 1, "witch"))
945 if (!strcasecmp (atom
+ 1, "igned"))
947 if (!strcasecmp (atom
+ 1, "tring"))
949 if (!strcasecmp (atom
+ 1, "uffix"))
951 if (!strcasecmp (atom
+ 1, "earch"))
953 if (!strcasecmp (atom
+ 1, "tarts"))
955 if (!strcasecmp (atom
+ 1, "iaddr"))
957 if (!strcasecmp (atom
+ 1, "hared-network"))
958 return SHARED_NETWORK
;
959 if (!strcasecmp (atom
+ 1, "econdary"))
961 if (!strcasecmp (atom
+ 1, "erver-name"))
963 if (!strcasecmp (atom
+ 1, "erver-identifier"))
964 return SERVER_IDENTIFIER
;
965 if (!strcasecmp (atom
+ 1, "erver"))
967 if (!strcasecmp (atom
+ 1, "elect-timeout"))
968 return SELECT_TIMEOUT
;
969 if (!strcasecmp (atom
+ 1, "elect"))
971 if (!strcasecmp (atom
+ 1, "end"))
973 if (!strcasecmp (atom
+ 1, "cript"))
975 if (!strcasecmp (atom
+ 1, "upersede"))
977 if (!strncasecmp (atom
+ 1, "ub", 2)) {
978 if (!strcasecmp (atom
+ 3, "string"))
980 if (!strcasecmp (atom
+ 3, "net"))
982 if (!strcasecmp (atom
+ 3, "class"))
986 if (!strcasecmp (atom
+ 1, "pawn"))
988 if (!strcasecmp (atom
+ 1, "pace"))
990 if (!strcasecmp (atom
+ 1, "tatic"))
992 if (!strcasecmp (atom
+ 1, "plit"))
994 if (!strcasecmp (atom
+ 1, "et"))
996 if (!strcasecmp (atom
+ 1, "econds"))
998 if (!strcasecmp (atom
+ 1, "hutdown"))
1000 if (!strcasecmp (atom
+ 1, "tartup"))
1004 if (!strcasecmp (atom
+ 1, "imestamp"))
1006 if (!strcasecmp (atom
+ 1, "imeout"))
1008 if (!strcasecmp (atom
+ 1, "oken-ring"))
1010 if (!strcasecmp (atom
+ 1, "ext"))
1012 if (!strcasecmp (atom
+ 1, "stp"))
1014 if (!strcasecmp (atom
+ 1, "sfp"))
1016 if (!strcasecmp (atom
+ 1, "ransmission"))
1017 return TRANSMISSION
;
1020 if (!strcasecmp (atom
+ 1, "nset"))
1022 if (!strcasecmp (atom
+ 1, "nsigned"))
1024 if (!strcasecmp (atom
+ 1, "id"))
1026 if (!strncasecmp (atom
+ 1, "se", 2)) {
1027 if (!strcasecmp (atom
+ 3, "r-class"))
1029 if (!strcasecmp (atom
+ 3, "-host-decl-names"))
1030 return USE_HOST_DECL_NAMES
;
1031 if (!strcasecmp (atom
+ 3,
1032 "-lease-addr-for-default-route"))
1033 return USE_LEASE_ADDR_FOR_DEFAULT_ROUTE
;
1036 if (!strncasecmp (atom
+ 1, "nknown", 6)) {
1037 if (!strcasecmp (atom
+ 7, "-clients"))
1038 return UNKNOWN_CLIENTS
;
1039 if (!strcasecmp (atom
+ 7, "-state"))
1040 return UNKNOWN_STATE
;
1045 if (!strcasecmp (atom
+ 1, "nauthenticated"))
1046 return AUTHENTICATED
;
1047 if (!strcasecmp (atom
+ 1, "pdated-dns-rr"))
1048 return UPDATED_DNS_RR
;
1049 if (!strcasecmp (atom
+ 1, "pdate"))
1053 if (!strcasecmp (atom
+ 1, "endor-class"))
1054 return VENDOR_CLASS
;
1055 if (!strcasecmp (atom
+ 1, "endor"))
1059 if (!strcasecmp (atom
+ 1, "ith"))
1063 if (!strcasecmp (atom
+ 1, "iaddr"))
1065 if (!strcasecmp (atom
+ 1, "xdomain"))
1067 if (!strcasecmp (atom
+ 1, "xrrset"))
1071 if (!strcasecmp (atom
+ 1, "one"))