3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
4 * The Regents of the University of California. All rights reserved.
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)
9 * distributions including binary code include the above copyright notice and
10 * this paragraph in its entirety in the documentation or other materials
11 * provided with the distribution, and (3) all advertising materials mentioning
12 * features or use of this software display the following acknowledgement:
13 * ``This product includes software developed by the University of California,
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
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.
24 static const char rcsid
[] _U_
=
25 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.101 2007-11-18 02:03:52 guy Exp $ (LBL)";
33 #include <pcap-stdinc.h>
35 #include <sys/types.h>
36 #include <sys/socket.h>
47 #include <netinet/in.h>
48 #include <arpa/inet.h>
56 #ifdef HAVE_NET_PFVAR_H
58 #include <net/pfvar.h>
59 #include <net/if_pflog.h>
61 #include "ieee80211.h"
62 #include <pcap/namedb.h>
64 #ifdef HAVE_OS_PROTO_H
68 #define QSET(q, p, d, a) (q).proto = (p),\
74 const char *s
; /* string */
77 static const struct tok ieee80211_types
[] = {
78 { IEEE80211_FC0_TYPE_DATA
, "data" },
79 { IEEE80211_FC0_TYPE_MGT
, "mgt" },
80 { IEEE80211_FC0_TYPE_MGT
, "management" },
81 { IEEE80211_FC0_TYPE_CTL
, "ctl" },
82 { IEEE80211_FC0_TYPE_CTL
, "control" },
85 static const struct tok ieee80211_mgt_subtypes
[] = {
86 { IEEE80211_FC0_SUBTYPE_ASSOC_REQ
, "assocreq" },
87 { IEEE80211_FC0_SUBTYPE_ASSOC_REQ
, "assoc-req" },
88 { IEEE80211_FC0_SUBTYPE_ASSOC_RESP
, "assocresp" },
89 { IEEE80211_FC0_SUBTYPE_ASSOC_RESP
, "assoc-resp" },
90 { IEEE80211_FC0_SUBTYPE_REASSOC_REQ
, "reassocreq" },
91 { IEEE80211_FC0_SUBTYPE_REASSOC_REQ
, "reassoc-req" },
92 { IEEE80211_FC0_SUBTYPE_REASSOC_RESP
, "reassocresp" },
93 { IEEE80211_FC0_SUBTYPE_REASSOC_RESP
, "reassoc-resp" },
94 { IEEE80211_FC0_SUBTYPE_PROBE_REQ
, "probereq" },
95 { IEEE80211_FC0_SUBTYPE_PROBE_REQ
, "probe-req" },
96 { IEEE80211_FC0_SUBTYPE_PROBE_RESP
, "proberesp" },
97 { IEEE80211_FC0_SUBTYPE_PROBE_RESP
, "probe-resp" },
98 { IEEE80211_FC0_SUBTYPE_BEACON
, "beacon" },
99 { IEEE80211_FC0_SUBTYPE_ATIM
, "atim" },
100 { IEEE80211_FC0_SUBTYPE_DISASSOC
, "disassoc" },
101 { IEEE80211_FC0_SUBTYPE_DISASSOC
, "disassociation" },
102 { IEEE80211_FC0_SUBTYPE_AUTH
, "auth" },
103 { IEEE80211_FC0_SUBTYPE_AUTH
, "authentication" },
104 { IEEE80211_FC0_SUBTYPE_DEAUTH
, "deauth" },
105 { IEEE80211_FC0_SUBTYPE_DEAUTH
, "deauthentication" },
108 static const struct tok ieee80211_ctl_subtypes
[] = {
109 { IEEE80211_FC0_SUBTYPE_PS_POLL
, "ps-poll" },
110 { IEEE80211_FC0_SUBTYPE_RTS
, "rts" },
111 { IEEE80211_FC0_SUBTYPE_CTS
, "cts" },
112 { IEEE80211_FC0_SUBTYPE_ACK
, "ack" },
113 { IEEE80211_FC0_SUBTYPE_CF_END
, "cf-end" },
114 { IEEE80211_FC0_SUBTYPE_CF_END_ACK
, "cf-end-ack" },
117 static const struct tok ieee80211_data_subtypes
[] = {
118 { IEEE80211_FC0_SUBTYPE_DATA
, "data" },
119 { IEEE80211_FC0_SUBTYPE_CF_ACK
, "data-cf-ack" },
120 { IEEE80211_FC0_SUBTYPE_CF_POLL
, "data-cf-poll" },
121 { IEEE80211_FC0_SUBTYPE_CF_ACPL
, "data-cf-ack-poll" },
122 { IEEE80211_FC0_SUBTYPE_NODATA
, "null" },
123 { IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK
, "cf-ack" },
124 { IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL
, "cf-poll" },
125 { IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL
, "cf-ack-poll" },
126 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_DATA
, "qos-data" },
127 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_ACK
, "qos-data-cf-ack" },
128 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_POLL
, "qos-data-cf-poll" },
129 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_ACPL
, "qos-data-cf-ack-poll" },
130 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA
, "qos" },
131 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL
, "qos-cf-poll" },
132 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL
, "qos-cf-ack-poll" },
137 const struct tok
*tok
;
139 static const struct type2tok ieee80211_type_subtypes
[] = {
140 { IEEE80211_FC0_TYPE_MGT
, ieee80211_mgt_subtypes
},
141 { IEEE80211_FC0_TYPE_CTL
, ieee80211_ctl_subtypes
},
142 { IEEE80211_FC0_TYPE_DATA
, ieee80211_data_subtypes
},
147 str2tok
(const char *str
, const struct tok
*toks
)
151 for
(i
= 0; toks
[i
].s
!= NULL
; i
++) {
152 if
(pcap_strcasecmp
(toks
[i
].s
, str
) == 0)
160 static struct qual qerr
= { Q_UNDEF
, Q_UNDEF
, Q_UNDEF
, Q_UNDEF
};
163 yyerror(const char *msg
)
166 bpf_error
("%s", msg
);
180 #ifdef HAVE_NET_PFVAR_H
182 pfreason_to_num
(const char *reason
)
184 const char *reasons
[] = PFRES_NAMES
;
187 for
(i
= 0; reasons
[i
]; i
++) {
188 if
(pcap_strcasecmp
(reason
, reasons
[i
]) == 0)
191 bpf_error
("unknown PF reason");
196 pfaction_to_num
(const char *action
)
198 if
(pcap_strcasecmp
(action
, "pass") == 0 ||
199 pcap_strcasecmp
(action
, "accept") == 0)
201 else if
(pcap_strcasecmp
(action
, "drop") == 0 ||
202 pcap_strcasecmp
(action
, "block") == 0)
204 #if HAVE_PF_NAT_THROUGH_PF_NORDR
205 else if
(pcap_strcasecmp
(action
, "rdr") == 0)
207 else if
(pcap_strcasecmp
(action
, "nat") == 0)
209 else if
(pcap_strcasecmp
(action
, "binat") == 0)
211 else if
(pcap_strcasecmp
(action
, "nordr") == 0)
215 bpf_error
("unknown PF action");
219 #else /* !HAVE_NET_PFVAR_H */
221 pfreason_to_num
(const char *reason
)
223 bpf_error
("libpcap was compiled on a machine without pf support");
226 /* this is to make the VC compiler happy */
231 pfaction_to_num
(const char *action
)
233 bpf_error
("libpcap was compiled on a machine without pf support");
236 /* this is to make the VC compiler happy */
239 #endif /* HAVE_NET_PFVAR_H */
258 %type
<blk
> expr id nid pid term rterm qid
260 %type
<i
> pqual dqual aqual ndaqual
262 %type
<i
> byteop pname pnum relop irelop
263 %type
<blk
> and or paren not null prog
264 %type
<rblk
> other pfvar p80211
265 %type
<i
> atmtype atmmultitype
267 %type
<blk
> atmfieldvalue atmvalue atmlistvalue
269 %type
<blk
> mtp3field
270 %type
<blk
> mtp3fieldvalue mtp3value mtp3listvalue
273 %token DST SRC HOST GATEWAY
274 %token NET NETMASK PORT PORTRANGE LESS GREATER PROTO PROTOCHAIN CBYTE
275 %token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP CARP
276 %token ATALK AARP DECNET LAT SCA MOPRC MOPDL
277 %token TK_BROADCAST TK_MULTICAST
278 %token NUM INBOUND OUTBOUND
279 %token PF_IFNAME PF_RSET PF_RNR PF_SRNR PF_REASON PF_ACTION
280 %token TYPE SUBTYPE
DIR ADDR1 ADDR2 ADDR3 ADDR4 RA TA
283 %token ID EID HID HID6 AID
286 %token IPV6 ICMPV6 AH ESP
289 %token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP
293 %token LANE LLC METAC BCC SC ILMIC OAMF4EC OAMF4SC
294 %token OAM OAMF4 CONNECTMSG METACONNECT
298 %token SIO OPC DPC SLS
304 %type
<i
> NUM action reason type subtype type_subtype dir
321 null: /* null */ { $$.q
= qerr
; }
324 | expr and term
{ gen_and
($1.b
, $3.b
); $$
= $3; }
325 | expr and id
{ gen_and
($1.b
, $3.b
); $$
= $3; }
326 | expr or term
{ gen_or
($1.b
, $3.b
); $$
= $3; }
327 | expr or id
{ gen_or
($1.b
, $3.b
); $$
= $3; }
329 and: AND
{ $$
= $
<blk
>0; }
331 or: OR
{ $$
= $
<blk
>0; }
334 | pnum
{ $$.b
= gen_ncode
(NULL
, (bpf_u_int32
)$1,
336 | paren pid
')' { $$
= $2; }
338 nid: ID
{ $$.b
= gen_scode
($1, $$.q
= $
<blk
>0.q
); }
339 | HID
'/' NUM
{ $$.b
= gen_mcode
($1, NULL
, $3,
341 | HID NETMASK HID
{ $$.b
= gen_mcode
($1, $3, 0,
344 /* Decide how to parse HID based on proto */
346 if
($$.q.addr
== Q_PORT
)
347 bpf_error
("'port' modifier applied to ip host");
348 else if
($$.q.addr
== Q_PORTRANGE
)
349 bpf_error
("'portrange' modifier applied to ip host");
350 else if
($$.q.addr
== Q_PROTO
)
351 bpf_error
("'proto' modifier applied to ip host");
352 else if
($$.q.addr
== Q_PROTOCHAIN
)
353 bpf_error
("'protochain' modifier applied to ip host");
354 $$.b
= gen_ncode
($1, 0, $$.q
);
358 $$.b
= gen_mcode6
($1, NULL
, $3,
361 bpf_error
("'ip6addr/prefixlen' not supported "
362 "in this configuration");
367 $$.b
= gen_mcode6
($1, 0, 128,
370 bpf_error
("'ip6addr' not supported "
371 "in this configuration");
375 $$.b
= gen_ecode
($1, $$.q
= $
<blk
>0.q
);
377 * $1 was allocated by "pcap_ether_aton()",
378 * so we must free it now that we're done
384 $$.b
= gen_acode
($1, $$.q
= $
<blk
>0.q
);
386 * $1 was allocated by "pcap_ether_aton()",
387 * so we must free it now that we're done
392 | not id
{ gen_not
($2.b
); $$
= $2; }
394 not: '!' { $$
= $
<blk
>0; }
396 paren: '(' { $$
= $
<blk
>0; }
399 | qid and id
{ gen_and
($1.b
, $3.b
); $$
= $3; }
400 | qid or id
{ gen_or
($1.b
, $3.b
); $$
= $3; }
402 qid: pnum
{ $$.b
= gen_ncode
(NULL
, (bpf_u_int32
)$1,
407 | not term
{ gen_not
($2.b
); $$
= $2; }
409 head: pqual dqual aqual
{ QSET
($$.q
, $1, $2, $3); }
410 | pqual dqual
{ QSET
($$.q
, $1, $2, Q_DEFAULT
); }
411 | pqual aqual
{ QSET
($$.q
, $1, Q_DEFAULT
, $2); }
412 | pqual PROTO
{ QSET
($$.q
, $1, Q_DEFAULT
, Q_PROTO
); }
413 | pqual PROTOCHAIN
{ QSET
($$.q
, $1, Q_DEFAULT
, Q_PROTOCHAIN
); }
414 | pqual ndaqual
{ QSET
($$.q
, $1, Q_DEFAULT
, $2); }
416 rterm: head id
{ $$
= $2; }
417 | paren expr
')' { $$.b
= $2.b
; $$.q
= $1.q
; }
418 | pname
{ $$.b
= gen_proto_abbrev
($1); $$.q
= qerr
; }
419 | arth relop arth
{ $$.b
= gen_relation
($2, $1, $3, 0);
421 | arth irelop arth
{ $$.b
= gen_relation
($2, $1, $3, 1);
423 | other
{ $$.b
= $1; $$.q
= qerr
; }
424 | atmtype
{ $$.b
= gen_atmtype_abbrev
($1); $$.q
= qerr
; }
425 | atmmultitype
{ $$.b
= gen_atmmulti_abbrev
($1); $$.q
= qerr
; }
426 | atmfield atmvalue
{ $$.b
= $2.b
; $$.q
= qerr
; }
427 | mtp2type
{ $$.b
= gen_mtp2type_abbrev
($1); $$.q
= qerr
; }
428 | mtp3field mtp3value
{ $$.b
= $2.b
; $$.q
= qerr
; }
430 /* protocol level qualifiers */
432 |
{ $$
= Q_DEFAULT
; }
434 /* 'direction' qualifiers */
435 dqual: SRC
{ $$
= Q_SRC
; }
436 | DST
{ $$
= Q_DST
; }
437 | SRC OR DST
{ $$
= Q_OR
; }
438 | DST OR SRC
{ $$
= Q_OR
; }
439 | SRC AND DST
{ $$
= Q_AND
; }
440 | DST AND SRC
{ $$
= Q_AND
; }
441 | ADDR1
{ $$
= Q_ADDR1
; }
442 | ADDR2
{ $$
= Q_ADDR2
; }
443 | ADDR3
{ $$
= Q_ADDR3
; }
444 | ADDR4
{ $$
= Q_ADDR4
; }
448 /* address type qualifiers */
449 aqual: HOST
{ $$
= Q_HOST
; }
450 | NET
{ $$
= Q_NET
; }
451 | PORT
{ $$
= Q_PORT
; }
452 | PORTRANGE
{ $$
= Q_PORTRANGE
; }
454 /* non-directional address type qualifiers */
455 ndaqual: GATEWAY
{ $$
= Q_GATEWAY
; }
457 pname: LINK
{ $$
= Q_LINK
; }
459 | ARP
{ $$
= Q_ARP
; }
460 | RARP
{ $$
= Q_RARP
; }
461 | SCTP
{ $$
= Q_SCTP
; }
462 | TCP
{ $$
= Q_TCP
; }
463 | UDP
{ $$
= Q_UDP
; }
464 | ICMP
{ $$
= Q_ICMP
; }
465 | IGMP
{ $$
= Q_IGMP
; }
466 | IGRP
{ $$
= Q_IGRP
; }
467 | PIM
{ $$
= Q_PIM
; }
468 | VRRP
{ $$
= Q_VRRP
; }
469 | CARP
{ $$
= Q_CARP
; }
470 | ATALK
{ $$
= Q_ATALK
; }
471 | AARP
{ $$
= Q_AARP
; }
472 | DECNET
{ $$
= Q_DECNET
; }
473 | LAT
{ $$
= Q_LAT
; }
474 | SCA
{ $$
= Q_SCA
; }
475 | MOPDL
{ $$
= Q_MOPDL
; }
476 | MOPRC
{ $$
= Q_MOPRC
; }
477 | IPV6
{ $$
= Q_IPV6
; }
478 | ICMPV6
{ $$
= Q_ICMPV6
; }
480 | ESP
{ $$
= Q_ESP
; }
481 | ISO
{ $$
= Q_ISO
; }
482 | ESIS
{ $$
= Q_ESIS
; }
483 | ISIS
{ $$
= Q_ISIS
; }
484 | L1
{ $$
= Q_ISIS_L1
; }
485 | L2
{ $$
= Q_ISIS_L2
; }
486 | IIH
{ $$
= Q_ISIS_IIH
; }
487 | LSP
{ $$
= Q_ISIS_LSP
; }
488 | SNP
{ $$
= Q_ISIS_SNP
; }
489 | PSNP
{ $$
= Q_ISIS_PSNP
; }
490 | CSNP
{ $$
= Q_ISIS_CSNP
; }
491 | CLNP
{ $$
= Q_CLNP
; }
492 | STP
{ $$
= Q_STP
; }
493 | IPX
{ $$
= Q_IPX
; }
494 | NETBEUI
{ $$
= Q_NETBEUI
; }
495 | RADIO
{ $$
= Q_RADIO
; }
497 other: pqual TK_BROADCAST
{ $$
= gen_broadcast
($1); }
498 | pqual TK_MULTICAST
{ $$
= gen_multicast
($1); }
499 | LESS NUM
{ $$
= gen_less
($2); }
500 | GREATER NUM
{ $$
= gen_greater
($2); }
501 | CBYTE NUM byteop NUM
{ $$
= gen_byteop
($3, $2, $4); }
502 | INBOUND
{ $$
= gen_inbound
(0); }
503 | OUTBOUND
{ $$
= gen_inbound
(1); }
504 | VLAN pnum
{ $$
= gen_vlan
($2); }
505 | VLAN
{ $$
= gen_vlan
(-1); }
506 | MPLS pnum
{ $$
= gen_mpls
($2); }
507 | MPLS
{ $$
= gen_mpls
(-1); }
508 | PPPOED
{ $$
= gen_pppoed
(); }
509 | PPPOES
{ $$
= gen_pppoes
(); }
511 | pqual p80211
{ $$
= $2; }
514 pfvar: PF_IFNAME ID
{ $$
= gen_pf_ifname
($2); }
515 | PF_RSET ID
{ $$
= gen_pf_ruleset
($2); }
516 | PF_RNR NUM
{ $$
= gen_pf_rnr
($2); }
517 | PF_SRNR NUM
{ $$
= gen_pf_srnr
($2); }
518 | PF_REASON reason
{ $$
= gen_pf_reason
($2); }
519 | PF_ACTION action
{ $$
= gen_pf_action
($2); }
522 p80211: TYPE type SUBTYPE subtype
523 { $$
= gen_p80211_type
($2 |
$4,
524 IEEE80211_FC0_TYPE_MASK |
525 IEEE80211_FC0_SUBTYPE_MASK
);
527 | TYPE type
{ $$
= gen_p80211_type
($2,
528 IEEE80211_FC0_TYPE_MASK
);
530 | SUBTYPE type_subtype
{ $$
= gen_p80211_type
($2,
531 IEEE80211_FC0_TYPE_MASK |
532 IEEE80211_FC0_SUBTYPE_MASK
);
534 |
DIR dir
{ $$
= gen_p80211_fcdir
($2); }
538 | ID
{ $$
= str2tok
($1, ieee80211_types
);
540 bpf_error
("unknown 802.11 type name");
545 | ID
{ const struct tok
*types
= NULL
;
548 if
(ieee80211_type_subtypes
[i
].tok
== NULL
) {
549 /* Ran out of types */
550 bpf_error
("unknown 802.11 type");
553 if
($
<i
>-1 == ieee80211_type_subtypes
[i
].type
) {
554 types
= ieee80211_type_subtypes
[i
].tok
;
559 $$
= str2tok
($1, types
);
561 bpf_error
("unknown 802.11 subtype name");
565 type_subtype: ID
{ int i
;
567 if
(ieee80211_type_subtypes
[i
].tok
== NULL
) {
568 /* Ran out of types */
569 bpf_error
("unknown 802.11 type name");
572 $$
= str2tok
($1, ieee80211_type_subtypes
[i
].tok
);
574 $$ |
= ieee80211_type_subtypes
[i
].type
;
582 | ID
{ if
(pcap_strcasecmp
($1, "nods") == 0)
583 $$
= IEEE80211_FC1_DIR_NODS
;
584 else if
(pcap_strcasecmp
($1, "tods") == 0)
585 $$
= IEEE80211_FC1_DIR_TODS
;
586 else if
(pcap_strcasecmp
($1, "fromds") == 0)
587 $$
= IEEE80211_FC1_DIR_FROMDS
;
588 else if
(pcap_strcasecmp
($1, "dstods") == 0)
589 $$
= IEEE80211_FC1_DIR_DSTODS
;
591 bpf_error
("unknown 802.11 direction");
595 reason: NUM
{ $$
= $1; }
596 | ID
{ $$
= pfreason_to_num
($1); }
599 action: ID
{ $$
= pfaction_to_num
($1); }
602 relop: '>' { $$
= BPF_JGT
; }
603 | GEQ
{ $$
= BPF_JGE
; }
604 |
'=' { $$
= BPF_JEQ
; }
606 irelop: LEQ
{ $$
= BPF_JGT
; }
607 |
'<' { $$
= BPF_JGE
; }
608 | NEQ
{ $$
= BPF_JEQ
; }
610 arth: pnum
{ $$
= gen_loadi
($1); }
613 narth: pname
'[' arth
']' { $$
= gen_load
($1, $3, 1); }
614 | pname
'[' arth
':' NUM
']' { $$
= gen_load
($1, $3, $5); }
615 | arth
'+' arth
{ $$
= gen_arth
(BPF_ADD
, $1, $3); }
616 | arth
'-' arth
{ $$
= gen_arth
(BPF_SUB
, $1, $3); }
617 | arth
'*' arth
{ $$
= gen_arth
(BPF_MUL
, $1, $3); }
618 | arth
'/' arth
{ $$
= gen_arth
(BPF_DIV
, $1, $3); }
619 | arth
'&' arth
{ $$
= gen_arth
(BPF_AND
, $1, $3); }
620 | arth
'|' arth
{ $$
= gen_arth
(BPF_OR
, $1, $3); }
621 | arth LSH arth
{ $$
= gen_arth
(BPF_LSH
, $1, $3); }
622 | arth RSH arth
{ $$
= gen_arth
(BPF_RSH
, $1, $3); }
623 |
'-' arth %prec UMINUS
{ $$
= gen_neg
($2); }
624 | paren narth
')' { $$
= $2; }
625 | LEN
{ $$
= gen_loadlen
(); }
627 byteop: '&' { $$
= '&'; }
634 | paren pnum
')' { $$
= $2; }
636 atmtype: LANE
{ $$
= A_LANE
; }
637 | LLC
{ $$
= A_LLC
; }
638 | METAC
{ $$
= A_METAC
; }
639 | BCC
{ $$
= A_BCC
; }
640 | OAMF4EC
{ $$
= A_OAMF4EC
; }
641 | OAMF4SC
{ $$
= A_OAMF4SC
; }
643 | ILMIC
{ $$
= A_ILMIC
; }
645 atmmultitype: OAM
{ $$
= A_OAM
; }
646 | OAMF4
{ $$
= A_OAMF4
; }
647 | CONNECTMSG
{ $$
= A_CONNECTMSG
; }
648 | METACONNECT
{ $$
= A_METACONNECT
; }
650 /* ATM field types quantifier */
651 atmfield: VPI
{ $$.atmfieldtype
= A_VPI
; }
652 | VCI
{ $$.atmfieldtype
= A_VCI
; }
654 atmvalue: atmfieldvalue
655 | relop NUM
{ $$.b
= gen_atmfield_code
($
<blk
>0.atmfieldtype
, (bpf_int32
)$2, (bpf_u_int32
)$1, 0); }
656 | irelop NUM
{ $$.b
= gen_atmfield_code
($
<blk
>0.atmfieldtype
, (bpf_int32
)$2, (bpf_u_int32
)$1, 1); }
657 | paren atmlistvalue
')' { $$.b
= $2.b
; $$.q
= qerr
; }
660 $$.atmfieldtype
= $
<blk
>0.atmfieldtype
;
661 if
($$.atmfieldtype
== A_VPI ||
662 $$.atmfieldtype
== A_VCI
)
663 $$.b
= gen_atmfield_code
($$.atmfieldtype
, (bpf_int32
) $1, BPF_JEQ
, 0);
666 atmlistvalue: atmfieldvalue
667 | atmlistvalue or atmfieldvalue
{ gen_or
($1.b
, $3.b
); $$
= $3; }
669 /* MTP2 types quantifier */
670 mtp2type: FISU
{ $$
= M_FISU
; }
671 | LSSU
{ $$
= M_LSSU
; }
672 | MSU
{ $$
= M_MSU
; }
674 /* MTP3 field types quantifier */
675 mtp3field: SIO
{ $$.mtp3fieldtype
= M_SIO
; }
676 | OPC
{ $$.mtp3fieldtype
= M_OPC
; }
677 | DPC
{ $$.mtp3fieldtype
= M_DPC
; }
678 | SLS
{ $$.mtp3fieldtype
= M_SLS
; }
680 mtp3value: mtp3fieldvalue
681 | relop NUM
{ $$.b
= gen_mtp3field_code
($
<blk
>0.mtp3fieldtype
, (u_int
)$2, (u_int
)$1, 0); }
682 | irelop NUM
{ $$.b
= gen_mtp3field_code
($
<blk
>0.mtp3fieldtype
, (u_int
)$2, (u_int
)$1, 1); }
683 | paren mtp3listvalue
')' { $$.b
= $2.b
; $$.q
= qerr
; }
685 mtp3fieldvalue: NUM
{
686 $$.mtp3fieldtype
= $
<blk
>0.mtp3fieldtype
;
687 if
($$.mtp3fieldtype
== M_SIO ||
688 $$.mtp3fieldtype
== M_OPC ||
689 $$.mtp3fieldtype
== M_DPC ||
690 $$.mtp3fieldtype
== M_SLS
)
691 $$.b
= gen_mtp3field_code
($$.mtp3fieldtype
, (u_int
) $1, BPF_JEQ
, 0);
694 mtp3listvalue: mtp3fieldvalue
695 | mtp3listvalue or mtp3fieldvalue
{ gen_or
($1.b
, $3.b
); $$
= $3; }