3 Lexical scanner for dhcpd config file... */
6 * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1995-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
36 static char copyright
[] =
37 "$Id$ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
43 static int get_char
PROTO ((struct parse
*));
44 static enum dhcp_token get_token
PROTO ((struct parse
*));
45 static void skip_to_eol
PROTO ((struct parse
*));
46 static enum dhcp_token read_string
PROTO ((struct parse
*));
47 static enum dhcp_token read_number
PROTO ((int, struct parse
*));
48 static enum dhcp_token read_num_or_name
PROTO ((int, struct parse
*));
49 static enum dhcp_token intern
PROTO ((char *, enum dhcp_token
));
51 isc_result_t
new_parse (cfile
, file
, inbuf
, buflen
, name
, eolp
)
61 tmp
= dmalloc (sizeof (struct parse
), MDL
);
63 return ISC_R_NOMEMORY
;
64 memset (tmp
, 0, sizeof *tmp
);
68 tmp
-> lpos
= tmp
-> line
= 1;
69 tmp
-> cur_line
= tmp
-> line1
;
70 tmp
-> prev_line
= tmp
-> line2
;
71 tmp
-> token_line
= tmp
-> cur_line
;
72 tmp
-> cur_line
[0] = tmp
-> prev_line
[0] = 0;
73 tmp
-> warnings_occurred
= 0;
75 tmp
-> eol_token
= eolp
;
78 tmp
-> buflen
= buflen
;
83 tmp
-> inbuf
= dmalloc (8192, MDL
);
86 return ISC_R_NOMEMORY
;
95 isc_result_t
end_parse (cfile
)
98 if ((*cfile
) -> bufsiz
)
99 dfree ((*cfile
) -> inbuf
, MDL
);
101 *cfile
= (struct parse
*)0;
102 return ISC_R_SUCCESS
;
105 static int get_char (cfile
)
108 /* My kingdom for WITH... */
111 if (cfile
-> bufix
== cfile
-> buflen
) {
112 if (cfile
-> file
!= -1) {
115 cfile
-> inbuf
, cfile
-> bufsiz
);
116 if (cfile
-> buflen
== 0) {
119 } else if (cfile
-> buflen
< 0) {
121 cfile
-> bufix
= cfile
-> buflen
= 0;
123 c
= cfile
-> inbuf
[0];
129 c
= cfile
-> inbuf
[cfile
-> bufix
];
133 if (!cfile
-> ugflag
) {
135 if (cfile
-> cur_line
== cfile
-> line1
) {
136 cfile
-> cur_line
= cfile
-> line2
;
137 cfile
-> prev_line
= cfile
-> line1
;
139 cfile
-> cur_line
= cfile
-> line1
;
140 cfile
-> prev_line
= cfile
-> line2
;
144 cfile
-> cur_line
[0] = 0;
145 } else if (c
!= EOF
) {
146 if (cfile
-> lpos
<= 80) {
147 cfile
-> cur_line
[cfile
-> lpos
- 1] = c
;
148 cfile
-> cur_line
[cfile
-> lpos
] = 0;
157 static enum dhcp_token
get_token (cfile
)
161 enum dhcp_token ttok
;
170 c
= get_char (cfile
);
172 if (c
== '\n' && p
== 1 && !u
173 && cfile
-> comment_index
< sizeof cfile
-> comments
)
174 cfile
-> comments
[cfile
-> comment_index
++] = '\n';
177 if (!(c
== '\n' && cfile
-> eol_token
)
178 && isascii (c
) && isspace (c
))
182 if (cfile
-> comment_index
< sizeof cfile
-> comments
)
183 cfile
-> comments
[cfile
-> comment_index
++] = '#';
189 cfile
-> lexline
= l
;
190 cfile
-> lexchar
= p
;
191 ttok
= read_string (cfile
);
194 if ((isascii (c
) && isdigit (c
)) || c
== '-') {
195 cfile
-> lexline
= l
;
196 cfile
-> lexchar
= p
;
197 ttok
= read_number (c
, cfile
);
199 } else if (isascii (c
) && isalpha (c
)) {
200 cfile
-> lexline
= l
;
201 cfile
-> lexchar
= p
;
202 ttok
= read_num_or_name (c
, cfile
);
204 } else if (c
== EOF
) {
209 cfile
-> lexline
= l
;
210 cfile
-> lexchar
= p
;
222 enum dhcp_token
next_token (rval
, rlen
, cfile
)
229 if (cfile
-> token
) {
230 if (cfile
-> lexline
!= cfile
-> tline
)
231 cfile
-> token_line
= cfile
-> cur_line
;
232 cfile
-> lexchar
= cfile
-> tlpos
;
233 cfile
-> lexline
= cfile
-> tline
;
237 rv
= get_token (cfile
);
238 cfile
-> token_line
= cfile
-> cur_line
;
241 *rval
= cfile
-> tval
;
243 *rlen
= cfile
-> tlen
;
245 fprintf (stderr
, "%s:%d ", cfile
-> tval
, rv
);
250 enum dhcp_token
peek_token (rval
, rlen
, cfile
)
257 if (!cfile
-> token
) {
258 cfile
-> tlpos
= cfile
-> lexchar
;
259 cfile
-> tline
= cfile
-> lexline
;
260 cfile
-> token
= get_token (cfile
);
261 if (cfile
-> lexline
!= cfile
-> tline
)
262 cfile
-> token_line
= cfile
-> prev_line
;
264 x
= cfile
-> lexchar
;
265 cfile
-> lexchar
= cfile
-> tlpos
;
268 x
= cfile
-> lexline
;
269 cfile
-> lexline
= cfile
-> tline
;
273 *rval
= cfile
-> tval
;
275 *rlen
= cfile
-> tlen
;
277 fprintf (stderr
, "(%s:%d) ", cfile
-> tval
, cfile
-> token
);
279 return cfile
-> token
;
282 static void skip_to_eol (cfile
)
287 c
= get_char (cfile
);
291 if (cfile
-> comment_index
< sizeof (cfile
-> comments
))
292 comments
[cfile
-> comment_index
++] = c
;
300 static enum dhcp_token
read_string (cfile
)
309 for (i
= 0; i
< sizeof cfile
-> tokbuf
; i
++) {
311 c
= get_char (cfile
);
313 parse_warn (cfile
, "eof in string constant");
319 cfile
-> tokbuf
[i
] = '\t';
322 cfile
-> tokbuf
[i
] = '\r';
325 cfile
-> tokbuf
[i
] = '\n';
328 cfile
-> tokbuf
[i
] = '\b';
344 cfile
-> tokbuf
[i
] = c
;
351 if (c
>= '0' && c
<= '9') {
352 value
= value
* 16 + (c
- '0');
353 } else if (c
>= 'a' && c
<= 'f') {
354 value
= value
* 16 + (c
- 'a' + 10);
355 } else if (c
>= 'A' && c
<= 'F') {
356 value
= value
* 16 + (c
- 'A' + 10);
359 "invalid hex digit: %x",
365 cfile
-> tokbuf
[i
] = value
;
370 if (c
>= '0' && c
<= '9') {
371 value
= value
* 8 + (c
- '0');
375 "invalid octal digit %x",
379 cfile
-> tokbuf
[i
] = 0;
383 cfile
-> tokbuf
[i
] = value
;
388 } else if (c
== '\\') {
394 cfile
-> tokbuf
[i
] = c
;
396 /* Normally, I'd feel guilty about this, but we're talking about
397 strings that'll fit in a DHCP packet here... */
398 if (i
== sizeof cfile
-> tokbuf
) {
400 "string constant larger than internal buffer");
403 cfile
-> tokbuf
[i
] = 0;
405 cfile
-> tval
= cfile
-> tokbuf
;
409 static enum dhcp_token
read_number (c
, cfile
)
419 cfile
-> tokbuf
[i
++] = c
;
420 for (; i
< sizeof cfile
-> tokbuf
; i
++) {
421 c
= get_char (cfile
);
424 /* Promote NUMBER -> NUMBER_OR_NAME -> NAME, never demote.
425 * Except in the case of '0x' syntax hex, which gets called
426 * a NAME at '0x', and returned to NUMBER_OR_NAME once it's
427 * verified to be at least 0xf or less.
429 switch(isascii(c
) ? token
: BREAK
) {
436 token
= NUMBER_OR_NAME
;
441 if((i
== 2) && isxdigit(c
) &&
442 (cfile
->tokbuf
[0] == '0') &&
443 ((cfile
->tokbuf
[1] == 'x') ||
444 (cfile
->tokbuf
[1] == 'X'))) {
445 token
= NUMBER_OR_NAME
;
447 } else if(((c
== '-') || (c
== '_') || isalnum(c
))) {
453 /* At this point c is either EOF or part of the next
454 * token. If not EOF, rewind the file one byte so
455 * the next token is read from there.
464 log_fatal("read_number():%s:%d: impossible case", MDL
);
466 #else /* OLD_LEXER */
467 if (!seenx
&& (c
== 'x') {
469 } else if (!isascii (c
) || !isxdigit (c
)) {
476 #endif /* OLD_LEXER */
478 cfile
-> tokbuf
[i
] = c
;
481 if (i
== sizeof cfile
-> tokbuf
) {
483 "numeric token larger than internal buffer");
488 cfile
-> tokbuf
[i
] = 0;
490 cfile
-> tval
= cfile
-> tokbuf
;
495 static enum dhcp_token
read_num_or_name (c
, cfile
)
500 enum dhcp_token rv
= NUMBER_OR_NAME
;
501 cfile
-> tokbuf
[i
++] = c
;
502 for (; i
< sizeof cfile
-> tokbuf
; i
++) {
503 c
= get_char (cfile
);
505 (c
!= '-' && c
!= '_' && !isalnum (c
))) {
514 cfile
-> tokbuf
[i
] = c
;
516 if (i
== sizeof cfile
-> tokbuf
) {
517 parse_warn (cfile
, "token larger than internal buffer");
520 cfile
-> tokbuf
[i
] = 0;
522 cfile
-> tval
= cfile
-> tokbuf
;
523 return intern (cfile
-> tval
, rv
);
526 static enum dhcp_token
intern (atom
, dfv
)
530 if (!isascii (atom
[0]))
533 switch (tolower (atom
[0])) {
540 if (!strncasecmp (atom
+ 1, "uth", 3)) {
541 if (!strncasecmp (atom
+ 3, "uthenticat", 10)) {
542 if (!strcasecmp (atom
+ 13, "ed"))
543 return AUTHENTICATED
;
544 if (!strcasecmp (atom
+ 13, "ion"))
545 return AUTHENTICATION
;
548 if (!strcasecmp (atom
+ 1, "uthoritative"))
549 return AUTHORITATIVE
;
552 if (!strcasecmp (atom
+ 1, "nd"))
554 if (!strcasecmp (atom
+ 1, "ppend"))
556 if (!strcasecmp (atom
+ 1, "llow"))
558 if (!strcasecmp (atom
+ 1, "lias"))
560 if (!strcasecmp (atom
+ 1, "lgorithm"))
562 if (!strcasecmp (atom
+ 1, "bandoned"))
563 return TOKEN_ABANDONED
;
564 if (!strcasecmp (atom
+ 1, "dd"))
566 if (!strcasecmp (atom
+ 1, "ll"))
568 if (!strcasecmp (atom
+ 1, "t"))
570 if (!strcasecmp (atom
+ 1, "rray"))
572 if (!strcasecmp (atom
+ 1, "ddress"))
574 if (!strcasecmp (atom
+ 1, "ctive"))
578 if (!strcasecmp (atom
+ 1, "ackup"))
580 if (!strcasecmp (atom
+ 1, "ootp"))
582 if (!strcasecmp (atom
+ 1, "inding"))
584 if (!strcasecmp (atom
+ 1, "inary-to-ascii"))
585 return BINARY_TO_ASCII
;
586 if (!strcasecmp (atom
+ 1, "ackoff-cutoff"))
587 return BACKOFF_CUTOFF
;
588 if (!strcasecmp (atom
+ 1, "ooting"))
590 if (!strcasecmp (atom
+ 1, "oot-unknown-clients"))
591 return BOOT_UNKNOWN_CLIENTS
;
592 if (!strcasecmp (atom
+ 1, "reak"))
594 if (!strcasecmp (atom
+ 1, "illing"))
596 if (!strcasecmp (atom
+ 1, "oolean"))
598 if (!strcasecmp (atom
+ 1, "alance"))
600 if (!strcasecmp (atom
+ 1, "ound"))
604 if (!strcasecmp (atom
+ 1, "ase"))
606 if (!strcasecmp (atom
+ 1, "ommit"))
608 if (!strcasecmp (atom
+ 1, "ode"))
610 if (!strcasecmp (atom
+ 1, "onfig-option"))
611 return CONFIG_OPTION
;
612 if (!strcasecmp (atom
+ 1, "heck"))
614 if (!strcasecmp (atom
+ 1, "lass"))
616 if (!strcasecmp (atom
+ 1, "lose"))
618 if (!strcasecmp (atom
+ 1, "reate"))
620 if (!strcasecmp (atom
+ 1, "iaddr"))
622 if (!strncasecmp (atom
+ 1, "lient", 5)) {
623 if (!strcasecmp (atom
+ 6, "-identifier"))
624 return CLIENT_IDENTIFIER
;
625 if (!strcasecmp (atom
+ 6, "-hostname"))
626 return CLIENT_HOSTNAME
;
627 if (!strcasecmp (atom
+ 6, "-state"))
629 if (!strcasecmp (atom
+ 6, "-updates"))
630 return CLIENT_UPDATES
;
631 if (!strcasecmp (atom
+ 6, "s"))
634 if (!strcasecmp (atom
+ 1, "oncat"))
636 if (!strcasecmp (atom
+ 1, "onnect"))
638 if (!strcasecmp (atom
+ 1, "ommunications-interrupted"))
639 return COMMUNICATIONS_INTERRUPTED
;
640 if (!strcasecmp (atom
+ 1, "ltt"))
644 if (!strcasecmp (atom
+ 1, "ns-update"))
646 if (!strcasecmp (atom
+ 1, "ns-delete"))
648 if (!strcasecmp (atom
+ 1, "omain"))
650 if (!strcasecmp (atom
+ 1, "omain-name"))
652 if (!strcasecmp (atom
+ 1, "o-forward-update"))
653 return DO_FORWARD_UPDATE
;
654 if (!strcasecmp (atom
+ 1, "ebug"))
656 if (!strcasecmp (atom
+ 1, "eny"))
658 if (!strcasecmp (atom
+ 1, "eleted"))
659 return TOKEN_DELETED
;
660 if (!strcasecmp (atom
+ 1, "elete"))
662 if (!strncasecmp (atom
+ 1, "efault", 6)) {
665 if (!strcasecmp (atom
+ 7, "-lease-time"))
666 return DEFAULT_LEASE_TIME
;
669 if (!strncasecmp (atom
+ 1, "ynamic", 6)) {
672 if (!strncasecmp (atom
+ 7, "-bootp", 6)) {
674 return DYNAMIC_BOOTP
;
675 if (!strcasecmp (atom
+ 13, "-lease-cutoff"))
676 return DYNAMIC_BOOTP_LEASE_CUTOFF
;
677 if (!strcasecmp (atom
+ 13, "-lease-length"))
678 return DYNAMIC_BOOTP_LEASE_LENGTH
;
682 if (!strcasecmp (atom
+ 1, "uplicates"))
684 if (!strcasecmp (atom
+ 1, "eclines"))
686 if (!strncasecmp (atom
+ 1, "efine", 5)) {
687 if (!strcasecmp (atom
+ 6, "d"))
694 if (isascii (atom
[1]) && tolower (atom
[1]) == 'x') {
695 if (!strcasecmp (atom
+ 2, "tract-int"))
697 if (!strcasecmp (atom
+ 2, "ists"))
699 if (!strcasecmp (atom
+ 2, "piry"))
701 if (!strcasecmp (atom
+ 2, "pire"))
703 if (!strcasecmp (atom
+ 2, "pired"))
704 return TOKEN_EXPIRED
;
706 if (!strcasecmp (atom
+ 1, "ncode-int"))
708 if (!strcasecmp (atom
+ 1, "thernet"))
710 if (!strcasecmp (atom
+ 1, "nds"))
712 if (!strncasecmp (atom
+ 1, "ls", 2)) {
713 if (!strcasecmp (atom
+ 3, "e"))
715 if (!strcasecmp (atom
+ 3, "if"))
719 if (!strcasecmp (atom
+ 1, "rror"))
721 if (!strcasecmp (atom
+ 1, "val"))
723 if (!strcasecmp (atom
+ 1, "ncapsulate"))
727 if (!strcasecmp (atom
+ 1, "atal"))
729 if (!strcasecmp (atom
+ 1, "ilename"))
731 if (!strcasecmp (atom
+ 1, "ixed-address"))
733 if (!strcasecmp (atom
+ 1, "ddi"))
735 if (!strcasecmp (atom
+ 1, "ormerr"))
737 if (!strcasecmp (atom
+ 1, "unction"))
739 if (!strcasecmp (atom
+ 1, "ailover"))
741 if (!strcasecmp (atom
+ 1, "ree"))
745 if (!strcasecmp (atom
+ 1, "iaddr"))
747 if (!strcasecmp (atom
+ 1, "roup"))
749 if (!strcasecmp (atom
+ 1, "et-lease-hostnames"))
750 return GET_LEASE_HOSTNAMES
;
753 if (!strcasecmp (atom
+ 1, "ba"))
755 if (!strcasecmp (atom
+ 1, "ost"))
757 if (!strcasecmp (atom
+ 1, "ost-decl-name"))
758 return HOST_DECL_NAME
;
759 if (!strcasecmp (atom
+ 1, "ardware"))
761 if (!strcasecmp (atom
+ 1, "ostname"))
763 if (!strcasecmp (atom
+ 1, "elp"))
767 if (!strcasecmp (atom
+ 1, "nclude"))
769 if (!strcasecmp (atom
+ 1, "nteger"))
771 if (!strcasecmp (atom
+ 1, "nfinite"))
773 if (!strcasecmp (atom
+ 1, "nfo"))
775 if (!strcasecmp (atom
+ 1, "p-address"))
777 if (!strcasecmp (atom
+ 1, "nitial-interval"))
778 return INITIAL_INTERVAL
;
779 if (!strcasecmp (atom
+ 1, "nterface"))
781 if (!strcasecmp (atom
+ 1, "dentifier"))
783 if (!strcasecmp (atom
+ 1, "f"))
785 if (!strcasecmp (atom
+ 1, "s"))
787 if (!strcasecmp (atom
+ 1, "gnore"))
791 if (!strncasecmp (atom
+ 1, "nown", 4)) {
792 if (!strcasecmp (atom
+ 5, "-clients"))
793 return KNOWN_CLIENTS
;
798 if (!strcasecmp (atom
+ 1, "ey"))
802 if (!strcasecmp (atom
+ 1, "ease"))
804 if (!strcasecmp (atom
+ 1, "eased-address"))
805 return LEASED_ADDRESS
;
806 if (!strcasecmp (atom
+ 1, "ease-time"))
808 if (!strcasecmp (atom
+ 1, "imit"))
810 if (!strcasecmp (atom
+ 1, "et"))
812 if (!strcasecmp (atom
+ 1, "oad"))
814 if (!strcasecmp (atom
+ 1, "og"))
818 if (!strncasecmp (atom
+ 1, "ax", 2)) {
821 if (!strcasecmp (atom
+ 3, "-lease-time"))
822 return MAX_LEASE_TIME
;
823 if (!strcasecmp (atom
+ 3, "-transmit-idle"))
824 return MAX_TRANSMIT_IDLE
;
825 if (!strcasecmp (atom
+ 3, "-response-delay"))
826 return MAX_RESPONSE_DELAY
;
827 if (!strcasecmp (atom
+ 3, "-unacked-updates"))
828 return MAX_UNACKED_UPDATES
;
830 if (!strncasecmp (atom
+ 1, "in-", 3)) {
831 if (!strcasecmp (atom
+ 4, "lease-time"))
832 return MIN_LEASE_TIME
;
833 if (!strcasecmp (atom
+ 4, "secs"))
837 if (!strncasecmp (atom
+ 1, "edi", 3)) {
838 if (!strcasecmp (atom
+ 4, "a"))
840 if (!strcasecmp (atom
+ 4, "um"))
844 if (!strcasecmp (atom
+ 1, "atch"))
846 if (!strcasecmp (atom
+ 1, "embers"))
848 if (!strcasecmp (atom
+ 1, "y"))
850 if (!strcasecmp (atom
+ 1, "clt"))
854 if (!strcasecmp (atom
+ 1, "ormal"))
856 if (!strcasecmp (atom
+ 1, "ameserver"))
858 if (!strcasecmp (atom
+ 1, "etmask"))
860 if (!strcasecmp (atom
+ 1, "ever"))
862 if (!strcasecmp (atom
+ 1, "ext-server"))
864 if (!strcasecmp (atom
+ 1, "ot"))
866 if (!strcasecmp (atom
+ 1, "o"))
868 if (!strcasecmp (atom
+ 1, "s-update"))
870 if (!strcasecmp (atom
+ 1, "oerror"))
872 if (!strcasecmp (atom
+ 1, "otauth"))
874 if (!strcasecmp (atom
+ 1, "otimp"))
876 if (!strcasecmp (atom
+ 1, "otzone"))
878 if (!strcasecmp (atom
+ 1, "xdomain"))
880 if (!strcasecmp (atom
+ 1, "xrrset"))
882 if (!strcasecmp (atom
+ 1, "ull"))
884 if (!strcasecmp (atom
+ 1, "ext"))
886 if (!strcasecmp (atom
+ 1, "ew"))
890 if (!strcasecmp (atom
+ 1, "mapi"))
892 if (!strcasecmp (atom
+ 1, "r"))
894 if (!strcasecmp (atom
+ 1, "n"))
896 if (!strcasecmp (atom
+ 1, "pen"))
898 if (!strcasecmp (atom
+ 1, "ption"))
900 if (!strcasecmp (atom
+ 1, "ne-lease-per-client"))
901 return ONE_LEASE_PER_CLIENT
;
902 if (!strcasecmp (atom
+ 1, "f"))
904 if (!strcasecmp (atom
+ 1, "wner"))
908 if (!strcasecmp (atom
+ 1, "repend"))
910 if (!strcasecmp (atom
+ 1, "acket"))
912 if (!strcasecmp (atom
+ 1, "ool"))
914 if (!strcasecmp (atom
+ 1, "seudo"))
916 if (!strcasecmp (atom
+ 1, "eer"))
918 if (!strcasecmp (atom
+ 1, "rimary"))
920 if (!strncasecmp (atom
+ 1, "artner", 6)) {
923 if (!strcasecmp (atom
+ 7, "-down"))
926 if (!strcasecmp (atom
+ 1, "ort"))
928 if (!strcasecmp (atom
+ 1, "otential-conflict"))
929 return POTENTIAL_CONFLICT
;
930 if (!strcasecmp (atom
+ 1, "ick-first-value") ||
931 !strcasecmp (atom
+ 1, "ick"))
933 if (!strcasecmp (atom
+ 1, "aused"))
937 if (!strcasecmp (atom
+ 1, "esolution-interrupted"))
938 return RESOLUTION_INTERRUPTED
;
939 if (!strcasecmp (atom
+ 1, "ange"))
941 if (!strcasecmp (atom
+ 1, "ecover"))
943 if (!strcasecmp (atom
+ 1, "ecover-done"))
945 if (!strcasecmp (atom
+ 1, "ecover-wait"))
947 if (!strcasecmp (atom
+ 1, "econtact-interval"))
948 return RECONTACT_INTERVAL
;
949 if (!strcasecmp (atom
+ 1, "equest"))
951 if (!strcasecmp (atom
+ 1, "equire"))
953 if (!strcasecmp (atom
+ 1, "equire"))
955 if (!strcasecmp (atom
+ 1, "etry"))
957 if (!strcasecmp (atom
+ 1, "eturn"))
959 if (!strcasecmp (atom
+ 1, "enew"))
961 if (!strcasecmp (atom
+ 1, "ebind"))
963 if (!strcasecmp (atom
+ 1, "eboot"))
965 if (!strcasecmp (atom
+ 1, "eject"))
967 if (!strcasecmp (atom
+ 1, "everse"))
969 if (!strcasecmp (atom
+ 1, "elease"))
971 if (!strcasecmp (atom
+ 1, "efused"))
973 if (!strcasecmp (atom
+ 1, "eleased"))
974 return TOKEN_RELEASED
;
975 if (!strcasecmp (atom
+ 1, "eset"))
977 if (!strcasecmp (atom
+ 1, "eserved"))
978 return TOKEN_RESERVED
;
979 if (!strcasecmp (atom
+ 1, "emove"))
981 if (!strcasecmp (atom
+ 1, "efresh"))
985 if (!strcasecmp (atom
+ 1, "tate"))
987 if (!strcasecmp (atom
+ 1, "ecret"))
989 if (!strcasecmp (atom
+ 1, "ervfail"))
991 if (!strcasecmp (atom
+ 1, "witch"))
993 if (!strcasecmp (atom
+ 1, "igned"))
995 if (!strcasecmp (atom
+ 1, "tring"))
997 if (!strcasecmp (atom
+ 1, "uffix"))
999 if (!strcasecmp (atom
+ 1, "earch"))
1001 if (!strcasecmp (atom
+ 1, "tarts"))
1003 if (!strcasecmp (atom
+ 1, "iaddr"))
1005 if (!strcasecmp (atom
+ 1, "hared-network"))
1006 return SHARED_NETWORK
;
1007 if (!strcasecmp (atom
+ 1, "econdary"))
1009 if (!strcasecmp (atom
+ 1, "erver-name"))
1011 if (!strcasecmp (atom
+ 1, "erver-identifier"))
1012 return SERVER_IDENTIFIER
;
1013 if (!strcasecmp (atom
+ 1, "erver"))
1015 if (!strcasecmp (atom
+ 1, "elect-timeout"))
1016 return SELECT_TIMEOUT
;
1017 if (!strcasecmp (atom
+ 1, "elect"))
1019 if (!strcasecmp (atom
+ 1, "end"))
1021 if (!strcasecmp (atom
+ 1, "cript"))
1023 if (!strcasecmp (atom
+ 1, "upersede"))
1025 if (!strncasecmp (atom
+ 1, "ub", 2)) {
1026 if (!strcasecmp (atom
+ 3, "string"))
1028 if (!strcasecmp (atom
+ 3, "net"))
1030 if (!strcasecmp (atom
+ 3, "class"))
1034 if (!strcasecmp (atom
+ 1, "pawn"))
1036 if (!strcasecmp (atom
+ 1, "pace"))
1038 if (!strcasecmp (atom
+ 1, "tatic"))
1040 if (!strcasecmp (atom
+ 1, "plit"))
1042 if (!strcasecmp (atom
+ 1, "et"))
1044 if (!strcasecmp (atom
+ 1, "econds"))
1046 if (!strcasecmp (atom
+ 1, "hutdown"))
1048 if (!strcasecmp (atom
+ 1, "tartup"))
1052 if (!strcasecmp (atom
+ 1, "imestamp"))
1054 if (!strcasecmp (atom
+ 1, "imeout"))
1056 if (!strcasecmp (atom
+ 1, "oken-ring"))
1058 if (!strcasecmp (atom
+ 1, "ext"))
1060 if (!strcasecmp (atom
+ 1, "stp"))
1062 if (!strcasecmp (atom
+ 1, "sfp"))
1064 if (!strcasecmp (atom
+ 1, "ransmission"))
1065 return TRANSMISSION
;
1068 if (!strcasecmp (atom
+ 1, "nset"))
1070 if (!strcasecmp (atom
+ 1, "nsigned"))
1072 if (!strcasecmp (atom
+ 1, "id"))
1074 if (!strncasecmp (atom
+ 1, "se", 2)) {
1075 if (!strcasecmp (atom
+ 3, "r-class"))
1077 if (!strcasecmp (atom
+ 3, "-host-decl-names"))
1078 return USE_HOST_DECL_NAMES
;
1079 if (!strcasecmp (atom
+ 3,
1080 "-lease-addr-for-default-route"))
1081 return USE_LEASE_ADDR_FOR_DEFAULT_ROUTE
;
1084 if (!strncasecmp (atom
+ 1, "nknown", 6)) {
1085 if (!strcasecmp (atom
+ 7, "-clients"))
1086 return UNKNOWN_CLIENTS
;
1087 if (!strcasecmp (atom
+ 7, "-state"))
1088 return UNKNOWN_STATE
;
1093 if (!strcasecmp (atom
+ 1, "nauthenticated"))
1094 return AUTHENTICATED
;
1095 if (!strcasecmp (atom
+ 1, "pdated-dns-rr"))
1096 return UPDATED_DNS_RR
;
1097 if (!strcasecmp (atom
+ 1, "pdate"))
1101 if (!strcasecmp (atom
+ 1, "endor-class"))
1102 return VENDOR_CLASS
;
1103 if (!strcasecmp (atom
+ 1, "endor"))
1107 if (!strcasecmp (atom
+ 1, "ith"))
1111 if (!strcasecmp (atom
+ 1, "iaddr"))
1113 if (!strcasecmp (atom
+ 1, "xdomain"))
1115 if (!strcasecmp (atom
+ 1, "xrrset"))
1119 if (!strcasecmp (atom
+ 1, "one"))