📄 grammar.c
字号:
/* A Bison parser, made by GNU Bison 1.875b. *//* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. *//* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. *//* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. *//* Identify Bison output. */#define YYBISON 1/* Skeleton name. */#define YYSKELETON_NAME "yacc.c"/* Pure parsers. */#define YYPURE 0/* Using locations. */#define YYLSP_NEEDED 0/* If NAME_PREFIX is specified substitute the variables and functions names. */#define yyparse pcap_parse#define yylex pcap_lex#define yyerror pcap_error#define yylval pcap_lval#define yychar pcap_char#define yydebug pcap_debug#define yynerrs pcap_nerrs/* Tokens. */#ifndef YYTOKENTYPE# define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { DST = 258, SRC = 259, HOST = 260, GATEWAY = 261, NET = 262, NETMASK = 263, PORT = 264, LESS = 265, GREATER = 266, PROTO = 267, PROTOCHAIN = 268, CBYTE = 269, ARP = 270, RARP = 271, IP = 272, SCTP = 273, TCP = 274, UDP = 275, ICMP = 276, IGMP = 277, IGRP = 278, PIM = 279, VRRP = 280, ATALK = 281, AARP = 282, DECNET = 283, LAT = 284, SCA = 285, MOPRC = 286, MOPDL = 287, TK_BROADCAST = 288, TK_MULTICAST = 289, NUM = 290, INBOUND = 291, OUTBOUND = 292, PF_IFNAME = 293, PF_RSET = 294, PF_RNR = 295, PF_SRNR = 296, PF_REASON = 297, PF_ACTION = 298, LINK = 299, GEQ = 300, LEQ = 301, NEQ = 302, ID = 303, EID = 304, HID = 305, HID6 = 306, AID = 307, LSH = 308, RSH = 309, LEN = 310, IPV6 = 311, ICMPV6 = 312, AH = 313, ESP = 314, VLAN = 315, ISO = 316, ESIS = 317, CLNP = 318, ISIS = 319, L1 = 320, L2 = 321, IIH = 322, LSP = 323, SNP = 324, CSNP = 325, PSNP = 326, STP = 327, IPX = 328, NETBEUI = 329, LANE = 330, LLC = 331, METAC = 332, BCC = 333, SC = 334, ILMIC = 335, OAMF4EC = 336, OAMF4SC = 337, OAM = 338, OAMF4 = 339, CONNECTMSG = 340, METACONNECT = 341, VPI = 342, VCI = 343, AND = 344, OR = 345, UMINUS = 346 };#endif#define DST 258#define SRC 259#define HOST 260#define GATEWAY 261#define NET 262#define NETMASK 263#define PORT 264#define LESS 265#define GREATER 266#define PROTO 267#define PROTOCHAIN 268#define CBYTE 269#define ARP 270#define RARP 271#define IP 272#define SCTP 273#define TCP 274#define UDP 275#define ICMP 276#define IGMP 277#define IGRP 278#define PIM 279#define VRRP 280#define ATALK 281#define AARP 282#define DECNET 283#define LAT 284#define SCA 285#define MOPRC 286#define MOPDL 287#define TK_BROADCAST 288#define TK_MULTICAST 289#define NUM 290#define INBOUND 291#define OUTBOUND 292#define PF_IFNAME 293#define PF_RSET 294#define PF_RNR 295#define PF_SRNR 296#define PF_REASON 297#define PF_ACTION 298#define LINK 299#define GEQ 300#define LEQ 301#define NEQ 302#define ID 303#define EID 304#define HID 305#define HID6 306#define AID 307#define LSH 308#define RSH 309#define LEN 310#define IPV6 311#define ICMPV6 312#define AH 313#define ESP 314#define VLAN 315#define ISO 316#define ESIS 317#define CLNP 318#define ISIS 319#define L1 320#define L2 321#define IIH 322#define LSP 323#define SNP 324#define CSNP 325#define PSNP 326#define STP 327#define IPX 328#define NETBEUI 329#define LANE 330#define LLC 331#define METAC 332#define BCC 333#define SC 334#define ILMIC 335#define OAMF4EC 336#define OAMF4SC 337#define OAM 338#define OAMF4 339#define CONNECTMSG 340#define METACONNECT 341#define VPI 342#define VCI 343#define AND 344#define OR 345#define UMINUS 346/* Copy the first part of user declarations. */#line 1 "../libpcap/grammar.y"/* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that: (1) source code distributions * retain the above copyright notice and this paragraph in its entirety, (2) * distributions including binary code include the above copyright notice and * this paragraph in its entirety in the documentation or other materials * provided with the distribution, and (3) all advertising materials mentioning * features or use of this software display the following acknowledgement: * ``This product includes software developed by the University of California, * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of * the University nor the names of its contributors may be used to endorse * or promote products derived from this software without specific prior * written permission. * 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. * */#ifndef lintstatic const char rcsid[] _U_ = "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.79.2.4 2004/10/07 09:01:23 risso Exp $ (LBL)";#endif#ifdef HAVE_CONFIG_H#include "config.h"#endif#ifdef WIN32#include <pcap-stdinc.h>#else /* WIN32 */#include <sys/types.h>#include <sys/time.h>#include <sys/socket.h>#endif /* WIN32 */#include <stdlib.h>#ifndef WIN32#if __STDC__struct mbuf;struct rtentry;#endif#include <netinet/in.h>#endif /* WIN32 */#include <stdio.h>#ifndef WIN32#include <strings.h>#endif#include "pcap-int.h"#include "gencode.h"#include "pf.h"#include <pcap-namedb.h>#ifdef HAVE_OS_PROTO_H#include "os-proto.h"#endif#define QSET(q, p, d, a) (q).proto = (p),\ (q).dir = (d),\ (q).addr = (a)int n_errors = 0;static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };static voidyyerror(char *msg){ ++n_errors; bpf_error("%s", msg); /* NOTREACHED */}#ifndef YYBISONint yyparse(void);intpcap_parse(){ return (yyparse());}#endif/* Enabling traces. */#ifndef YYDEBUG# define YYDEBUG 0#endif/* Enabling verbose error messages. */#ifdef YYERROR_VERBOSE# undef YYERROR_VERBOSE# define YYERROR_VERBOSE 1#else# define YYERROR_VERBOSE 0#endif#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)#line 93 "../libpcap/grammar.y"typedef union YYSTYPE { int i; bpf_u_int32 h; u_char *e; char *s; struct stmt *stmt; struct arth *a; struct { struct qual q; int atmfieldtype; struct block *b; } blk; struct block *rblk;} YYSTYPE;/* Line 191 of yacc.c. */#line 374 "y.tab.c"# define yystype YYSTYPE /* obsolescent; will be withdrawn */# define YYSTYPE_IS_DECLARED 1# define YYSTYPE_IS_TRIVIAL 1#endif/* Copy the second part of user declarations. *//* Line 214 of yacc.c. */#line 386 "y.tab.c"#if ! defined (yyoverflow) || YYERROR_VERBOSE/* The parser invokes alloca or malloc; define the necessary symbols. */# if YYSTACK_USE_ALLOCA# define YYSTACK_ALLOC alloca# else# ifndef YYSTACK_USE_ALLOCA# if defined (alloca) || defined (_ALLOCA_H)# define YYSTACK_ALLOC alloca# else# ifdef __GNUC__# define YYSTACK_ALLOC __builtin_alloca# endif# endif# endif# endif# ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else# if defined (__STDC__) || defined (__cplusplus)# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */# define YYSIZE_T size_t# endif# define YYSTACK_ALLOC malloc# define YYSTACK_FREE free# endif#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */#if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member. */union yyalloc{ short yyss; YYSTYPE yyvs; };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -