⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grammar.c

📁 Windows XP下的抓包程序实现
💻 C
📖 第 1 页 / 共 5 页
字号:
/* A Bison parser, made by GNU Bison 2.1.  *//* Skeleton parser for Yacc-like parsing with Bison,   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor,   Boston, MA 02110-1301, 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/* Bison version.  */#define YYBISON_VERSION "2.1"/* Skeleton name.  */#define YYSKELETON_NAME "yacc.c"/* Pure parsers.  */#define YYPURE 0/* Using locations.  */#define YYLSP_NEEDED 0/* Substitute the variable and function 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,     PORTRANGE = 265,     LESS = 266,     GREATER = 267,     PROTO = 268,     PROTOCHAIN = 269,     CBYTE = 270,     ARP = 271,     RARP = 272,     IP = 273,     SCTP = 274,     TCP = 275,     UDP = 276,     ICMP = 277,     IGMP = 278,     IGRP = 279,     PIM = 280,     VRRP = 281,     ATALK = 282,     AARP = 283,     DECNET = 284,     LAT = 285,     SCA = 286,     MOPRC = 287,     MOPDL = 288,     TK_BROADCAST = 289,     TK_MULTICAST = 290,     NUM = 291,     INBOUND = 292,     OUTBOUND = 293,     PF_IFNAME = 294,     PF_RSET = 295,     PF_RNR = 296,     PF_SRNR = 297,     PF_REASON = 298,     PF_ACTION = 299,     LINK = 300,     GEQ = 301,     LEQ = 302,     NEQ = 303,     ID = 304,     EID = 305,     HID = 306,     HID6 = 307,     AID = 308,     LSH = 309,     RSH = 310,     LEN = 311,     IPV6 = 312,     ICMPV6 = 313,     AH = 314,     ESP = 315,     VLAN = 316,     MPLS = 317,     PPPOED = 318,     PPPOES = 319,     ISO = 320,     ESIS = 321,     CLNP = 322,     ISIS = 323,     L1 = 324,     L2 = 325,     IIH = 326,     LSP = 327,     SNP = 328,     CSNP = 329,     PSNP = 330,     STP = 331,     IPX = 332,     NETBEUI = 333,     LANE = 334,     LLC = 335,     METAC = 336,     BCC = 337,     SC = 338,     ILMIC = 339,     OAMF4EC = 340,     OAMF4SC = 341,     OAM = 342,     OAMF4 = 343,     CONNECTMSG = 344,     METACONNECT = 345,     VPI = 346,     VCI = 347,     RADIO = 348,     SIO = 349,     OPC = 350,     DPC = 351,     SLS = 352,     AND = 353,     OR = 354,     UMINUS = 355   };#endif/* Tokens.  */#define DST 258#define SRC 259#define HOST 260#define GATEWAY 261#define NET 262#define NETMASK 263#define PORT 264#define PORTRANGE 265#define LESS 266#define GREATER 267#define PROTO 268#define PROTOCHAIN 269#define CBYTE 270#define ARP 271#define RARP 272#define IP 273#define SCTP 274#define TCP 275#define UDP 276#define ICMP 277#define IGMP 278#define IGRP 279#define PIM 280#define VRRP 281#define ATALK 282#define AARP 283#define DECNET 284#define LAT 285#define SCA 286#define MOPRC 287#define MOPDL 288#define TK_BROADCAST 289#define TK_MULTICAST 290#define NUM 291#define INBOUND 292#define OUTBOUND 293#define PF_IFNAME 294#define PF_RSET 295#define PF_RNR 296#define PF_SRNR 297#define PF_REASON 298#define PF_ACTION 299#define LINK 300#define GEQ 301#define LEQ 302#define NEQ 303#define ID 304#define EID 305#define HID 306#define HID6 307#define AID 308#define LSH 309#define RSH 310#define LEN 311#define IPV6 312#define ICMPV6 313#define AH 314#define ESP 315#define VLAN 316#define MPLS 317#define PPPOED 318#define PPPOES 319#define ISO 320#define ESIS 321#define CLNP 322#define ISIS 323#define L1 324#define L2 325#define IIH 326#define LSP 327#define SNP 328#define CSNP 329#define PSNP 330#define STP 331#define IPX 332#define NETBEUI 333#define LANE 334#define LLC 335#define METAC 336#define BCC 337#define SC 338#define ILMIC 339#define OAMF4EC 340#define OAMF4SC 341#define OAM 342#define OAMF4 343#define CONNECTMSG 344#define METACONNECT 345#define VPI 346#define VCI 347#define RADIO 348#define SIO 349#define OPC 350#define DPC 351#define SLS 352#define AND 353#define OR 354#define UMINUS 355/* 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.86.2.5 2005/09/05 09:08:06 guy 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/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>#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/* Enabling the token table.  */#ifndef YYTOKEN_TABLE# define YYTOKEN_TABLE 0#endif#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)#line 90 "../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;		int mtp3fieldtype;		struct block *b;	} blk;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -