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