1 /*
2  * Copyright (c) 1988-1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that: (1) source code distributions
7  * retain the above copyright notice and this paragraph in its entirety, (2)
8  * distributions including binary code include the above copyright notice and
9  * this paragraph in its entirety in the documentation or other materials
10  * provided with the distribution, and (3) all advertising materials mentioning
11  * features or use of this software display the following acknowledgement:
12  * ``This product includes software developed by the University of California,
13  * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14  * the University nor the names of its contributors may be used to endorse
15  * or promote products derived from this software without specific prior
16  * written permission.
17  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * @(#) $Header: /usr/staff/martinh/tcpview/RCS/interface.h,v 1.1 1993/04/22 20:44:55 martinh Exp $ (LBL)
22  */
23 
24 #ifdef __GNUC__
25 #define inline __inline
26 #else
27 #define inline
28 #endif
29 
30 #include "os.h"			/* operating system stuff */
31 #include "md.h"			/* machine dependent stuff */
32 
33 #include <ctype.h>
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <unistd.h>
38 
39 extern int hexread(void *, int);
40 
41 extern int dflag;		/* print filter code */
42 extern int eflag;		/* print ethernet header */
43 extern int nflag;		/* leave addresses as numbers */
44 extern int Nflag;		/* remove domains from printed host names */
45 extern int qflag;		/* quick (shorter) output */
46 extern int Sflag;		/* print raw TCP sequence numbers */
47 extern int tflag;		/* print packet arrival time */
48 extern int vflag;		/* verbose */
49 extern int xflag;		/* print packet in hex */
50 
51 extern char *program_name;	/* used to generate self-identifying messages */
52 
53 extern int snaplen;
54 /* global pointers to beginning and end of current packet (during printing) */
55 extern unsigned char *packetp;
56 extern unsigned char *snapend;
57 
58 extern long thiszone;			/* gmt to local correction */
59 
60 extern void ts_print();
61 extern int clock_sigfigs();
62 
63 extern char *lookup_device();
64 
65 extern void error(char *, ...);
66 extern void warning(char *, ...);
67 
68 extern char *read_infile();
69 extern char *copy_argv();
70 
71 extern void usage();
72 extern void show_code();
73 extern void init_addrtoname();
74 
75 /* The printer routines. */
76 
77 extern void ether_if_print();
78 extern void arp_print();
79 extern void ip_print();
80 extern void tcp_print();
81 extern void udp_print();
82 extern void icmp_print();
83 extern void default_print();
84 
85 extern void ntp_print();
86 extern void nfsreq_print();
87 extern void nfsreply_print();
88 extern void ns_print();
89 extern void ddp_print();
90 extern void rip_print();
91 extern void tftp_print();
92 extern void bootp_print();
93 extern void snmp_print();
94 extern void sl_if_print();
95 extern void ppp_if_print();
96 extern void fddi_if_print();
97 extern void null_if_print();
98 extern void egp_print();
99 
100 #define min(a,b) ((a)>(b)?(b):(a))
101 #define max(a,b) ((b)>(a)?(b):(a))
102 
103 /*
104  * The default snapshot length.  This value allows most printers to print
105  * useful information while keeping the amount of unwanted data down.
106  * In particular, it allows for an ethernet header, tcp/ip header, and
107  * 14 bytes of data (assuming no ip options).
108  */
109 #define DEFAULT_SNAPLEN 68
110 
111 #ifndef BIG_ENDIAN
112 #define BIG_ENDIAN 4321
113 #define LITTLE_ENDIAN 1234
114 #endif
115