1%{
2/*
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)
--- 5 unchanged lines hidden (view full) ---
14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
17 * written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 * $FreeBSD: head/contrib/libpcap/grammar.y 56891 2000-01-30 00:43:38Z fenner $
23 */
24#ifndef lint
25static const char rcsid[] =
26 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.57 1999/10/19 15:18:30 itojun Exp $ (LBL)";
27#endif
28
29#include <sys/types.h>
30#include <sys/time.h>
31#include <sys/socket.h>
32
33#if __STDC__
34struct mbuf;
--- 63 unchanged lines hidden (view full) ---
98%type <blk> head
99%type <i> pqual dqual aqual ndaqual
100%type <a> arth narth
101%type <i> byteop pname pnum relop irelop
102%type <blk> and or paren not null prog
103%type <rblk> other
104
105%token DST SRC HOST GATEWAY
106%token NET MASK PORT LESS GREATER PROTO PROTOCHAIN BYTE
107%token ARP RARP IP TCP UDP ICMP IGMP IGRP PIM
108%token ATALK DECNET LAT SCA MOPRC MOPDL
109%token TK_BROADCAST TK_MULTICAST
110%token NUM INBOUND OUTBOUND
111%token LINK
112%token GEQ LEQ NEQ
113%token ID EID HID HID6
114%token LSH RSH
115%token LEN
116%token ISO ESIS ISIS
117%token IPV6 ICMPV6 AH ESP
118
119%type <s> ID
120%type <e> EID
121%type <s> HID HID6
122%type <i> NUM
123
124%left OR AND
125%nonassoc '!'
126%left '|'
127%left '&'
128%left LSH RSH
129%left '+' '-'
--- 35 unchanged lines hidden (view full) ---
165 case Q_DECNET:
166 $$.b = gen_ncode($1, 0, $$.q);
167 break;
168 default:
169 $$.b = gen_ncode($1, 0, $$.q);
170 break;
171 }
172 }
173 | HID6 '/' NUM {
174#ifdef INET6
175 $$.b = gen_mcode6($1, NULL, $3,
176 $$.q = $<blk>0.q);
177#else
178 bpf_error("'ip6addr/prefixlen' not supported "
179 "in this configuration");
180#endif /*INET6*/
181 }
182 | HID6 {
183#ifdef INET6
184 $$.b = gen_mcode6($1, 0, 128,
185 $$.q = $<blk>0.q);
186#else
187 bpf_error("'ip6addr' not supported "
188 "in this configuration");
189#endif /*INET6*/
190 }
191 | EID { $$.b = gen_ecode($1, $$.q = $<blk>0.q); }
192 | not id { gen_not($2.b); $$ = $2; }
193 ;
194not: '!' { $$ = $<blk>0; }
195 ;
196paren: '(' { $$ = $<blk>0; }
197 ;
198pid: nid
--- 6 unchanged lines hidden (view full) ---
205 ;
206term: rterm
207 | not term { gen_not($2.b); $$ = $2; }
208 ;
209head: pqual dqual aqual { QSET($$.q, $1, $2, $3); }
210 | pqual dqual { QSET($$.q, $1, $2, Q_DEFAULT); }
211 | pqual aqual { QSET($$.q, $1, Q_DEFAULT, $2); }
212 | pqual PROTO { QSET($$.q, $1, Q_DEFAULT, Q_PROTO); }
213 | pqual PROTOCHAIN { QSET($$.q, $1, Q_DEFAULT, Q_PROTOCHAIN); }
214 | pqual ndaqual { QSET($$.q, $1, Q_DEFAULT, $2); }
215 ;
216rterm: head id { $$ = $2; }
217 | paren expr ')' { $$.b = $2.b; $$.q = $1.q; }
218 | pname { $$.b = gen_proto_abbrev($1); $$.q = qerr; }
219 | arth relop arth { $$.b = gen_relation($2, $1, $3, 0);
220 $$.q = qerr; }
221 | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1);
--- 24 unchanged lines hidden (view full) ---
246 | IP { $$ = Q_IP; }
247 | ARP { $$ = Q_ARP; }
248 | RARP { $$ = Q_RARP; }
249 | TCP { $$ = Q_TCP; }
250 | UDP { $$ = Q_UDP; }
251 | ICMP { $$ = Q_ICMP; }
252 | IGMP { $$ = Q_IGMP; }
253 | IGRP { $$ = Q_IGRP; }
254 | PIM { $$ = Q_PIM; }
255 | ATALK { $$ = Q_ATALK; }
256 | DECNET { $$ = Q_DECNET; }
257 | LAT { $$ = Q_LAT; }
258 | SCA { $$ = Q_SCA; }
259 | MOPDL { $$ = Q_MOPDL; }
260 | MOPRC { $$ = Q_MOPRC; }
261 | IPV6 { $$ = Q_IPV6; }
262 | ICMPV6 { $$ = Q_ICMPV6; }
263 | AH { $$ = Q_AH; }
264 | ESP { $$ = Q_ESP; }
265 | ISO { $$ = Q_ISO; }
266 | ESIS { $$ = Q_ESIS; }
267 | ISIS { $$ = Q_ISIS; }
268 ;
269other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
270 | pqual TK_MULTICAST { $$ = gen_multicast($1); }
271 | LESS NUM { $$ = gen_less($2); }
272 | GREATER NUM { $$ = gen_greater($2); }
--- 39 unchanged lines hidden ---
2/*
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)
--- 5 unchanged lines hidden (view full) ---
14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
17 * written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 * $FreeBSD: head/contrib/libpcap/grammar.y 56891 2000-01-30 00:43:38Z fenner $
23 */
24#ifndef lint
25static const char rcsid[] =
26 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.57 1999/10/19 15:18:30 itojun Exp $ (LBL)";
27#endif
28
29#include <sys/types.h>
30#include <sys/time.h>
31#include <sys/socket.h>
32
33#if __STDC__
34struct mbuf;
--- 63 unchanged lines hidden (view full) ---
98%type <blk> head
99%type <i> pqual dqual aqual ndaqual
100%type <a> arth narth
101%type <i> byteop pname pnum relop irelop
102%type <blk> and or paren not null prog
103%type <rblk> other
104
105%token DST SRC HOST GATEWAY
106%token NET MASK PORT LESS GREATER PROTO PROTOCHAIN BYTE
107%token ARP RARP IP TCP UDP ICMP IGMP IGRP PIM
108%token ATALK DECNET LAT SCA MOPRC MOPDL
109%token TK_BROADCAST TK_MULTICAST
110%token NUM INBOUND OUTBOUND
111%token LINK
112%token GEQ LEQ NEQ
113%token ID EID HID HID6
114%token LSH RSH
115%token LEN
116%token ISO ESIS ISIS
117%token IPV6 ICMPV6 AH ESP
118
119%type <s> ID
120%type <e> EID
121%type <s> HID HID6
122%type <i> NUM
123
124%left OR AND
125%nonassoc '!'
126%left '|'
127%left '&'
128%left LSH RSH
129%left '+' '-'
--- 35 unchanged lines hidden (view full) ---
165 case Q_DECNET:
166 $$.b = gen_ncode($1, 0, $$.q);
167 break;
168 default:
169 $$.b = gen_ncode($1, 0, $$.q);
170 break;
171 }
172 }
173 | HID6 '/' NUM {
174#ifdef INET6
175 $$.b = gen_mcode6($1, NULL, $3,
176 $$.q = $<blk>0.q);
177#else
178 bpf_error("'ip6addr/prefixlen' not supported "
179 "in this configuration");
180#endif /*INET6*/
181 }
182 | HID6 {
183#ifdef INET6
184 $$.b = gen_mcode6($1, 0, 128,
185 $$.q = $<blk>0.q);
186#else
187 bpf_error("'ip6addr' not supported "
188 "in this configuration");
189#endif /*INET6*/
190 }
191 | EID { $$.b = gen_ecode($1, $$.q = $<blk>0.q); }
192 | not id { gen_not($2.b); $$ = $2; }
193 ;
194not: '!' { $$ = $<blk>0; }
195 ;
196paren: '(' { $$ = $<blk>0; }
197 ;
198pid: nid
--- 6 unchanged lines hidden (view full) ---
205 ;
206term: rterm
207 | not term { gen_not($2.b); $$ = $2; }
208 ;
209head: pqual dqual aqual { QSET($$.q, $1, $2, $3); }
210 | pqual dqual { QSET($$.q, $1, $2, Q_DEFAULT); }
211 | pqual aqual { QSET($$.q, $1, Q_DEFAULT, $2); }
212 | pqual PROTO { QSET($$.q, $1, Q_DEFAULT, Q_PROTO); }
213 | pqual PROTOCHAIN { QSET($$.q, $1, Q_DEFAULT, Q_PROTOCHAIN); }
214 | pqual ndaqual { QSET($$.q, $1, Q_DEFAULT, $2); }
215 ;
216rterm: head id { $$ = $2; }
217 | paren expr ')' { $$.b = $2.b; $$.q = $1.q; }
218 | pname { $$.b = gen_proto_abbrev($1); $$.q = qerr; }
219 | arth relop arth { $$.b = gen_relation($2, $1, $3, 0);
220 $$.q = qerr; }
221 | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1);
--- 24 unchanged lines hidden (view full) ---
246 | IP { $$ = Q_IP; }
247 | ARP { $$ = Q_ARP; }
248 | RARP { $$ = Q_RARP; }
249 | TCP { $$ = Q_TCP; }
250 | UDP { $$ = Q_UDP; }
251 | ICMP { $$ = Q_ICMP; }
252 | IGMP { $$ = Q_IGMP; }
253 | IGRP { $$ = Q_IGRP; }
254 | PIM { $$ = Q_PIM; }
255 | ATALK { $$ = Q_ATALK; }
256 | DECNET { $$ = Q_DECNET; }
257 | LAT { $$ = Q_LAT; }
258 | SCA { $$ = Q_SCA; }
259 | MOPDL { $$ = Q_MOPDL; }
260 | MOPRC { $$ = Q_MOPRC; }
261 | IPV6 { $$ = Q_IPV6; }
262 | ICMPV6 { $$ = Q_ICMPV6; }
263 | AH { $$ = Q_AH; }
264 | ESP { $$ = Q_ESP; }
265 | ISO { $$ = Q_ISO; }
266 | ESIS { $$ = Q_ESIS; }
267 | ISIS { $$ = Q_ISIS; }
268 ;
269other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
270 | pqual TK_MULTICAST { $$ = gen_multicast($1); }
271 | LESS NUM { $$ = gen_less($2); }
272 | GREATER NUM { $$ = gen_greater($2); }
--- 39 unchanged lines hidden ---