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

📄 interfac.h

📁 This directory contains source code for tcpdump, a tool for network monitoring and data acquisition
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 * 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.
 *
 * @(#) $Header: interface.h,v 1.95 96/07/14 19:38:52 leres Exp $ (LBL)
 */

#ifndef tcpdump_interface_h
#define tcpdump_interface_h

#define BYTE        unsigned char
#define WORD        unsigned short
#define DWORD       unsigned long
#define STATIC
#define ARGSUSED(x) (x = x)
#define DIM(x)      (sizeof(x) / sizeof(x[0]))

#include "target.h"

#include <netinet/in.h>
#include <netdb.h>
#include <pcap.h>

#if defined(USE_FORTIFY)
#include "pcap/fortify.h"   /* use Fortify malloc library */
#endif


#define IPPROTO_IGMP       2
#define IPPROTO_DVMRP      4
#define IPPROTO_IGRP       9
#define IPPROTO_XTP       36
#define IP6PROTO_ENCAP    41
#define IPPROTO_RSVP      46
#define IPPROTO_GRE       47
#define IPPROTO_ESP       50
#define IPPROTO_AH        51
#define IPPROTO_MOBILE    55
#define IPPROTO_ICMPV6    58
#define IPPROTO_NONE      59
#define IPPROTO_ND        77
#define IPPROTO_AXIP      78   /* !!wrong number */
#define IPPROTO_OSPF      89
#define IPPROTO_IPV4      92
#define IPPROTO_IPV6      93
#define IPPROTO_HOPOPTS   94
#define IPPROTO_ROUTING   95
#define IPPROTO_FRAGMENT  96
#define IPPROTO_DSTOPTS   97

#define IPPROTO_PIM      103
#define IPPROTO_IPCOMP   108


struct tok {
       int   v;         /* value */
       char *s;         /* string */
     };

struct in_multi {
       int dummy;
     };

extern int aflag;       /* translate network and broadcast addresses */
extern int dflag;       /* print filter code */
extern int eflag;       /* print ethernet header */
extern int fflag;       /* don't translate "foreign" IP address */
extern int Hflag;       /* append resolved host names to hosts file */
extern int nflag;       /* leave addresses as numbers */
extern int Nflag;       /* remove domains from printed host names */
extern int pflag;       /* don't go promiscuous */
extern int Pflag;       /* dump protocol info */
extern int qflag;       /* quick (shorter) output */
extern int Sflag;       /* print raw TCP sequence numbers */
extern int sflag;       /* use the libsmi to translate OIDs */
extern int tflag;       /* print packet arrival time */
extern int uflag;       /* Print undecoded NFS handles */
extern int vflag;       /* verbose mode */
extern int wflag;       /* write packets to file */
extern int xflag;       /* print packet in hex */
extern int Aflag;       /* print packet in ascii */
extern int xaflag;      /* print packet in hex and ascii */

extern int packettype;  /* as specified by -T, one of the below */

#define PT_VAT      1   /* Visual Audio Tool */
#define PT_WB       2   /* White Board protocol */
#define PT_RPC      3   /* Remote Procedure Call */
#define PT_RTP      4   /* Real-Time Applications protocol */
#define PT_RTCP     5   /* Real-Time Applications control protocol */
#define PT_SNMP     6   /* Simple Network Management Protocol [udp] */
#define PT_SUNRPCRM 7   /* SunRPC record marking [tcp] */
#define PT_W3MUX    8   /* W3MUX record marking/multiplexing [tcp] */
#define PT_IIOP     9   /* CORBA IIOP messaging [tcp] */
#define PT_CORBA   10   /* Corba/iiop [tcp] */
#define PT_ANEP    11   /* Active Network Encapsulation Protocol [udp] */
#define PT_SRM2    12   /* SRM 2.0 [udp] */
#define PT_WC      13   /* MASH Web Cache [udp] */
#define PT_CNFP    14   /* Cisco NetFlow protocol */


extern int messagetype; /* as specified by -M, one of the below */

#define MT_ONCRPC   1   /* Sun RPC protocol messages */
#define MT_GIOP     2   /* CORBA GIOP messages */
#define MT_W3NG     3   /* World Wide Web HTTP-NG messages */
#define MT_HTTP     4   /* World Wide Web HTTP protocol */

extern char  program_name[];    /* used to generate self-identifying messages */
extern char  program_path[];    /* path of tcpdump.exe                        */

extern long  thiszone;          /* seconds offset from gmt to local time */
extern int   snaplen;

extern DWORD localnet;
extern DWORD netmask;
extern WORD  extracted_ethertype;

extern char *pcap_device;
extern char *ether_file;
extern char *atalk_file;
extern char *espsecret;

/* These are in watt-32 lib, module neterr.c
 */
extern void  perror_s (const char *str);
extern char *strerror_s (int errnum);

#define perror(str)    perror_s (str)
#define strerror(err)  strerror_s (err)

/*
 * global pointers to beginning and end of current packet (during printing)
 */
extern const u_char         *packetp;
extern const u_char         *snapend;
extern const struct timeval *PacketTimestamp;

extern int partial_frame;

/* True if  "l" bytes of "var" were captured
 */
#define TTEST2(var,l)   ((u_char*)&(var) <= snapend - (l))

/* True if "var" was captured
 */
#define TTEST(var)      TTEST2(var, sizeof(var))

/* Bail if "l" bytes of "var" were not captured
 */
#define TCHECK2(var,l)  if (!TTEST2(var, l)) goto trunc

/* Bail if "var" was not captured
 */
#define TCHECK(var)     if (!TTEST2(var, sizeof(var))) goto trunc

extern void  ts_print    (const struct timeval *);
extern void  relts_print (int);
extern long  gmt2local   (time_t);

extern int   fn_print       (char *, char *);
extern int   fn_printn      (char *, u_int, char *);
extern char *dnaddr_string  (u_short);
extern char *savestr        (const char *);
extern char *path_program   (char *fname);
extern char *read_infile    (char *);
extern char *copy_argv      (char **);
extern void  wrapup         (int);

extern char *isonsap_string (const u_char *);
extern char *llcsap_string  (u_char);
extern char *protoid_string (const u_char *);
extern char *dnname_string  (u_short);
extern char *dnnum_string   (u_short);
extern char *tok2str        (const struct tok *, const char *, int);

/*
 * The network-layer printer routines.
 */
extern void atm_if_print   (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ax25_if_print  (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ether_if_print (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void fddi_if_print  (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void null_if_print  (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ppp_if_print   (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ppp_bs_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void sl_if_print    (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void sl_bs_if_print (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void raw_if_print   (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void lane_if_print  (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void cip_if_print   (u_char *, const struct pcap_pkthdr *, const u_char *);
extern void token_if_print (u_char *, const struct pcap_pkthdr *, const u_char *);

/*
 * The protocol-layer printer routines.
 */
extern void gre_print           (const u_char *, u_int);
extern void ip_print            (const u_char *, u_int);
extern void ipN_print           (const u_char *, u_int);
extern void icmp6_print         (const u_char *, u_int);
extern void aarp_print          (const u_char *, u_int);
extern void anep_print          (const u_char *, u_int);
extern void srm2_print          (const u_char *, u_int);
extern void mobile_print        (const u_char *, u_int);
extern void axipudp_print       (const u_char *, u_int);
extern void ipx_print           (const u_char *, u_int);
extern void ns_print            (const u_char *, u_int);
extern void ntp_print           (const u_char *, u_int);

⌨️ 快捷键说明

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