6 * @brief Tokenisation code and constants
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 * Copyright 2001,2006 The FreeRADIUS server project
27 #include <freeradius-devel/ident.h>
28 RCSIDH(token_h, "$Id$")
34 typedef enum fr_token_t {
35 T_OP_INVALID = 0, /* invalid token */
36 T_EOL, /* end of line */
55 T_OP_CMP_TRUE, /* =* */
56 T_OP_CMP_FALSE, /* !* 20 */
59 T_BARE_WORD, /* bare word */
60 T_DOUBLE_QUOTED_STRING, /* "foo" */
61 T_SINGLE_QUOTED_STRING, /* 'foo' 25 */
62 T_BACK_QUOTED_STRING, /* `foo` */
66 #define T_EQSTART T_OP_ADD
67 #define T_EQEND (T_OP_CMP_EQ + 1)
69 typedef struct FR_NAME_NUMBER {
74 extern const FR_NAME_NUMBER fr_tokens[];
76 int fr_str2int(const FR_NAME_NUMBER *table, const char *name, int def);
77 int fr_substr2int(const FR_NAME_NUMBER *table, const char *name, int def, int len);
78 const char *fr_int2str(const FR_NAME_NUMBER *table, int number,
82 int getword (const char **ptr, char *buf, int buflen);
83 int getbareword (const char **ptr, char *buf, int buflen);
84 FR_TOKEN gettoken(const char **ptr, char *buf, int buflen);
85 FR_TOKEN getstring(const char **ptr, char *buf, int buflen);
86 const char *fr_token_name(int);
92 #endif /* FR_TOKEN_H */