1 /* $Id: configfile.h 5801 2002-10-07 07:36:12Z rra $
3 ** Interface to innfeed's configuration file parser.
5 ** Written by James Brister <brister@vix.com>
8 #if ! defined ( configfile_h__ )
11 /* Avoid conflicts with parsedate.y's generated yacc code. */
12 #define yy_yyv innfeed_yy_yyv
13 #define yyact innfeed_yyact
14 #define yychk innfeed_yychk
15 #define yydef innfeed_yydef
16 #define yyexca innfeed_yyexca
17 #define yylval innfeed_yylval
18 #define yypact innfeed_yypact
19 #define yypgo innfeed_yypgo
20 #define yyr1 innfeed_yyr1
21 #define yyr2 innfeed_yyr2
22 #define yys innfeed_yys
23 #define yyv innfeed_yyv
24 #define yyval innfeed_yyval
26 /* pointer to function taking void-star param and returning int. */
27 typedef int (*PFIVP)(void *) ;
29 typedef enum { intval, charval, boolval, realval, stringval, scopeval } tag ;
31 typedef struct _scope {
36 struct _value **values ;
37 struct _scope *parent ;
40 typedef struct _value {
42 struct _scope *myscope ;
50 struct _scope *scope_val ;
54 extern scope *topScope ;
55 extern char *errbuff ;
57 int isWord (scope *s, const char *name, int inherit) ;
58 int isName (scope *s, const char *name, int inherit) ;
60 int getReal (scope *s, const char *name, double *rval, int inherit) ;
61 int getInteger (scope *s, const char *name, long *rval, int inherit) ;
62 int getBool (scope *s, const char *name, int *rval, int inherit) ;
63 int getString (scope *s, const char *name, char **rval, int inherit) ;
64 int getWord (scope *s, const char *name, char **rval, int inherit) ;
66 void freeScopeTree (scope *s) ;
67 char *addInteger (scope *s, const char *name, long val) ;
68 char *addChar (scope *s, const char *name, char val) ;
69 char *addBoolean (scope *s, const char *name, int val) ;
70 char *addName (scope *s, const char *name, char *val) ;
71 char *addWord (scope *s, const char *name, char *val) ;
72 char *addReal (scope *s, const char *name, double val) ;
73 char *addString (scope *s, const char *name, const char *val) ;
74 scope *findScope (scope *s, const char *name, int mustExist) ;
75 value *findValue (scope *s, const char *name, int inherit) ;
76 value *findPeer (const char *name) ;
77 value *getNextPeer (int *cookie) ;
78 void configAddLoadCallback (PFIVP func,void *arg) ;
79 void configRemoveLoadCallback (PFIVP func) ;
80 int readConfig (const char *file, FILE *errorDest, int justCheck, int dump) ;
81 int buildPeerTable (FILE *fp, scope *currScope);
82 void configCleanup (void) ;
84 #define ARTICLE_TIMEOUT "article-timeout"
85 #define BACKLOG_LIMIT "backlog-limit"
86 #define INITIAL_CONNECTIONS "initial-connections"
87 #define IP_NAME "ip-name"
88 #define MAX_CONNECTIONS "max-connections"
89 #define MAX_QUEUE_SIZE "max-queue-size"
90 #define NO_CHECK_HIGH "no-check-high"
91 #define NO_CHECK_LOW "no-check-low"
92 #define PORT_NUMBER "port-number"
93 #define RESP_TIMEOUT "response-timeout"
94 #define STREAMING "streaming"
95 #define DROP_DEFERRED "drop-deferred"
97 #define ISPEER(V) (ISSCOPE(V) && strcmp ((V)->v.scope_val->scope_type,"peer") == 0)
98 #define ISSCOPE(V) (V->type == scopeval)
103 /* Interface between lexer and parser. */
106 #endif /* configfile_h__ */