chiark / gitweb /
Initial CVS checkin.
[userv.git] / tokens.h.m4
1 dnl  userv - tokens.h.m4
2 dnl  token values, passed through m4 with defs from langauge.i4
3 /*  
4  *   Copyright (C)1996-1997 Ian Jackson
5  *  
6  *   This is free software; you can redistribute it and/or modify it
7  *   under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation; either version 2 of the License, or
9  *   (at your option) any later version.
10  *  
11  *   This program is distributed in the hope that it will be useful, but
12  *   WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *   General Public License for more details.
15  *  
16  *   You should have received a copy of the GNU General Public License
17  *   along with userv; if not, write to the Free Software
18  *   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20
21 include(language.i4)
22
23 #ifndef TOKENS_H
24 #define TOKENS_H
25
26 enum tokens {
27   tokm_instance=           000000000777,
28   tokm_repres=             000000007000,
29   tokm_type=               017777770000,
30   tokr_nonstring=          000000001000,
31   tokr_word=               000000002000,
32   tokr_punct=              000000003000,
33   tokr_string=             000000004000,
34 undivert(4)
35 undivert(1)
36 undivert(2)
37 };
38
39 typedef int directive_fnt(int dtoken);
40 directive_fnt df_reject, df_execute, df_executefrompath;
41 directive_fnt df_executefromdirectory;
42 directive_fnt df_errorstostderr, df_errorstosyslog, df_errorstofile;
43 directive_fnt dfg_fdwant, dfg_setflag;
44 directive_fnt df_reset, df_cd, df_userrcfile, df_include;
45 directive_fnt df_includelookup, df_includedirectory;
46 directive_fnt df_message, df_error, df_quit, df_eof;
47 directive_fnt df_if, df_catchquit, df_errorspush;
48 directive_fnt dfi_includeuserrcfile, dfi_includeclientconfig;
49 /* directive functions return:
50  *  0 for success
51  *   having scanned up to and including end of line but not beyond
52  *  an exception (eg tokv_error) for failure of some kind
53  */
54
55 typedef int parmcondition_fnt(int ctoken, char **parmvalues, int *rtrue);
56 parmcondition_fnt pcf_glob, pcf_range, pcf_grep;
57 /* all conditional functions return tokv_error or 0 for success at parsing
58  *  and testing, in which case *rtrue is set to 0 or 1.  On success they
59  *  have scanned up to and including the condition's terminating newline.
60  * The parameter-based conditionals take a list of parameter values
61  * as obtained from the parameter functions and pa_parameter,
62  * and do _not_ free it.
63  */
64
65 typedef int parameter_fnt(int ptoken, char ***rvalues);
66 parameter_fnt pf_service;
67 parameter_fnt pf_callinguser, pf_serviceuser;
68 parameter_fnt pf_callinggroup, pf_servicegroup;
69 parameter_fnt pf_callingusershell, pf_serviceusershell;
70 /* Parameter functions return tokv_error or 0 for success at parsing
71  * and determining the value, in which case *rvalues is made to be
72  * a mallocd null-terminated array of pointers to mallocd strings.
73  * freeparm can be used to free such an array.
74  */
75
76 int yylex(void);
77 /* Returns a token (which may be a eof or error exception) */
78
79 extern directive_fnt *lr_dir;
80 extern parmcondition_fnt *lr_parmcond;
81 extern parameter_fnt *lr_parameter;
82 extern int lr_loglevel, lr_logfacility, lr_min, lr_max, *lr_flag;
83 extern int lr_flagval, lr_controlend;
84 extern int lr_fdwant_readwrite; /* -1=never, 0=opt, 1=always */
85
86 undivert(4)
87
88 #endif
89
90 divert(-1)
91 undivert