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#pragma ident	"%Z%%M%	%I%	%E% SMI"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#define	MAX_PORT	65535		/* max port value for UDP */
40
41#define	REPLY_SHORT_PKT		0	/* check_reply() has a short packet */
42#define	REPLY_GOT_GATEWAY	1	/* ... rcvd a reply from an inter. gw */
43#define	REPLY_GOT_TARGET	2	/* ... rcvd the reply from the target */
44#define	REPLY_GOT_OTHER		3	/* ... received other */
45
46/*
47 * this is the max it can be, yet another factor is PMTU, which is ignored
48 * here
49 */
50#define	MAX_GWS6	127
51
52/*
53 * Maximum number of gateways (include room for one noop).
54 * 'in_addr_t' is 32 bits, size of IPv4 address.
55 * Note that the actual number of gateways that can be used for source
56 * routing is one less than the value below. This is because the API requires
57 * the last gateway to be the target address.
58 */
59#define	MAX_GWS		9
60
61/* maximum of max_gws */
62#define	MAXMAX_GWS	MAX(MAX_GWS, MAX_GWS6)
63
64#define	A_CNT(ARRAY)	(sizeof (ARRAY) / sizeof ((ARRAY)[0]))
65
66#define	Fprintf		(void)fprintf
67#define	Printf		(void)printf
68
69struct icmptype_table {
70	int type;		/* ICMP type */
71	char *message;		/* corresponding string message */
72};
73
74/* Data section of the probe packet */
75struct outdata {
76	uchar_t seq;		/* sequence number of this packet */
77	uchar_t ttl;		/* ttl packet left with */
78	struct timeval tv;	/* time packet left */
79};
80
81extern boolean_t docksum;	/* do checksum (IPv4 only) */
82extern int gw_count;		/* number of LSRR gateways */
83extern char *hostname;
84extern ushort_t ident;		/* identity of this traceroute run */
85extern boolean_t nflag;		/* numeric flag */
86extern ushort_t off;		/* set DF bit (IPv4 only) */
87extern int packlen;		/* packet length */
88extern ushort_t port;		/* seed of destination port */
89extern char *prog;		/* program name */
90extern boolean_t raw_req;	/* if sndsock for IPv4 must be raw */
91extern boolean_t settos;	/* set type-of-service (IPv4 only) */
92extern unsigned char tos;	/* value of tos to set */
93extern boolean_t useicmp;	/* use ICMP or UDP */
94extern boolean_t verbose;
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* _TRACEROUTE_H */
101