3 Lexical scanner for dhcpd config file... */
6 * Copyright (c) 2004 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: conflex.c,v 1.92.2.9 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 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
)
417 cfile
-> tokbuf
[i
++] = c
;
418 for (; i
< sizeof cfile
-> tokbuf
; i
++) {
419 c
= get_char (cfile
);
420 if (!seenx
&& c
== 'x') {
423 } else if (isascii (c
) && !isxdigit (c
) &&
424 (c
== '-' || c
== '_' || isalpha (c
))) {
426 } else if (isascii (c
) && !isdigit (c
) && isxdigit (c
)) {
427 token
= NUMBER_OR_NAME
;
429 } else if (!isascii (c
) || !isxdigit (c
)) {
436 cfile
-> tokbuf
[i
] = c
;
438 if (i
== sizeof cfile
-> tokbuf
) {
440 "numeric token larger than internal buffer");
443 cfile
-> tokbuf
[i
] = 0;
445 cfile
-> tval
= cfile
-> tokbuf
;
449 static enum dhcp_token
read_num_or_name (c
, cfile
)
454 enum dhcp_token rv
= NUMBER_OR_NAME
;
455 cfile
-> tokbuf
[i
++] = c
;
456 for (; i
< sizeof cfile
-> tokbuf
; i
++) {
457 c
= get_char (cfile
);
459 (c
!= '-' && c
!= '_' && !isalnum (c
))) {
468 cfile
-> tokbuf
[i
] = c
;
470 if (i
== sizeof cfile
-> tokbuf
) {
471 parse_warn (cfile
, "token larger than internal buffer");
474 cfile
-> tokbuf
[i
] = 0;
476 cfile
-> tval
= cfile
-> tokbuf
;
477 return intern (cfile
-> tval
, rv
);
480 static enum dhcp_token
intern (atom
, dfv
)
484 if (!isascii (atom
[0]))
487 switch (tolower (atom
[0])) {
494 if (!strncasecmp (atom
+ 1, "uth", 3)) {
495 if (!strncasecmp (atom
+ 3, "uthenticat", 10)) {
496 if (!strcasecmp (atom
+ 13, "ed"))
497 return AUTHENTICATED
;
498 if (!strcasecmp (atom
+ 13, "ion"))
499 return AUTHENTICATION
;
502 if (!strcasecmp (atom
+ 1, "uthoritative"))
503 return AUTHORITATIVE
;
506 if (!strcasecmp (atom
+ 1, "nd"))
508 if (!strcasecmp (atom
+ 1, "ppend"))
510 if (!strcasecmp (atom
+ 1, "llow"))
512 if (!strcasecmp (atom
+ 1, "lias"))
514 if (!strcasecmp (atom
+ 1, "lgorithm"))
516 if (!strcasecmp (atom
+ 1, "bandoned"))
517 return TOKEN_ABANDONED
;
518 if (!strcasecmp (atom
+ 1, "dd"))
520 if (!strcasecmp (atom
+ 1, "ll"))
522 if (!strcasecmp (atom
+ 1, "t"))
524 if (!strcasecmp (atom
+ 1, "rray"))
526 if (!strcasecmp (atom
+ 1, "ddress"))
528 if (!strcasecmp (atom
+ 1, "ctive"))
532 if (!strcasecmp (atom
+ 1, "ackup"))
534 if (!strcasecmp (atom
+ 1, "ootp"))
536 if (!strcasecmp (atom
+ 1, "inding"))
538 if (!strcasecmp (atom
+ 1, "inary-to-ascii"))
539 return BINARY_TO_ASCII
;
540 if (!strcasecmp (atom
+ 1, "ackoff-cutoff"))
541 return BACKOFF_CUTOFF
;
542 if (!strcasecmp (atom
+ 1, "ooting"))
544 if (!strcasecmp (atom
+ 1, "oot-unknown-clients"))
545 return BOOT_UNKNOWN_CLIENTS
;
546 if (!strcasecmp (atom
+ 1, "reak"))
548 if (!strcasecmp (atom
+ 1, "illing"))
550 if (!strcasecmp (atom
+ 1, "oolean"))
552 if (!strcasecmp (atom
+ 1, "alance"))
554 if (!strcasecmp (atom
+ 1, "ound"))
558 if (!strcasecmp (atom
+ 1, "ase"))
560 if (!strcasecmp (atom
+ 1, "ommit"))
562 if (!strcasecmp (atom
+ 1, "ode"))
564 if (!strcasecmp (atom
+ 1, "onfig-option"))
565 return CONFIG_OPTION
;
566 if (!strcasecmp (atom
+ 1, "heck"))
568 if (!strcasecmp (atom
+ 1, "lass"))
570 if (!strcasecmp (atom
+ 1, "lose"))
572 if (!strcasecmp (atom
+ 1, "reate"))
574 if (!strcasecmp (atom
+ 1, "iaddr"))
576 if (!strncasecmp (atom
+ 1, "lient", 5)) {
577 if (!strcasecmp (atom
+ 6, "-identifier"))
578 return CLIENT_IDENTIFIER
;
579 if (!strcasecmp (atom
+ 6, "-hostname"))
580 return CLIENT_HOSTNAME
;
581 if (!strcasecmp (atom
+ 6, "-state"))
583 if (!strcasecmp (atom
+ 6, "-updates"))
584 return CLIENT_UPDATES
;
585 if (!strcasecmp (atom
+ 6, "s"))
588 if (!strcasecmp (atom
+ 1, "oncat"))
590 if (!strcasecmp (atom
+ 1, "onnect"))
592 if (!strcasecmp (atom
+ 1, "ommunications-interrupted"))
593 return COMMUNICATIONS_INTERRUPTED
;
594 if (!strcasecmp (atom
+ 1, "ltt"))
598 if (!strcasecmp (atom
+ 1, "ns-update"))
600 if (!strcasecmp (atom
+ 1, "ns-delete"))
602 if (!strcasecmp (atom
+ 1, "omain"))
604 if (!strcasecmp (atom
+ 1, "omain-name"))
606 if (!strcasecmp (atom
+ 1, "o-forward-update"))
607 return DO_FORWARD_UPDATE
;
608 if (!strcasecmp (atom
+ 1, "ebug"))
610 if (!strcasecmp (atom
+ 1, "eny"))
612 if (!strcasecmp (atom
+ 1, "eleted"))
613 return TOKEN_DELETED
;
614 if (!strcasecmp (atom
+ 1, "elete"))
616 if (!strncasecmp (atom
+ 1, "efault", 6)) {
619 if (!strcasecmp (atom
+ 7, "-lease-time"))
620 return DEFAULT_LEASE_TIME
;
623 if (!strncasecmp (atom
+ 1, "ynamic", 6)) {
626 if (!strncasecmp (atom
+ 7, "-bootp", 6)) {
628 return DYNAMIC_BOOTP
;
629 if (!strcasecmp (atom
+ 13, "-lease-cutoff"))
630 return DYNAMIC_BOOTP_LEASE_CUTOFF
;
631 if (!strcasecmp (atom
+ 13, "-lease-length"))
632 return DYNAMIC_BOOTP_LEASE_LENGTH
;
636 if (!strcasecmp (atom
+ 1, "uplicates"))
638 if (!strcasecmp (atom
+ 1, "eclines"))
640 if (!strncasecmp (atom
+ 1, "efine", 5)) {
641 if (!strcasecmp (atom
+ 6, "d"))
648 if (isascii (atom
[1]) && tolower (atom
[1]) == 'x') {
649 if (!strcasecmp (atom
+ 2, "tract-int"))
651 if (!strcasecmp (atom
+ 2, "ists"))
653 if (!strcasecmp (atom
+ 2, "piry"))
655 if (!strcasecmp (atom
+ 2, "pire"))
657 if (!strcasecmp (atom
+ 2, "pired"))
658 return TOKEN_EXPIRED
;
660 if (!strcasecmp (atom
+ 1, "ncode-int"))
662 if (!strcasecmp (atom
+ 1, "thernet"))
664 if (!strcasecmp (atom
+ 1, "nds"))
666 if (!strncasecmp (atom
+ 1, "ls", 2)) {
667 if (!strcasecmp (atom
+ 3, "e"))
669 if (!strcasecmp (atom
+ 3, "if"))
673 if (!strcasecmp (atom
+ 1, "rror"))
675 if (!strcasecmp (atom
+ 1, "val"))
677 if (!strcasecmp (atom
+ 1, "ncapsulate"))
681 if (!strcasecmp (atom
+ 1, "atal"))
683 if (!strcasecmp (atom
+ 1, "ilename"))
685 if (!strcasecmp (atom
+ 1, "ixed-address"))
687 if (!strcasecmp (atom
+ 1, "ddi"))
689 if (!strcasecmp (atom
+ 1, "ormerr"))
691 if (!strcasecmp (atom
+ 1, "unction"))
693 if (!strcasecmp (atom
+ 1, "ailover"))
695 if (!strcasecmp (atom
+ 1, "ree"))
699 if (!strcasecmp (atom
+ 1, "iaddr"))
701 if (!strcasecmp (atom
+ 1, "roup"))
703 if (!strcasecmp (atom
+ 1, "et-lease-hostnames"))
704 return GET_LEASE_HOSTNAMES
;
707 if (!strcasecmp (atom
+ 1, "ba"))
709 if (!strcasecmp (atom
+ 1, "ost"))
711 if (!strcasecmp (atom
+ 1, "ost-decl-name"))
712 return HOST_DECL_NAME
;
713 if (!strcasecmp (atom
+ 1, "ardware"))
715 if (!strcasecmp (atom
+ 1, "ostname"))
717 if (!strcasecmp (atom
+ 1, "elp"))
721 if (!strcasecmp (atom
+ 1, "nclude"))
723 if (!strcasecmp (atom
+ 1, "nteger"))
725 if (!strcasecmp (atom
+ 1, "nfinite"))
727 if (!strcasecmp (atom
+ 1, "nfo"))
729 if (!strcasecmp (atom
+ 1, "p-address"))
731 if (!strcasecmp (atom
+ 1, "nitial-interval"))
732 return INITIAL_INTERVAL
;
733 if (!strcasecmp (atom
+ 1, "nterface"))
735 if (!strcasecmp (atom
+ 1, "dentifier"))
737 if (!strcasecmp (atom
+ 1, "f"))
739 if (!strcasecmp (atom
+ 1, "s"))
741 if (!strcasecmp (atom
+ 1, "gnore"))
745 if (!strncasecmp (atom
+ 1, "nown", 4)) {
746 if (!strcasecmp (atom
+ 5, "-clients"))
747 return KNOWN_CLIENTS
;
752 if (!strcasecmp (atom
+ 1, "ey"))
756 if (!strcasecmp (atom
+ 1, "ease"))
758 if (!strcasecmp (atom
+ 1, "eased-address"))
759 return LEASED_ADDRESS
;
760 if (!strcasecmp (atom
+ 1, "ease-time"))
762 if (!strcasecmp (atom
+ 1, "imit"))
764 if (!strcasecmp (atom
+ 1, "et"))
766 if (!strcasecmp (atom
+ 1, "oad"))
768 if (!strcasecmp (atom
+ 1, "og"))
772 if (!strncasecmp (atom
+ 1, "ax", 2)) {
775 if (!strcasecmp (atom
+ 3, "-lease-time"))
776 return MAX_LEASE_TIME
;
777 if (!strcasecmp (atom
+ 3, "-transmit-idle"))
778 return MAX_TRANSMIT_IDLE
;
779 if (!strcasecmp (atom
+ 3, "-response-delay"))
780 return MAX_RESPONSE_DELAY
;
781 if (!strcasecmp (atom
+ 3, "-unacked-updates"))
782 return MAX_UNACKED_UPDATES
;
784 if (!strncasecmp (atom
+ 1, "in-", 3)) {
785 if (!strcasecmp (atom
+ 4, "lease-time"))
786 return MIN_LEASE_TIME
;
787 if (!strcasecmp (atom
+ 4, "secs"))
791 if (!strncasecmp (atom
+ 1, "edi", 3)) {
792 if (!strcasecmp (atom
+ 4, "a"))
794 if (!strcasecmp (atom
+ 4, "um"))
798 if (!strcasecmp (atom
+ 1, "atch"))
800 if (!strcasecmp (atom
+ 1, "embers"))
802 if (!strcasecmp (atom
+ 1, "y"))
804 if (!strcasecmp (atom
+ 1, "clt"))
808 if (!strcasecmp (atom
+ 1, "ormal"))
810 if (!strcasecmp (atom
+ 1, "ameserver"))
812 if (!strcasecmp (atom
+ 1, "etmask"))
814 if (!strcasecmp (atom
+ 1, "ever"))
816 if (!strcasecmp (atom
+ 1, "ext-server"))
818 if (!strcasecmp (atom
+ 1, "ot"))
820 if (!strcasecmp (atom
+ 1, "o"))
822 if (!strcasecmp (atom
+ 1, "s-update"))
824 if (!strcasecmp (atom
+ 1, "oerror"))
826 if (!strcasecmp (atom
+ 1, "otauth"))
828 if (!strcasecmp (atom
+ 1, "otimp"))
830 if (!strcasecmp (atom
+ 1, "otzone"))
832 if (!strcasecmp (atom
+ 1, "xdomain"))
834 if (!strcasecmp (atom
+ 1, "xrrset"))
836 if (!strcasecmp (atom
+ 1, "ull"))
838 if (!strcasecmp (atom
+ 1, "ext"))
840 if (!strcasecmp (atom
+ 1, "ew"))
844 if (!strcasecmp (atom
+ 1, "mapi"))
846 if (!strcasecmp (atom
+ 1, "r"))
848 if (!strcasecmp (atom
+ 1, "n"))
850 if (!strcasecmp (atom
+ 1, "pen"))
852 if (!strcasecmp (atom
+ 1, "ption"))
854 if (!strcasecmp (atom
+ 1, "ne-lease-per-client"))
855 return ONE_LEASE_PER_CLIENT
;
856 if (!strcasecmp (atom
+ 1, "f"))
858 if (!strcasecmp (atom
+ 1, "wner"))
862 if (!strcasecmp (atom
+ 1, "repend"))
864 if (!strcasecmp (atom
+ 1, "acket"))
866 if (!strcasecmp (atom
+ 1, "ool"))
868 if (!strcasecmp (atom
+ 1, "seudo"))
870 if (!strcasecmp (atom
+ 1, "eer"))
872 if (!strcasecmp (atom
+ 1, "rimary"))
874 if (!strncasecmp (atom
+ 1, "artner", 6)) {
877 if (!strcasecmp (atom
+ 7, "-down"))
880 if (!strcasecmp (atom
+ 1, "ort"))
882 if (!strcasecmp (atom
+ 1, "otential-conflict"))
883 return POTENTIAL_CONFLICT
;
884 if (!strcasecmp (atom
+ 1, "ick-first-value") ||
885 !strcasecmp (atom
+ 1, "ick"))
887 if (!strcasecmp (atom
+ 1, "aused"))
891 if (!strcasecmp (atom
+ 1, "esolution-interrupted"))
892 return RESOLUTION_INTERRUPTED
;
893 if (!strcasecmp (atom
+ 1, "ange"))
895 if (!strcasecmp (atom
+ 1, "ecover"))
897 if (!strcasecmp (atom
+ 1, "ecover-done"))
899 if (!strcasecmp (atom
+ 1, "ecover-wait"))
901 if (!strcasecmp (atom
+ 1, "econtact-interval"))
902 return RECONTACT_INTERVAL
;
903 if (!strcasecmp (atom
+ 1, "equest"))
905 if (!strcasecmp (atom
+ 1, "equire"))
907 if (!strcasecmp (atom
+ 1, "equire"))
909 if (!strcasecmp (atom
+ 1, "etry"))
911 if (!strcasecmp (atom
+ 1, "eturn"))
913 if (!strcasecmp (atom
+ 1, "enew"))
915 if (!strcasecmp (atom
+ 1, "ebind"))
917 if (!strcasecmp (atom
+ 1, "eboot"))
919 if (!strcasecmp (atom
+ 1, "eject"))
921 if (!strcasecmp (atom
+ 1, "everse"))
923 if (!strcasecmp (atom
+ 1, "elease"))
925 if (!strcasecmp (atom
+ 1, "efused"))
927 if (!strcasecmp (atom
+ 1, "eleased"))
928 return TOKEN_RELEASED
;
929 if (!strcasecmp (atom
+ 1, "eset"))
931 if (!strcasecmp (atom
+ 1, "eserved"))
932 return TOKEN_RESERVED
;
933 if (!strcasecmp (atom
+ 1, "emove"))
935 if (!strcasecmp (atom
+ 1, "efresh"))
939 if (!strcasecmp (atom
+ 1, "tate"))
941 if (!strcasecmp (atom
+ 1, "ecret"))
943 if (!strcasecmp (atom
+ 1, "ervfail"))
945 if (!strcasecmp (atom
+ 1, "witch"))
947 if (!strcasecmp (atom
+ 1, "igned"))
949 if (!strcasecmp (atom
+ 1, "tring"))
951 if (!strcasecmp (atom
+ 1, "uffix"))
953 if (!strcasecmp (atom
+ 1, "earch"))
955 if (!strcasecmp (atom
+ 1, "tarts"))
957 if (!strcasecmp (atom
+ 1, "iaddr"))
959 if (!strcasecmp (atom
+ 1, "hared-network"))
960 return SHARED_NETWORK
;
961 if (!strcasecmp (atom
+ 1, "econdary"))
963 if (!strcasecmp (atom
+ 1, "erver-name"))
965 if (!strcasecmp (atom
+ 1, "erver-identifier"))
966 return SERVER_IDENTIFIER
;
967 if (!strcasecmp (atom
+ 1, "erver"))
969 if (!strcasecmp (atom
+ 1, "elect-timeout"))
970 return SELECT_TIMEOUT
;
971 if (!strcasecmp (atom
+ 1, "elect"))
973 if (!strcasecmp (atom
+ 1, "end"))
975 if (!strcasecmp (atom
+ 1, "cript"))
977 if (!strcasecmp (atom
+ 1, "upersede"))
979 if (!strncasecmp (atom
+ 1, "ub", 2)) {
980 if (!strcasecmp (atom
+ 3, "string"))
982 if (!strcasecmp (atom
+ 3, "net"))
984 if (!strcasecmp (atom
+ 3, "class"))
988 if (!strcasecmp (atom
+ 1, "pawn"))
990 if (!strcasecmp (atom
+ 1, "pace"))
992 if (!strcasecmp (atom
+ 1, "tatic"))
994 if (!strcasecmp (atom
+ 1, "plit"))
996 if (!strcasecmp (atom
+ 1, "et"))
998 if (!strcasecmp (atom
+ 1, "econds"))
1000 if (!strcasecmp (atom
+ 1, "hutdown"))
1002 if (!strcasecmp (atom
+ 1, "tartup"))
1006 if (!strcasecmp (atom
+ 1, "imestamp"))
1008 if (!strcasecmp (atom
+ 1, "imeout"))
1010 if (!strcasecmp (atom
+ 1, "oken-ring"))
1012 if (!strcasecmp (atom
+ 1, "ext"))
1014 if (!strcasecmp (atom
+ 1, "stp"))
1016 if (!strcasecmp (atom
+ 1, "sfp"))
1018 if (!strcasecmp (atom
+ 1, "ransmission"))
1019 return TRANSMISSION
;
1022 if (!strcasecmp (atom
+ 1, "nset"))
1024 if (!strcasecmp (atom
+ 1, "nsigned"))
1026 if (!strcasecmp (atom
+ 1, "id"))
1028 if (!strncasecmp (atom
+ 1, "se", 2)) {
1029 if (!strcasecmp (atom
+ 3, "r-class"))
1031 if (!strcasecmp (atom
+ 3, "-host-decl-names"))
1032 return USE_HOST_DECL_NAMES
;
1033 if (!strcasecmp (atom
+ 3,
1034 "-lease-addr-for-default-route"))
1035 return USE_LEASE_ADDR_FOR_DEFAULT_ROUTE
;
1038 if (!strncasecmp (atom
+ 1, "nknown", 6)) {
1039 if (!strcasecmp (atom
+ 7, "-clients"))
1040 return UNKNOWN_CLIENTS
;
1041 if (!strcasecmp (atom
+ 7, "-state"))
1042 return UNKNOWN_STATE
;
1047 if (!strcasecmp (atom
+ 1, "nauthenticated"))
1048 return AUTHENTICATED
;
1049 if (!strcasecmp (atom
+ 1, "pdated-dns-rr"))
1050 return UPDATED_DNS_RR
;
1051 if (!strcasecmp (atom
+ 1, "pdate"))
1055 if (!strcasecmp (atom
+ 1, "endor-class"))
1056 return VENDOR_CLASS
;
1057 if (!strcasecmp (atom
+ 1, "endor"))
1061 if (!strcasecmp (atom
+ 1, "ith"))
1065 if (!strcasecmp (atom
+ 1, "iaddr"))
1067 if (!strcasecmp (atom
+ 1, "xdomain"))
1069 if (!strcasecmp (atom
+ 1, "xrrset"))
1073 if (!strcasecmp (atom
+ 1, "one"))