xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/traceroute/traceroute.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
1 /*
2  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997
8  *	The Regents of the University of California.  All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that: (1) source code distributions
12  * retain the above copyright notice and this paragraph in its entirety, (2)
13  * distributions including binary code include the above copyright notice and
14  * this paragraph in its entirety in the documentation or other materials
15  * provided with the distribution, and (3) all advertising materials mentioning
16  * features or use of this software display the following acknowledgement:
17  * ``This product includes software developed by the University of California,
18  * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
19  * the University nor the names of its contributors may be used to endorse
20  * or promote products derived from this software without specific prior
21  * written permission.
22  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
23  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25  *
26  *
27  * @(#)$Header: traceroute.c,v 1.49 97/06/13 02:30:23 leres Exp $ (LBL)
28  */
29 
30 #ifndef _TRACEROUTE_H
31 #define	_TRACEROUTE_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define	MAX_PORT	65535		/* max port value for UDP */
38 
39 #define	REPLY_SHORT_PKT		0	/* check_reply() has a short packet */
40 #define	REPLY_GOT_GATEWAY	1	/* ... rcvd a reply from an inter. gw */
41 #define	REPLY_GOT_TARGET	2	/* ... rcvd the reply from the target */
42 #define	REPLY_GOT_OTHER		3	/* ... received other */
43 
44 /*
45  * this is the max it can be, yet another factor is PMTU, which is ignored
46  * here
47  */
48 #define	MAX_GWS6	127
49 
50 /*
51  * Maximum number of gateways (include room for one noop).
52  * 'in_addr_t' is 32 bits, size of IPv4 address.
53  * Note that the actual number of gateways that can be used for source
54  * routing is one less than the value below. This is because the API requires
55  * the last gateway to be the target address.
56  */
57 #define	MAX_GWS		9
58 
59 /* maximum of max_gws */
60 #define	MAXMAX_GWS	MAX(MAX_GWS, MAX_GWS6)
61 
62 #define	A_CNT(ARRAY)	(sizeof (ARRAY) / sizeof ((ARRAY)[0]))
63 
64 #define	Fprintf		(void)fprintf
65 #define	Printf		(void)printf
66 
67 struct icmptype_table {
68 	int type;		/* ICMP type */
69 	char *message;		/* corresponding string message */
70 };
71 
72 /* Data section of the probe packet */
73 struct outdata {
74 	uchar_t seq;		/* sequence number of this packet */
75 	uchar_t ttl;		/* ttl packet left with */
76 	struct timeval tv;	/* time packet left */
77 };
78 
79 extern boolean_t docksum;	/* do checksum (IPv4 only) */
80 extern int gw_count;		/* number of LSRR gateways */
81 extern char *hostname;
82 extern ushort_t ident;		/* identity of this traceroute run */
83 extern boolean_t nflag;		/* numeric flag */
84 extern ushort_t off;		/* set DF bit (IPv4 only) */
85 extern int packlen;		/* packet length */
86 extern ushort_t port;		/* seed of destination port */
87 extern char *prog;		/* program name */
88 extern boolean_t raw_req;	/* if sndsock for IPv4 must be raw */
89 extern boolean_t settos;	/* set type-of-service (IPv4 only) */
90 extern unsigned char tos;	/* value of tos to set */
91 extern boolean_t useicmp;	/* use ICMP or UDP */
92 extern boolean_t verbose;
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* _TRACEROUTE_H */
99