diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2001-06-15 04:46:36 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2001-06-15 04:46:36 +0000 |
commit | 6ea4bcb77bc389eb6f73c6a58c473bbb99bde64a (patch) | |
tree | 7235aec19b08746e06ef2342cc3d16a6715edfb8 /src | |
parent | 7bd5998574d02fa9d4a67e56e2f4b620da55aed3 (diff) | |
download | ipacct-6ea4bcb77bc389eb6f73c6a58c473bbb99bde64a.tar.gz ipacct-6ea4bcb77bc389eb6f73c6a58c473bbb99bde64a.tar.bz2 |
update
Diffstat (limited to 'src')
-rw-r--r-- | src/account.c | 75 | ||||
-rw-r--r-- | src/config.c | 1825 | ||||
-rw-r--r-- | src/config.y | 4 | ||||
-rw-r--r-- | src/ipacct.h | 5 | ||||
-rw-r--r-- | src/list.c | 7 | ||||
-rw-r--r-- | src/main.c | 11 | ||||
-rw-r--r-- | src/report.c | 6 | ||||
-rw-r--r-- | src/report.h | 3 |
8 files changed, 1233 insertions, 703 deletions
diff --git a/src/account.c b/src/account.c index 447e159..1ee3f08 100644 --- a/src/account.c +++ b/src/account.c @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: account.c,v 1.1 2001/06/14 18:05:37 gray Exp $ */ +/* $Id: account.c,v 1.2 2001/06/15 04:46:37 gray Exp $ */ #if defined(HAVE_CONFIG_H) # include <config.h> #endif @@ -37,7 +37,8 @@ register_stream_list(name, streamlist) stat_t stat; memset(&stat, 0, sizeof(stat)); - stat.name = name; + strncpy(stat.name, name, sizeof(stat.name)); + stat.name[sizeof(stat.name)-1] = 0; stat.streams = streamlist; list_alloc(&targets, &stat, sizeof(stat)); } @@ -169,7 +170,6 @@ account(ip) list_iterate(targets, _account_check_stat, &ipd); } -/* FIXME: FIXME: stat unused */ void verbose_report(stat, ip) stat_t *stat; @@ -177,7 +177,8 @@ verbose_report(stat, ip) { char buf1[16], buf2[16]; - printf("(%x) %s > (%x) %s %d\n", + printf("%s: (%x) %s > (%x) %s %d\n", + stat->name, ip->ip_src.s_addr, ipaddr2str(buf1, ip->ip_src.s_addr), ip->ip_dst.s_addr, @@ -272,3 +273,69 @@ dump_table(time) } +static char buf[128]; +int doprompt; + +char * +moreinput(buf, bufsize) + char *buf; + size_t bufsize; +{ + if (doprompt) + printf("%% "); + return fgets(buf, bufsize, stdin); +} + +int +test_shell() +{ + char *tok; + int c; + struct ip ip; + +#define opttkn() (tok = strtok(NULL, " \t")) +#define nextkn() if (opttkn() == NULL) {\ + printf("arg count\n");\ + continue; } +#define chktkn() if (!tok) { \ + printf("arg count\n");\ + continue; } + + printf("** TEST MODE **\n"); + doprompt = isatty(fileno(stdin)); + while (tok = moreinput(buf, sizeof(buf))) { + while (*tok && isspace(*tok)) + tok++; + c = strlen(tok); + if (c > 1 && tok[c-1] == '\n') + tok[c-1] = 0; + c = *tok++; + tok = strtok(tok, " \t"); + switch (c) { + case 0: + case '#': + continue; + case '?': + printf("p SRC DEST [LEN]\n"); + printf("q\n"); + break; + case 'p': + chktkn(); + ip.ip_src.s_addr = ipstr2long(tok); + nextkn(); + ip.ip_dst.s_addr = ipstr2long(tok); + if (opttkn()) + ip.ip_len = htonl(atoi(tok)); + else + ip.ip_len = sizeof(ip); + account(&ip); + break; + case 'q': + return 0; + default: + printf("no command\n"); + } + } + return 0; +} + diff --git a/src/config.c b/src/config.c index c1cbefa..d5b8b39 100644 --- a/src/config.c +++ b/src/config.c @@ -1,8 +1,40 @@ -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; -#endif -#define YYBYACC 1 -#line 19 "config.y" + +/* A Bison parser, made from config.y + by GNU Bison version 1.25 + */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define NUMBER 258 +#define STRING 259 +#define IPADDRESS 260 +#define STAT 261 +#define HOST 262 +#define NET 263 +#define NETMASK 264 +#define STREAM 265 +#define IS 266 +#define FROM 267 +#define TO 268 +#define ALL 269 +#define EXCEPT 270 +#define ITSELF 271 +#define DEFINE 272 +#define SLICE 273 +#define OPTION 274 +#define CHANNEL 275 +#define K_FILE 276 +#define K_SYSLOG 277 +#define UDP 278 +#define FACILITY 279 +#define PRIORITY 280 +#define DUMPFILE 281 +#define ABSOLUTE 282 +#define BOGUS 283 +#define EOL 284 + +#line 18 "config.y" + #if defined(HAVE_CONFIG_H) # include <config.h> #endif @@ -40,6 +72,7 @@ static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; static int xlat_keyword(struct keyword *kw, char *str); static void yyerrsync(); static void register_address(char *name, IPADDR addr, UINT4 netmask); + #line 58 "config.y" typedef union { long number; @@ -49,273 +82,1127 @@ typedef union { list_t list; stream_t stream; } YYSTYPE; -#line 53 "y.tab.c" -#define NUMBER 257 -#define STRING 258 -#define IPADDRESS 259 -#define STAT 260 -#define HOST 261 -#define NET 262 -#define NETMASK 263 -#define STREAM 264 -#define IS 265 -#define FROM 266 -#define TO 267 -#define ALL 268 -#define EXCEPT 269 -#define ITSELF 270 -#define DEFINE 271 -#define SLICE 272 -#define OPTION 273 -#define CHANNEL 274 -#define K_FILE 275 -#define K_SYSLOG 276 -#define UDP 277 -#define FACILITY 278 -#define PRIORITY 279 -#define DUMPFILE 280 -#define ABSOLUTE 281 -#define BOGUS 282 -#define EOL 283 -#define YYERRCODE 256 -short yylhs[] = { -1, - 0, 14, 14, 15, 15, 15, 15, 15, 15, 16, - 21, 21, 21, 1, 1, 1, 22, 22, 22, 4, - 4, 5, 5, 7, 7, 2, 2, 3, 3, 17, - 18, 18, 6, 6, 19, 19, 8, 23, 23, 13, - 13, 12, 12, 11, 11, 10, 10, 9, 9, 9, - 9, 20, +#ifndef YYDEBUG +#define YYDEBUG 1 +#endif + +#include <stdio.h> + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 81 +#define YYFLAG -32768 +#define YYNTBASE 33 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 57) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 31, 32, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 30, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29 }; -short yylen[] = { 2, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, - 2, 2, 2, 1, 3, 5, 3, 5, 4, 1, - 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, - 2, 2, 3, 3, 4, 4, 1, 0, 1, 1, - 2, 2, 4, 1, 1, 1, 2, 1, 1, 1, - 1, 3, + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 7, 9, 11, 13, 15, 17, 19, + 22, 25, 28, 31, 33, 37, 43, 47, 53, 58, + 60, 62, 64, 66, 67, 69, 71, 73, 75, 77, + 80, 83, 86, 90, 94, 99, 104, 106, 107, 109, + 111, 114, 117, 122, 124, 126, 128, 131, 133, 135, + 137, 139 }; -short yydefred[] = { 0, - 9, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 4, 5, 6, 7, 8, 0, 0, 0, 10, 31, - 0, 32, 37, 0, 0, 30, 3, 0, 11, 12, - 0, 0, 0, 13, 0, 0, 39, 0, 0, 50, - 51, 49, 46, 0, 0, 0, 20, 21, 0, 27, - 26, 0, 34, 33, 44, 45, 35, 0, 40, 0, - 47, 0, 25, 17, 0, 28, 29, 0, 0, 41, - 0, 22, 23, 0, 19, 0, 16, 18, 0, + +static const short yyrhs[] = { 34, + 0, 35, 0, 34, 35, 0, 36, 0, 45, 0, + 46, 0, 48, 0, 56, 0, 1, 0, 6, 37, + 0, 18, 38, 0, 19, 4, 0, 20, 39, 0, + 3, 0, 3, 30, 3, 0, 3, 30, 3, 30, + 3, 0, 21, 4, 42, 0, 22, 40, 31, 41, + 42, 0, 23, 43, 44, 42, 0, 3, 0, 24, + 0, 3, 0, 25, 0, 0, 27, 0, 5, 0, + 4, 0, 3, 0, 4, 0, 26, 4, 0, 7, + 5, 0, 8, 47, 0, 5, 32, 3, 0, 5, + 9, 5, 0, 10, 49, 50, 55, 0, 10, 49, + 50, 51, 0, 4, 0, 0, 11, 0, 52, 0, + 51, 52, 0, 53, 54, 0, 53, 54, 15, 54, + 0, 12, 0, 13, 0, 55, 0, 54, 55, 0, + 5, 0, 47, 0, 14, 0, 16, 0, 17, 49, + 54, 0 }; -short yydgoto[] = { 8, - 29, 52, 68, 49, 74, 42, 64, 24, 43, 44, - 58, 59, 60, 9, 10, 11, 12, 13, 14, 15, - 19, 34, 38, + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 96, 99, 100, 103, 104, 105, 106, 107, 108, 116, + 119, 123, 133, 136, 137, 141, 147, 152, 157, 164, + 165, 168, 169, 172, 176, 182, 183, 194, 198, 212, + 219, 225, 233, 238, 245, 250, 256, 259, 260, 263, + 268, 275, 281, 290, 294, 300, 305, 312, 317, 318, + 323, 331 }; -short yysindex[] = { -254, - 0, -216, -248, -235, -229, -229, -212, 0, -254, 0, - 0, 0, 0, 0, 0, -217, -207, -215, 0, 0, - -47, 0, 0, -223, -218, 0, 0, -13, 0, 0, - -199, -253, -244, 0, -196, -193, 0, -247, -47, 0, - 0, 0, 0, -218, -192, -214, 0, 0, 20, 0, - 0, -225, 0, 0, 0, 0, 0, -218, 0, -213, - 0, 11, 0, 0, -252, 0, 0, -214, -221, 0, - -187, 0, 0, -214, 0, -218, 0, 0, -218, +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","NUMBER", +"STRING","IPADDRESS","STAT","HOST","NET","NETMASK","STREAM","IS","FROM","TO", +"ALL","EXCEPT","ITSELF","DEFINE","SLICE","OPTION","CHANNEL","K_FILE","K_SYSLOG", +"UDP","FACILITY","PRIORITY","DUMPFILE","ABSOLUTE","BOGUS","EOL","':'","'.'", +"'/'","input","list","stmt","stat_stmt","stat_cmd","timeval","channel","facility", +"priority","channel_opts","host","port","dump_stmt","host_stmt","network","stream_stmt", +"strnam","is","stream_decl_list","stream_decl","flow_dir","addr_list","address", +"defn_stmt", NULL }; -short yyrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -231, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 55, 0, 68, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 93, 0, 0, 0, 0, 0, 68, 18, 0, - 0, 0, 0, 68, 0, 0, 0, 0, 30, +#endif + +static const short yyr1[] = { 0, + 33, 34, 34, 35, 35, 35, 35, 35, 35, 36, + 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, + 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, + 46, 46, 47, 47, 48, 48, 49, 50, 50, 51, + 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, + 55, 56 }; -short yygindex[] = { 0, - 0, 0, 0, 0, 0, 69, -52, 66, -35, -45, - 0, 14, 0, 0, 67, 0, 0, 0, 0, 0, - 0, 0, 0, + +static const short yyr2[] = { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 1, 3, 5, 3, 5, 4, 1, + 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, + 2, 2, 3, 3, 4, 4, 1, 0, 1, 1, + 2, 2, 4, 1, 1, 1, 2, 1, 1, 1, + 1, 3 }; -#define YYTABLESIZE 373 -short yytable[] = { 36, - 48, 1, 57, 47, 72, 2, 3, 4, 61, 5, - 20, 39, 69, 50, 51, 75, 6, 42, 55, 56, - 40, 78, 41, 21, 48, 7, 73, 38, 23, 43, - 79, 66, 67, 61, 38, 38, 38, 39, 38, 28, - 39, 37, 14, 61, 45, 26, 40, 76, 41, 40, - 30, 41, 55, 56, 52, 16, 17, 18, 46, 31, - 32, 33, 53, 54, 62, 65, 63, 24, 71, 77, - 1, 25, 22, 70, 0, 27, 0, 0, 0, 36, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 48, 0, 0, 48, - 48, 48, 48, 0, 48, 0, 48, 48, 48, 48, - 48, 48, 0, 42, 0, 0, 0, 42, 42, 42, - 48, 42, 0, 42, 42, 43, 0, 0, 42, 43, - 43, 43, 0, 43, 0, 43, 43, 42, 14, 0, - 43, 0, 14, 14, 14, 0, 14, 0, 0, 43, - 52, 0, 0, 14, 52, 52, 52, 0, 52, 0, - 0, 0, 14, 24, 0, 52, 0, 24, 24, 24, - 0, 24, 0, 0, 52, 36, 0, 0, 24, 36, - 36, 36, 0, 36, 0, 0, 0, 24, 15, 0, - 36, 0, 15, 15, 15, 0, 15, 0, 0, 36, - 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, - 0, 0, 15, + +static const short yydefact[] = { 0, + 9, 0, 0, 0, 0, 0, 0, 0, 2, 4, + 5, 6, 7, 8, 0, 0, 0, 10, 31, 0, + 32, 37, 38, 0, 30, 3, 14, 11, 12, 0, + 0, 0, 13, 0, 0, 39, 0, 48, 50, 51, + 49, 52, 46, 0, 24, 20, 21, 0, 27, 26, + 0, 34, 33, 44, 45, 36, 40, 0, 35, 47, + 15, 25, 17, 0, 28, 29, 24, 41, 42, 0, + 22, 23, 24, 19, 0, 16, 18, 43, 0, 0, + 0 }; -short yycheck[] = { 47, - 0, 256, 38, 257, 257, 260, 261, 262, 44, 264, - 259, 259, 58, 258, 259, 68, 271, 0, 266, 267, - 268, 74, 270, 259, 278, 280, 279, 259, 258, 0, - 76, 257, 258, 69, 266, 267, 268, 259, 270, 257, - 259, 265, 0, 79, 58, 258, 268, 269, 270, 268, - 258, 270, 266, 267, 0, 272, 273, 274, 258, 275, - 276, 277, 259, 257, 257, 46, 281, 0, 58, 257, - 0, 6, 4, 60, -1, 9, -1, -1, -1, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 263, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 256, -1, -1, 259, - 260, 261, 262, -1, 264, -1, 266, 267, 268, 269, - 270, 271, -1, 256, -1, -1, -1, 260, 261, 262, - 280, 264, -1, 266, 267, 256, -1, -1, 271, 260, - 261, 262, -1, 264, -1, 266, 267, 280, 256, -1, - 271, -1, 260, 261, 262, -1, 264, -1, -1, 280, - 256, -1, -1, 271, 260, 261, 262, -1, 264, -1, - -1, -1, 280, 256, -1, 271, -1, 260, 261, 262, - -1, 264, -1, -1, 280, 256, -1, -1, 271, 260, - 261, 262, -1, 264, -1, -1, -1, 280, 256, -1, - 271, -1, 260, 261, 262, -1, 264, -1, -1, 280, - -1, -1, -1, 271, -1, -1, -1, -1, -1, -1, - -1, -1, 280, + +static const short yydefgoto[] = { 79, + 8, 9, 10, 18, 28, 33, 48, 73, 63, 51, + 67, 11, 12, 41, 13, 23, 37, 56, 57, 58, + 42, 43, 14 }; -#define YYFINAL 8 -#ifndef YYDEBUG -#define YYDEBUG 1 -#endif -#define YYMAXTOKEN 283 -#if YYDEBUG -char *yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,"'.'","'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"NUMBER","STRING", -"IPADDRESS","STAT","HOST","NET","NETMASK","STREAM","IS","FROM","TO","ALL", -"EXCEPT","ITSELF","DEFINE","SLICE","OPTION","CHANNEL","K_FILE","K_SYSLOG","UDP", -"FACILITY","PRIORITY","DUMPFILE","ABSOLUTE","BOGUS","EOL", + +static const short yypact[] = { 9, +-32768, 4, 7, 23, 29, 29, 33, 1,-32768,-32768, +-32768,-32768,-32768,-32768, 41, 49, 27,-32768,-32768, -3, +-32768,-32768, 19, 38,-32768,-32768, 21,-32768,-32768, 57, + 10, 51,-32768, 58, 59,-32768, 26, -3,-32768,-32768, +-32768, 38,-32768, 61, 39,-32768,-32768, 34,-32768,-32768, + 54,-32768,-32768,-32768,-32768, 47,-32768, 38,-32768,-32768, + 37,-32768,-32768, 0,-32768,-32768, 39,-32768, 31, 65, +-32768,-32768, 39,-32768, 38,-32768,-32768, 38, 69, 70, +-32768 }; -char *yyrule[] = { -"$accept : input", -"input : list", -"list : stmt", -"list : list stmt", -"stmt : stat_stmt", -"stmt : dump_stmt", -"stmt : host_stmt", -"stmt : stream_stmt", -"stmt : defn_stmt", -"stmt : error", -"stat_stmt : STAT stat_cmd", -"stat_cmd : SLICE timeval", -"stat_cmd : OPTION STRING", -"stat_cmd : CHANNEL channel", -"timeval : NUMBER", -"timeval : NUMBER ':' NUMBER", -"timeval : NUMBER ':' NUMBER ':' NUMBER", -"channel : K_FILE STRING channel_opts", -"channel : K_SYSLOG facility '.' priority channel_opts", -"channel : UDP host port channel_opts", -"facility : NUMBER", -"facility : FACILITY", -"priority : NUMBER", -"priority : PRIORITY", -"channel_opts :", -"channel_opts : ABSOLUTE", -"host : IPADDRESS", -"host : STRING", -"port : NUMBER", -"port : STRING", -"dump_stmt : DUMPFILE STRING", -"host_stmt : HOST IPADDRESS", -"host_stmt : NET network", -"network : IPADDRESS '/' NUMBER", -"network : IPADDRESS NETMASK IPADDRESS", -"stream_stmt : STREAM strnam is address", -"stream_stmt : STREAM strnam is stream_decl_list", -"strnam : STRING", -"is :", -"is : IS", -"stream_decl_list : stream_decl", -"stream_decl_list : stream_decl_list stream_decl", -"stream_decl : flow_dir addr_list", -"stream_decl : flow_dir addr_list EXCEPT addr_list", -"flow_dir : FROM", -"flow_dir : TO", -"addr_list : address", -"addr_list : addr_list address", -"address : IPADDRESS", -"address : network", -"address : ALL", -"address : ITSELF", -"defn_stmt : DEFINE strnam addr_list", + +static const short yypgoto[] = {-32768, +-32768, 63,-32768,-32768,-32768,-32768,-32768,-32768, -53,-32768, +-32768,-32768,-32768, 68,-32768, 67,-32768,-32768, 18,-32768, + -54, -37,-32768 }; + + +#define YYLAST 74 + + +static const short yytable[] = { 59, + -1, 1, 71, 69, 60, 34, 2, 3, 4, 1, + 5, 19, 46, 74, 2, 3, 4, 6, 5, 77, + 78, 15, 16, 17, 72, 6, 7, 20, 35, 36, + 38, 60, 22, 47, 7, 38, 25, 54, 55, 39, + 60, 40, 38, 27, 39, 75, 40, 30, 31, 32, + 44, 39, 29, 40, 49, 50, 65, 66, 54, 55, + 45, 53, 52, 61, 64, 62, 70, 76, 80, 81, + 26, 21, 24, 68 +}; + +static const short yycheck[] = { 37, + 0, 1, 3, 58, 42, 9, 6, 7, 8, 1, + 10, 5, 3, 67, 6, 7, 8, 17, 10, 73, + 75, 18, 19, 20, 25, 17, 26, 5, 32, 11, + 5, 69, 4, 24, 26, 5, 4, 12, 13, 14, + 78, 16, 5, 3, 14, 15, 16, 21, 22, 23, + 30, 14, 4, 16, 4, 5, 3, 4, 12, 13, + 4, 3, 5, 3, 31, 27, 30, 3, 0, 0, + 8, 4, 6, 56 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include <alloca.h> +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include <malloc.h> +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include <malloc.h> + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH #endif -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#ifdef YYSTACKSIZE + #ifndef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); #endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 196 "bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); #else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); #endif + yychar = YYLEX; + } + + /* Convert |