X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/283da6d7263326b4ca92c9fb7905524bb106f8a9..c82a08e93128e63ae1ca843fd6fd08e76e7eda40:/gencode.h diff --git a/gencode.h b/gencode.h index a1ad10fc..67ed0dc0 100644 --- a/gencode.h +++ b/gencode.h @@ -17,10 +17,46 @@ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* + * ATM support: + * + * Copyright (c) 1997 Yen Yen Lim and North Dakota State University + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Yen Yen Lim and + * North Dakota State University + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. * - * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.53 2001-05-10 14:48:02 fenner Exp $ (LBL) + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ +#ifndef HAVE___ATTRIBUTE__ +#define __attribute__(x) +#endif /* HAVE___ATTRIBUTE__ */ + /* Address qualifiers. */ #define Q_HOST 1 @@ -29,6 +65,7 @@ #define Q_GATEWAY 4 #define Q_PROTO 5 #define Q_PROTOCHAIN 6 +#define Q_PORTRANGE 7 /* Protocol qualifiers. */ @@ -73,16 +110,98 @@ #define Q_NETBEUI 30 +/* IS-IS Levels */ +#define Q_ISIS_L1 31 +#define Q_ISIS_L2 32 +/* PDU types */ +#define Q_ISIS_IIH 33 +#define Q_ISIS_LAN_IIH 34 +#define Q_ISIS_PTP_IIH 35 +#define Q_ISIS_SNP 36 +#define Q_ISIS_CSNP 37 +#define Q_ISIS_PSNP 38 +#define Q_ISIS_LSP 39 + +#define Q_RADIO 40 + +#define Q_CARP 41 + /* Directional qualifiers. */ #define Q_SRC 1 #define Q_DST 2 #define Q_OR 3 #define Q_AND 4 +#define Q_ADDR1 5 +#define Q_ADDR2 6 +#define Q_ADDR3 7 +#define Q_ADDR4 8 +#define Q_RA 9 +#define Q_TA 10 #define Q_DEFAULT 0 #define Q_UNDEF 255 +/* ATM types */ +#define A_METAC 22 /* Meta signalling Circuit */ +#define A_BCC 23 /* Broadcast Circuit */ +#define A_OAMF4SC 24 /* Segment OAM F4 Circuit */ +#define A_OAMF4EC 25 /* End-to-End OAM F4 Circuit */ +#define A_SC 26 /* Signalling Circuit*/ +#define A_ILMIC 27 /* ILMI Circuit */ +#define A_OAM 28 /* OAM cells : F4 only */ +#define A_OAMF4 29 /* OAM F4 cells: Segment + End-to-end */ +#define A_LANE 30 /* LANE traffic */ +#define A_LLC 31 /* LLC-encapsulated traffic */ + +/* Based on Q.2931 signalling protocol */ +#define A_SETUP 41 /* Setup message */ +#define A_CALLPROCEED 42 /* Call proceeding message */ +#define A_CONNECT 43 /* Connect message */ +#define A_CONNECTACK 44 /* Connect Ack message */ +#define A_RELEASE 45 /* Release message */ +#define A_RELEASE_DONE 46 /* Release message */ + +/* ATM field types */ +#define A_VPI 51 +#define A_VCI 52 +#define A_PROTOTYPE 53 +#define A_MSGTYPE 54 +#define A_CALLREFTYPE 55 + +#define A_CONNECTMSG 70 /* returns Q.2931 signalling messages for + establishing and destroying switched + virtual connection */ +#define A_METACONNECT 71 /* returns Q.2931 signalling messages for + establishing and destroying predefined + virtual circuits, such as broadcast + circuit, oamf4 segment circuit, oamf4 + end-to-end circuits, ILMI circuits or + connection signalling circuit. */ + +/* MTP2 types */ +#define M_FISU 22 /* FISU */ +#define M_LSSU 23 /* LSSU */ +#define M_MSU 24 /* MSU */ + +/* MTP2 HSL types */ +#define MH_FISU 25 /* FISU for HSL */ +#define MH_LSSU 26 /* LSSU */ +#define MH_MSU 27 /* MSU */ + +/* MTP3 field types */ +#define M_SIO 1 +#define M_OPC 2 +#define M_DPC 3 +#define M_SLS 4 + +/* MTP3 field types in case of MTP2 HSL */ +#define MH_SIO 5 +#define MH_OPC 6 +#define MH_DPC 7 +#define MH_SLS 8 + + struct slist; struct stmt { @@ -97,7 +216,7 @@ struct slist { struct slist *next; }; -/* +/* * A bit vector to represent definition sets. We assume TOT_REGISTERS * is smaller than 8*sizeof(atomset). */ @@ -130,8 +249,8 @@ struct block { struct slist *stmts; /* side effect stmts */ struct stmt s; /* branch stmt */ int mark; - int longjt; /* jt branch requires long jump */ - int longjf; /* jf branch requires long jump */ + u_int longjt; /* jt branch requires long jump */ + u_int longjf; /* jf branch requires long jump */ int level; int offset; int sense; @@ -175,9 +294,9 @@ void gen_not(struct block *); struct block *gen_scode(const char *, struct qual); struct block *gen_ecode(const u_char *, struct qual); struct block *gen_acode(const u_char *, struct qual); -struct block *gen_mcode(const char *, const char *, int, struct qual); +struct block *gen_mcode(const char *, const char *, unsigned int, struct qual); #ifdef INET6 -struct block *gen_mcode6(const char *, const char *, int, struct qual); +struct block *gen_mcode6(const char *, const char *, unsigned int, struct qual); #endif struct block *gen_ncode(const char *, bpf_u_int32, struct qual); struct block *gen_proto_abbrev(int); @@ -189,21 +308,53 @@ struct block *gen_broadcast(int); struct block *gen_multicast(int); struct block *gen_inbound(int); +struct block *gen_llc(void); +struct block *gen_llc_i(void); +struct block *gen_llc_s(void); +struct block *gen_llc_u(void); +struct block *gen_llc_s_subtype(bpf_u_int32); +struct block *gen_llc_u_subtype(bpf_u_int32); + struct block *gen_vlan(int); +struct block *gen_mpls(int); + +struct block *gen_pppoed(void); +struct block *gen_pppoes(int); + +struct block *gen_geneve(int); + +struct block *gen_atmfield_code(int atmfield, bpf_int32 jvalue, bpf_u_int32 jtype, int reverse); +struct block *gen_atmtype_abbrev(int type); +struct block *gen_atmmulti_abbrev(int type); + +struct block *gen_mtp2type_abbrev(int type); +struct block *gen_mtp3field_code(int mtp3field, bpf_u_int32 jvalue, bpf_u_int32 jtype, int reverse); + +struct block *gen_pf_ifname(const char *); +struct block *gen_pf_rnr(int); +struct block *gen_pf_srnr(int); +struct block *gen_pf_ruleset(char *); +struct block *gen_pf_reason(int); +struct block *gen_pf_action(int); +struct block *gen_pf_dir(int); + +struct block *gen_p80211_type(int, int); +struct block *gen_p80211_fcdir(int); void bpf_optimize(struct block **); void bpf_error(const char *, ...) -#if HAVE___ATTRIBUTE__ - __attribute__((noreturn, format (printf, 1, 2))) -#endif -; + __attribute__((noreturn)) +#ifdef __ATTRIBUTE___FORMAT_OK + __attribute__((format (printf, 1, 2))) +#endif /* __ATTRIBUTE___FORMAT_OK */ + ; void finish_parse(struct block *); char *sdup(const char *); -struct bpf_insn *icode_to_fcode(struct block *, int *); +struct bpf_insn *icode_to_fcode(struct block *, u_int *); int pcap_parse(void); -void lex_init(char *); +void lex_init(const char *); void lex_cleanup(void); void sappend(struct slist *, struct slist *);