File: dump_yacc.y

package info (click to toggle)
milter-greylist 3.0-3.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 920 kB
  • ctags: 787
  • sloc: ansic: 6,864; sh: 3,205; yacc: 736; lex: 321; makefile: 166
file content (75 lines) | stat: -rw-r--r-- 1,469 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
%token IPADDR IP6ADDR EMAIL TIME AUTO GARBAGE

%{
#include "config.h"

#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#ifdef __RCSID  
__RCSID("$Id: dump_yacc.y,v 1.18.2.1 2006/11/07 05:12:11 manu Exp $");
#endif
#endif

#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include "conf.h"
#include "pending.h"
#include "autowhite.h"

int dump_lex(void);
void dump_error(char *);
%}

%union	{
	struct sockaddr_in ipaddr;
#ifdef AF_INET6
	struct sockaddr_in6 ip6addr;
#else
	struct sockaddr_in ip6addr;		/* XXX: for dummy */
#endif
	char email[ADDRLEN + 1];
	time_t time;
	}
%type <ipaddr> IPADDR;
%type <ip6addr> IP6ADDR;
%type <email> EMAIL;
%type <time> TIME;

%%
lines	:	lines greyentry '\n' 
	|	lines autoentry '\n'
	|	lines '\n'
	|	error '\n'		{ yyerrok; }
	|
	;
greyentry :	IPADDR EMAIL EMAIL TIME	{
			pending_get(SA(&$1), sizeof(struct sockaddr_in), $2,
			    $3, $4);
		}
	|	IP6ADDR EMAIL EMAIL TIME {
#ifdef AF_INET6
			pending_get(SA(&$1), sizeof(struct sockaddr_in6), $2,
			    $3, $4);
#else
			printf("IPv6 is not supported, ignore line %d\n",
			    dump_line);
#endif
		}
	;
autoentry :	IPADDR EMAIL EMAIL TIME AUTO { 
			autowhite_get(SA(&$1), sizeof(struct sockaddr_in), $2,
			    $3, $4);
		}
	|	IP6ADDR EMAIL EMAIL TIME AUTO {
#ifdef AF_INET6
			autowhite_get(SA(&$1), sizeof(struct sockaddr_in6), $2,
			    $3, $4);
#else
			printf("IPv6 is not supported, ignore line %d\n",
			    dump_line);
#endif
		}
	;
%%
#include "dump_lex.c"