grammar.y (146771) | grammar.y (147897) |
---|---|
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 * | 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 146771 2005-05-29 18:09:04Z sam $ | 22 * $FreeBSD: head/contrib/libpcap/grammar.y 147897 2005-07-11 03:43:25Z sam $ |
23 */ 24#ifndef lint 25static const char rcsid[] _U_ = | 23 */ 24#ifndef lint 25static const char rcsid[] _U_ = |
26 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86 2004/12/18 08:49:23 guy Exp $ (LBL)"; | 26 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86.2.4 2005/06/20 21:30:17 guy Exp $ (LBL)"; |
27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#ifdef WIN32 34#include <pcap-stdinc.h> --- 58 unchanged lines hidden (view full) --- 93 bpf_u_int32 h; 94 u_char *e; 95 char *s; 96 struct stmt *stmt; 97 struct arth *a; 98 struct { 99 struct qual q; 100 int atmfieldtype; | 27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#ifdef WIN32 34#include <pcap-stdinc.h> --- 58 unchanged lines hidden (view full) --- 93 bpf_u_int32 h; 94 u_char *e; 95 char *s; 96 struct stmt *stmt; 97 struct arth *a; 98 struct { 99 struct qual q; 100 int atmfieldtype; |
101 int mtp3fieldtype; |
|
101 struct block *b; 102 } blk; 103 struct block *rblk; 104} 105 106%type <blk> expr id nid pid term rterm qid 107%type <blk> head 108%type <i> pqual dqual aqual ndaqual 109%type <a> arth narth 110%type <i> byteop pname pnum relop irelop 111%type <blk> and or paren not null prog 112%type <rblk> other pfvar 113%type <i> atmtype atmmultitype 114%type <blk> atmfield 115%type <blk> atmfieldvalue atmvalue atmlistvalue | 102 struct block *b; 103 } blk; 104 struct block *rblk; 105} 106 107%type <blk> expr id nid pid term rterm qid 108%type <blk> head 109%type <i> pqual dqual aqual ndaqual 110%type <a> arth narth 111%type <i> byteop pname pnum relop irelop 112%type <blk> and or paren not null prog 113%type <rblk> other pfvar 114%type <i> atmtype atmmultitype 115%type <blk> atmfield 116%type <blk> atmfieldvalue atmvalue atmlistvalue |
117%type <blk> mtp3field 118%type <blk> mtp3fieldvalue mtp3value mtp3listvalue |
|
116 | 119 |
120 |
|
117%token DST SRC HOST GATEWAY | 121%token DST SRC HOST GATEWAY |
118%token NET NETMASK PORT LESS GREATER PROTO PROTOCHAIN CBYTE | 122%token NET NETMASK PORT PORTRANGE LESS GREATER PROTO PROTOCHAIN CBYTE |
119%token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP 120%token ATALK AARP DECNET LAT SCA MOPRC MOPDL 121%token TK_BROADCAST TK_MULTICAST 122%token NUM INBOUND OUTBOUND 123%token PF_IFNAME PF_RSET PF_RNR PF_SRNR PF_REASON PF_ACTION 124%token LINK 125%token GEQ LEQ NEQ 126%token ID EID HID HID6 AID 127%token LSH RSH 128%token LEN 129%token IPV6 ICMPV6 AH ESP 130%token VLAN MPLS 131%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP 132%token STP 133%token IPX 134%token NETBEUI 135%token LANE LLC METAC BCC SC ILMIC OAMF4EC OAMF4SC 136%token OAM OAMF4 CONNECTMSG METACONNECT 137%token VPI VCI | 123%token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP 124%token ATALK AARP DECNET LAT SCA MOPRC MOPDL 125%token TK_BROADCAST TK_MULTICAST 126%token NUM INBOUND OUTBOUND 127%token PF_IFNAME PF_RSET PF_RNR PF_SRNR PF_REASON PF_ACTION 128%token LINK 129%token GEQ LEQ NEQ 130%token ID EID HID HID6 AID 131%token LSH RSH 132%token LEN 133%token IPV6 ICMPV6 AH ESP 134%token VLAN MPLS 135%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP 136%token STP 137%token IPX 138%token NETBEUI 139%token LANE LLC METAC BCC SC ILMIC OAMF4EC OAMF4SC 140%token OAM OAMF4 CONNECTMSG METACONNECT 141%token VPI VCI |
142%token RADIO 143%token SIO OPC DPC SLS |
|
138 139%type <s> ID 140%type <e> EID 141%type <e> AID 142%type <s> HID HID6 143%type <i> NUM action reason 144 145%left OR AND --- 104 unchanged lines hidden (view full) --- 250 | arth relop arth { $$.b = gen_relation($2, $1, $3, 0); 251 $$.q = qerr; } 252 | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1); 253 $$.q = qerr; } 254 | other { $$.b = $1; $$.q = qerr; } 255 | atmtype { $$.b = gen_atmtype_abbrev($1); $$.q = qerr; } 256 | atmmultitype { $$.b = gen_atmmulti_abbrev($1); $$.q = qerr; } 257 | atmfield atmvalue { $$.b = $2.b; $$.q = qerr; } | 144 145%type <s> ID 146%type <e> EID 147%type <e> AID 148%type <s> HID HID6 149%type <i> NUM action reason 150 151%left OR AND --- 104 unchanged lines hidden (view full) --- 256 | arth relop arth { $$.b = gen_relation($2, $1, $3, 0); 257 $$.q = qerr; } 258 | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1); 259 $$.q = qerr; } 260 | other { $$.b = $1; $$.q = qerr; } 261 | atmtype { $$.b = gen_atmtype_abbrev($1); $$.q = qerr; } 262 | atmmultitype { $$.b = gen_atmmulti_abbrev($1); $$.q = qerr; } 263 | atmfield atmvalue { $$.b = $2.b; $$.q = qerr; } |
264 | mtp3field mtp3value { $$.b = $2.b; $$.q = qerr; } |
|
258 ; 259/* protocol level qualifiers */ 260pqual: pname 261 | { $$ = Q_DEFAULT; } 262 ; 263/* 'direction' qualifiers */ 264dqual: SRC { $$ = Q_SRC; } 265 | DST { $$ = Q_DST; } 266 | SRC OR DST { $$ = Q_OR; } 267 | DST OR SRC { $$ = Q_OR; } 268 | SRC AND DST { $$ = Q_AND; } 269 | DST AND SRC { $$ = Q_AND; } 270 ; 271/* address type qualifiers */ 272aqual: HOST { $$ = Q_HOST; } 273 | NET { $$ = Q_NET; } 274 | PORT { $$ = Q_PORT; } | 265 ; 266/* protocol level qualifiers */ 267pqual: pname 268 | { $$ = Q_DEFAULT; } 269 ; 270/* 'direction' qualifiers */ 271dqual: SRC { $$ = Q_SRC; } 272 | DST { $$ = Q_DST; } 273 | SRC OR DST { $$ = Q_OR; } 274 | DST OR SRC { $$ = Q_OR; } 275 | SRC AND DST { $$ = Q_AND; } 276 | DST AND SRC { $$ = Q_AND; } 277 ; 278/* address type qualifiers */ 279aqual: HOST { $$ = Q_HOST; } 280 | NET { $$ = Q_NET; } 281 | PORT { $$ = Q_PORT; } |
282 | PORTRANGE { $$ = Q_PORTRANGE; } |
|
275 ; 276/* non-directional address type qualifiers */ 277ndaqual: GATEWAY { $$ = Q_GATEWAY; } 278 ; 279pname: LINK { $$ = Q_LINK; } 280 | IP { $$ = Q_IP; } 281 | ARP { $$ = Q_ARP; } 282 | RARP { $$ = Q_RARP; } --- 25 unchanged lines hidden (view full) --- 308 | LSP { $$ = Q_ISIS_LSP; } 309 | SNP { $$ = Q_ISIS_SNP; } 310 | PSNP { $$ = Q_ISIS_PSNP; } 311 | CSNP { $$ = Q_ISIS_CSNP; } 312 | CLNP { $$ = Q_CLNP; } 313 | STP { $$ = Q_STP; } 314 | IPX { $$ = Q_IPX; } 315 | NETBEUI { $$ = Q_NETBEUI; } | 283 ; 284/* non-directional address type qualifiers */ 285ndaqual: GATEWAY { $$ = Q_GATEWAY; } 286 ; 287pname: LINK { $$ = Q_LINK; } 288 | IP { $$ = Q_IP; } 289 | ARP { $$ = Q_ARP; } 290 | RARP { $$ = Q_RARP; } --- 25 unchanged lines hidden (view full) --- 316 | LSP { $$ = Q_ISIS_LSP; } 317 | SNP { $$ = Q_ISIS_SNP; } 318 | PSNP { $$ = Q_ISIS_PSNP; } 319 | CSNP { $$ = Q_ISIS_CSNP; } 320 | CLNP { $$ = Q_CLNP; } 321 | STP { $$ = Q_STP; } 322 | IPX { $$ = Q_IPX; } 323 | NETBEUI { $$ = Q_NETBEUI; } |
324 | RADIO { $$ = Q_RADIO; } |
|
316 ; 317other: pqual TK_BROADCAST { $$ = gen_broadcast($1); } 318 | pqual TK_MULTICAST { $$ = gen_multicast($1); } 319 | LESS NUM { $$ = gen_less($2); } 320 | GREATER NUM { $$ = gen_greater($2); } 321 | CBYTE NUM byteop NUM { $$ = gen_byteop($3, $2, $4); } 322 | INBOUND { $$ = gen_inbound(0); } 323 | OUTBOUND { $$ = gen_inbound(1); } --- 85 unchanged lines hidden (view full) --- 409 | CONNECTMSG { $$ = A_CONNECTMSG; } 410 | METACONNECT { $$ = A_METACONNECT; } 411 ; 412 /* ATM field types quantifier */ 413atmfield: VPI { $$.atmfieldtype = A_VPI; } 414 | VCI { $$.atmfieldtype = A_VCI; } 415 ; 416atmvalue: atmfieldvalue | 325 ; 326other: pqual TK_BROADCAST { $$ = gen_broadcast($1); } 327 | pqual TK_MULTICAST { $$ = gen_multicast($1); } 328 | LESS NUM { $$ = gen_less($2); } 329 | GREATER NUM { $$ = gen_greater($2); } 330 | CBYTE NUM byteop NUM { $$ = gen_byteop($3, $2, $4); } 331 | INBOUND { $$ = gen_inbound(0); } 332 | OUTBOUND { $$ = gen_inbound(1); } --- 85 unchanged lines hidden (view full) --- 418 | CONNECTMSG { $$ = A_CONNECTMSG; } 419 | METACONNECT { $$ = A_METACONNECT; } 420 ; 421 /* ATM field types quantifier */ 422atmfield: VPI { $$.atmfieldtype = A_VPI; } 423 | VCI { $$.atmfieldtype = A_VCI; } 424 ; 425atmvalue: atmfieldvalue |
417 | relop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (u_int)$2, (u_int)$1, 0); } 418 | irelop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (u_int)$2, (u_int)$1, 1); } | 426 | relop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 0); } 427 | irelop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 1); } |
419 | paren atmlistvalue ')' { $$.b = $2.b; $$.q = qerr; } 420 ; 421atmfieldvalue: NUM { 422 $$.atmfieldtype = $<blk>0.atmfieldtype; 423 if ($$.atmfieldtype == A_VPI || 424 $$.atmfieldtype == A_VCI) | 428 | paren atmlistvalue ')' { $$.b = $2.b; $$.q = qerr; } 429 ; 430atmfieldvalue: NUM { 431 $$.atmfieldtype = $<blk>0.atmfieldtype; 432 if ($$.atmfieldtype == A_VPI || 433 $$.atmfieldtype == A_VCI) |
425 $$.b = gen_atmfield_code($$.atmfieldtype, (u_int) $1, BPF_JEQ, 0); | 434 $$.b = gen_atmfield_code($$.atmfieldtype, (bpf_int32) $1, BPF_JEQ, 0); |
426 } 427 ; 428atmlistvalue: atmfieldvalue 429 | atmlistvalue or atmfieldvalue { gen_or($1.b, $3.b); $$ = $3; } 430 ; | 435 } 436 ; 437atmlistvalue: atmfieldvalue 438 | atmlistvalue or atmfieldvalue { gen_or($1.b, $3.b); $$ = $3; } 439 ; |
440 /* MTP3 field types quantifier */ 441mtp3field: SIO { $$.mtp3fieldtype = M_SIO; } 442 | OPC { $$.mtp3fieldtype = M_OPC; } 443 | DPC { $$.mtp3fieldtype = M_DPC; } 444 | SLS { $$.mtp3fieldtype = M_SLS; } 445 ; 446mtp3value: mtp3fieldvalue 447 | relop NUM { $$.b = gen_mtp3field_code($<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 0); } 448 | irelop NUM { $$.b = gen_mtp3field_code($<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 1); } 449 | paren mtp3listvalue ')' { $$.b = $2.b; $$.q = qerr; } 450 ; 451mtp3fieldvalue: NUM { 452 $$.mtp3fieldtype = $<blk>0.mtp3fieldtype; 453 if ($$.mtp3fieldtype == M_SIO || 454 $$.mtp3fieldtype == M_OPC || 455 $$.mtp3fieldtype == M_DPC || 456 $$.mtp3fieldtype == M_SLS ) 457 $$.b = gen_mtp3field_code($$.mtp3fieldtype, (u_int) $1, BPF_JEQ, 0); 458 } 459 ; 460mtp3listvalue: mtp3fieldvalue 461 | mtp3listvalue or mtp3fieldvalue { gen_or($1.b, $3.b); $$ = $3; } 462 ; |
|
431%% | 463%% |