diff options
Diffstat (limited to 'usr.sbin/tcpdump/interface.h')
-rw-r--r-- | usr.sbin/tcpdump/interface.h | 195 |
1 files changed, 99 insertions, 96 deletions
diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h index b46827587b3..35ae9a29d1d 100644 --- a/usr.sbin/tcpdump/interface.h +++ b/usr.sbin/tcpdump/interface.h @@ -1,5 +1,3 @@ -/* $OpenBSD: interface.h,v 1.4 1996/07/13 11:01:10 mickey Exp $ */ - /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 * The Regents of the University of California. All rights reserved. @@ -20,12 +18,13 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) Header: interface.h,v 1.90 96/06/23 02:44:19 leres Exp (LBL) + * @(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/interface.h,v 1.5 1996/12/12 16:22:53 bitblt Exp $ (LBL) */ #ifndef tcpdump_interface_h #define tcpdump_interface_h +#include "gnuc.h" #ifdef HAVE_OS_PROTO_H #include "os-proto.h" #endif @@ -52,95 +51,12 @@ extern int packettype; /* as specified by -T */ #define PT_RTP 4 /* Real-Time Applications protocol */ #define PT_RTCP 5 /* Real-Time Applications control protocol */ -extern char *program_name; /* used to generate self-identifying messages */ - -extern int32_t thiszone; /* seconds offset from gmt to local time */ - -extern int snaplen; -/* global pointers to beginning and end of current packet (during printing) */ -extern const u_char *packetp; -extern const u_char *snapend; - -extern int pcap_fddipad; /* alignment offset for FDDI headers,in bytes */ - -#ifdef __STDC__ -struct timeval; -#endif - -extern void ts_print(const struct timeval *); -extern int32_t gmt2local(void); - -extern int fn_print(const u_char *, const u_char *); -extern int fn_printn(const u_char *, u_int, const u_char *); -extern const char *tok2str(const struct tok *, const char *, int); -extern char *dnaddr_string(u_short); -extern char *savestr(const char *); - -extern void wrapup(int); - -#if __STDC__ -extern __dead void error(const char *, ...) - __attribute__((volatile, format (printf, 1, 2))); -extern void warning(const char *, ...) __attribute__ ((format (printf, 1, 2))); -#endif - -extern char *read_infile(char *); -extern char *copy_argv(char **); - -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); - -/* The printer routines. */ - -#ifdef __STDC__ -struct pcap_pkthdr; -#endif - -extern void atm_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 sl_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); - -extern void arp_print(const u_char *, int, int); -extern void ip_print(const u_char *, int); -extern void tcp_print(const u_char *, int, const u_char *); -extern void udp_print(const u_char *, int, const u_char *); -extern void icmp_print(const u_char *, const u_char *); -extern void default_print(const u_char *, int); -extern void default_print_unaligned(const u_char *, int); - -extern void aarp_print(const u_char *, int); -extern void atalk_print(const u_char *, int); -extern void bootp_print(const u_char *, int, u_short, u_short); -extern void decnet_print(const u_char *, int, int); -extern void egp_print(const u_char *, int, const u_char *); -extern int ether_encap_print(u_short, const u_char *, int, int); -extern void ipx_print(const u_char *, int length); -extern void isoclns_print(const u_char *, int, int, - const u_char *, const u_char *); -extern int llc_print(const u_char *, int, int, const u_char *, const u_char *); -extern void nfsreply_print(const u_char *, int, const u_char *); -extern void nfsreq_print(const u_char *, int, const u_char *); -extern void ns_print(const u_char *, int); -extern void ntp_print(const u_char *, int); -extern void ospf_print(const u_char *, int, const u_char *); -extern void rip_print(const u_char *, int); -extern void snmp_print(const u_char *, int); -extern void sunrpcrequest_print(const u_char *, int, const u_char *); -extern void tftp_print(const u_char *, int); -extern void wb_print(const void *, int); -extern void dvmrp_print(const u_char *, int); -extern void pim_print(const u_char *, int); -extern void krb_print(const u_char *, int); - +#ifndef min #define min(a,b) ((a)>(b)?(b):(a)) +#endif +#ifndef max #define max(a,b) ((b)>(a)?(b):(a)) +#endif /* * The default snapshot length. This value allows most printers to print @@ -186,15 +102,102 @@ extern void krb_print(const u_char *, int); #define HTONL(x) (x) = htonl(x) #define HTONS(x) (x) = htons(x) #endif +#endif + +extern char *program_name; /* used to generate self-identifying messages */ + +extern int32_t thiszone; /* seconds offset from gmt to local time */ + +extern int snaplen; +/* global pointers to beginning and end of current packet (during printing) */ +extern const u_char *packetp; +extern const u_char *snapend; + +/* True if "l" bytes of "var" were captured */ +#define TTEST2(var, l) ((u_char *)&(var) <= snapend - (l)) -/* some systems don't define these */ -#ifndef ETHERTYPE_REVARP -#define ETHERTYPE_REVARP 0x8035 +/* 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) TCHECK2(var, sizeof(var)) + +#ifdef __STDC__ +struct timeval; #endif -#ifndef REVARP_REQUEST -#define REVARP_REQUEST 3 -#define REVARP_REPLY 4 +extern void ts_print(const struct timeval *); +extern int32_t gmt2local(void); + +extern int fn_print(const u_char *, const u_char *); +extern int fn_printn(const u_char *, u_int, const u_char *); +extern const char *tok2str(const struct tok *, const char *, int); +extern char *dnaddr_string(u_short); +extern char *savestr(const char *); + +extern void wrapup(int); + +#if __STDC__ +extern __dead void error(const char *, ...) + __attribute__((volatile, format (printf, 1, 2))); +extern void warning(const char *, ...) __attribute__ ((format (printf, 1, 2))); #endif +extern char *read_infile(char *); +extern char *copy_argv(char **); + +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); + +/* The printer routines. */ + +#ifdef __STDC__ +struct pcap_pkthdr; #endif + +extern int ether_encap_print(u_short, const u_char *, u_int, u_int); +extern int llc_print(const u_char *, u_int, u_int, const u_char *, + const u_char *); +extern void aarp_print(const u_char *, u_int); +extern void arp_print(const u_char *, u_int, u_int); +extern void atalk_print(const u_char *, u_int); +extern void atm_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); +extern void bootp_print(const u_char *, u_int, u_short, u_short); +extern void decnet_print(const u_char *, u_int, u_int); +extern void default_print(const u_char *, u_int); +extern void default_print_unaligned(const u_char *, u_int); +extern void dvmrp_print(const u_char *, u_int); +extern void egp_print(const u_char *, u_int, 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 gre_print(const u_char *, u_int); +extern void icmp_print(const u_char *, const u_char *); +extern void igrp_print(const u_char *, u_int, const u_char *); +extern void ip_print(const u_char *, u_int); +extern void ipx_print(const u_char *, u_int); +extern void isoclns_print(const u_char *, u_int, u_int, const u_char *, + const u_char *); +extern void krb_print(const u_char *, u_int); +extern void nfsreply_print(const u_char *, u_int, const u_char *); +extern void nfsreq_print(const u_char *, u_int, const u_char *); +extern void ns_print(const u_char *, u_int); +extern void ntp_print(const u_char *, u_int); +extern void null_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); +extern void ospf_print(const u_char *, u_int, const u_char *); +extern void pim_print(const u_char *, u_int); +extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); +extern void rip_print(const u_char *, u_int); +extern void sl_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); +extern void snmp_print(const u_char *, u_int); +extern void sunrpcrequest_print(const u_char *, u_int, const u_char *); +extern void tcp_print(const u_char *, u_int, const u_char *); +extern void tftp_print(const u_char *, u_int); +extern void udp_print(const u_char *, u_int, const u_char *); +extern void wb_print(const void *, u_int); |