Annotation of embedaddon/mtr/ui/mtr.h, revision 1.1
1.1 ! misho 1: /*
! 2: mtr -- a network diagnostic tool
! 3: Copyright (C) 1997,1998 Matt Kimball
! 4: Copyright (C) 2005 R.E.Wolff@BitWizard.nl
! 5:
! 6: This program is free software; you can redistribute it and/or modify
! 7: it under the terms of the GNU General Public License version 2 as
! 8: published by the Free Software Foundation.
! 9:
! 10: This program is distributed in the hope that it will be useful,
! 11: but WITHOUT ANY WARRANTY; without even the implied warranty of
! 12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 13: GNU General Public License for more details.
! 14:
! 15: You should have received a copy of the GNU General Public License
! 16: along with this program; if not, write to the Free Software
! 17: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! 18: */
! 19:
! 20: #ifndef MTR_MTR_H
! 21: #define MTR_MTR_H
! 22:
! 23: #include "config.h"
! 24:
! 25: #include <stdint.h>
! 26: #include <sys/socket.h>
! 27: #include <arpa/inet.h>
! 28:
! 29: #ifdef HAVE_NETINET_IN_H
! 30: #include <netinet/in.h>
! 31: #endif
! 32:
! 33: /* Typedefs */
! 34: #ifdef ENABLE_IPV6
! 35: typedef struct in6_addr ip_t;
! 36: #else
! 37: typedef struct in_addr ip_t;
! 38: #endif
! 39:
! 40: #ifndef HAVE_TIME_T
! 41: typedef int time_t;
! 42: #endif
! 43:
! 44: /* The __unused__ attribute was added in gcc 3.2.7. */
! 45: #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
! 46: #define ATTRIBUTE_UNUSED __attribute__((__unused__))
! 47: #else
! 48: #define ATTRIBUTE_UNUSED /* empty */
! 49: #endif
! 50:
! 51: /* The __const__ attribute was added in gcc 2.95. */
! 52: #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
! 53: #define ATTRIBUTE_CONST __attribute__ ((__const__))
! 54: #else
! 55: #define ATTRIBUTE_CONST /* empty */
! 56: #endif
! 57:
! 58: /* stuff used by display such as report, curses... */
! 59: #define MAXFLD 20 /* max stats fields to display */
! 60: #define FLD_INDEX_SZ 256
! 61:
! 62: /* net related definitions */
! 63: #define SAVED_PINGS 200
! 64: #define MAXPATH 8
! 65: #define MaxHost 256
! 66: #define MinPort 1024
! 67: #define MaxPort 65535
! 68: #define MAXPACKET 4470 /* largest test packet size */
! 69: #define MINPACKET 28 /* 20 bytes IP header and 8 bytes ICMP or UDP */
! 70: #define MAXLABELS 8 /* http://kb.juniper.net/KB2190 (+ 3 just in case) */
! 71:
! 72: /* Stream Control Transmission Protocol is defined in netinet/in.h */
! 73: #ifdef IPPROTO_SCTP
! 74: #define HAS_SCTP 1
! 75: #endif
! 76:
! 77: #ifndef HAVE_SOCKLEN_T
! 78: typedef int socklen_t;
! 79: #endif
! 80:
! 81: struct mtr_ctl {
! 82: int MaxPing;
! 83: float WaitTime;
! 84: float GraceTime;
! 85: char *Hostname;
! 86: char *InterfaceAddress;
! 87: char LocalHostname[128];
! 88: int ipinfo_no;
! 89: int ipinfo_max;
! 90: int cpacketsize; /* packet size used by ping */
! 91: int bitpattern; /* packet bit pattern used by ping */
! 92: int tos; /* type of service set in ping packet */
! 93: #ifdef SO_MARK
! 94: uint32_t mark;
! 95: #endif
! 96: ip_t unspec_addr;
! 97: int af; /* address family of remote target */
! 98: int mtrtype; /* type of query packet used */
! 99: int fstTTL; /* initial hub(ttl) to ping byMin */
! 100: int maxTTL; /* last hub to ping byMin */
! 101: int maxUnknown; /* stop ping threshold */
! 102: int remoteport; /* target port for TCP tracing */
! 103: int localport; /* source port for UDP tracing */
! 104: int probe_timeout; /* timeout for probe sockets */
! 105: unsigned char fld_active[2 * MAXFLD]; /* SO_MARK to set for ping packet */
! 106: int display_mode; /* display mode selector */
! 107: int fld_index[FLD_INDEX_SZ]; /* default display field (defined by key in net.h) and order */
! 108: char available_options[MAXFLD];
! 109: int display_offset; /* only used in text mode */
! 110: void *gtk_data; /* pointer to hold arbitrary gtk data */
! 111: unsigned int /* bit field to hold named booleans */
! 112: ForceMaxPing:1,
! 113: use_dns:1,
! 114: show_ips:1,
! 115: enablempls:1, dns:1, reportwide:1, Interactive:1, DisplayMode:5;
! 116: };
! 117:
! 118: /* dynamic field drawing */
! 119: struct fields {
! 120: const unsigned char key;
! 121: const char *descr;
! 122: const char *title;
! 123: const char *format;
! 124: const int length;
! 125: int (
! 126: *net_xxx) (
! 127: int);
! 128: };
! 129: /* defined in mtr.c */
! 130: extern const struct fields data_fields[MAXFLD];
! 131:
! 132: /* MPLS label object */
! 133: struct mplslen {
! 134: unsigned long label[MAXLABELS]; /* label value */
! 135: uint8_t exp[MAXLABELS]; /* experimental bits */
! 136: uint8_t ttl[MAXLABELS]; /* MPLS TTL */
! 137: char s[MAXLABELS]; /* bottom of stack */
! 138: char labels; /* how many labels did we get? */
! 139: };
! 140:
! 141: #endif /* MTR_MTR_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>