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