Annotation of embedaddon/mtr/ui/mtr.h, revision 1.1.1.3

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
1.1.1.3 ! misho       7:     it under the terms of the GNU General Public License version 2 as
1.1       misho       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: 
1.1.1.2   misho      15:     You should have received a copy of the GNU General Public License along
                     16:     with this program; if not, write to the Free Software Foundation, Inc.,
                     17:     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1.1       misho      18: */
                     19: 
                     20: #ifndef MTR_MTR_H
                     21: #define MTR_MTR_H
                     22: 
                     23: #include "config.h"
                     24: 
                     25: #include <stdint.h>
1.1.1.3 ! misho      26: #include <netdb.h>
1.1       misho      27: #include <sys/socket.h>
                     28: #include <arpa/inet.h>
                     29: 
                     30: #ifdef HAVE_NETINET_IN_H
                     31: #include <netinet/in.h>
                     32: #endif
                     33: 
                     34: /* Typedefs */
                     35: #ifdef ENABLE_IPV6
1.1.1.3 ! misho      36: #define DEFAULT_AF AF_UNSPEC
1.1       misho      37: typedef struct in6_addr ip_t;
                     38: #else
1.1.1.3 ! misho      39: #define DEFAULT_AF AF_INET
1.1       misho      40: typedef struct in_addr ip_t;
                     41: #endif
                     42: 
                     43: #ifndef HAVE_TIME_T
                     44: typedef int time_t;
                     45: #endif
                     46: 
                     47: /* The __unused__ attribute was added in gcc 3.2.7.  */
                     48: #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
                     49: #define ATTRIBUTE_UNUSED __attribute__((__unused__))
                     50: #else
                     51: #define ATTRIBUTE_UNUSED        /* empty */
                     52: #endif
                     53: 
                     54: /* The __const__ attribute was added in gcc 2.95.  */
                     55: #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
                     56: #define ATTRIBUTE_CONST __attribute__ ((__const__))
                     57: #else
                     58: #define ATTRIBUTE_CONST         /* empty */
                     59: #endif
                     60: 
                     61: /* stuff used by display such as report, curses... */
                     62: #define MAXFLD 20               /* max stats fields to display */
                     63: #define FLD_INDEX_SZ 256
                     64: 
                     65: /* net related definitions */
                     66: #define SAVED_PINGS 200
1.1.1.2   misho      67: #define MAX_PATH 8
1.1       misho      68: #define MaxHost 256
                     69: #define MinPort 1024
                     70: #define MaxPort 65535
                     71: #define MAXPACKET 4470          /* largest test packet size */
                     72: #define MINPACKET 28            /* 20 bytes IP header and 8 bytes ICMP or UDP */
                     73: #define MAXLABELS 8             /* http://kb.juniper.net/KB2190 (+ 3 just in case) */
                     74: 
                     75: /* Stream Control Transmission Protocol is defined in netinet/in.h */
                     76: #ifdef IPPROTO_SCTP
                     77: #define HAS_SCTP 1
                     78: #endif
                     79: 
                     80: #ifndef HAVE_SOCKLEN_T
                     81: typedef int socklen_t;
                     82: #endif
                     83: 
                     84: struct mtr_ctl {
                     85:     int MaxPing;
                     86:     float WaitTime;
                     87:     float GraceTime;
1.1.1.3 ! misho      88:     const char *Hostname;
1.1.1.2   misho      89:     char *InterfaceName;
1.1       misho      90:     char *InterfaceAddress;
                     91:     char LocalHostname[128];
                     92:     int ipinfo_no;
                     93:     int ipinfo_max;
                     94:     int cpacketsize;            /* packet size used by ping */
                     95:     int bitpattern;             /* packet bit pattern used by ping */
                     96:     int tos;                    /* type of service set in ping packet */
                     97: #ifdef SO_MARK
                     98:     uint32_t mark;
                     99: #endif
                    100:     ip_t unspec_addr;
                    101:     int af;                     /* address family of remote target */
                    102:     int mtrtype;                /* type of query packet used */
                    103:     int fstTTL;                 /* initial hub(ttl) to ping byMin */
                    104:     int maxTTL;                 /* last hub to ping byMin */
                    105:     int maxUnknown;             /* stop ping threshold */
                    106:     int remoteport;             /* target port for TCP tracing */
                    107:     int localport;              /* source port for UDP tracing */
                    108:     int probe_timeout;          /* timeout for probe sockets */
                    109:     unsigned char fld_active[2 * MAXFLD];       /* SO_MARK to set for ping packet */
                    110:     int display_mode;           /* display mode selector */
                    111:     int fld_index[FLD_INDEX_SZ];        /* default display field (defined by key in net.h) and order */
                    112:     char available_options[MAXFLD];
                    113:     int display_offset;         /* only used in text mode */
                    114:     void *gtk_data;             /* pointer to hold arbitrary gtk data */
                    115:     unsigned int                /* bit field to hold named booleans */
                    116:      ForceMaxPing:1,
                    117:         use_dns:1,
                    118:         show_ips:1,
                    119:         enablempls:1, dns:1, reportwide:1, Interactive:1, DisplayMode:5;
                    120: };
                    121: 
                    122: /* dynamic field drawing */
                    123: struct fields {
                    124:     const unsigned char key;
                    125:     const char *descr;
                    126:     const char *title;
                    127:     const char *format;
                    128:     const int length;
                    129:     int (
                    130:     *net_xxx) (
                    131:     int);
                    132: };
                    133: /* defined in mtr.c */
                    134: extern const struct fields data_fields[MAXFLD];
                    135: 
                    136: /* MPLS label object */
                    137: struct mplslen {
                    138:     unsigned long label[MAXLABELS];     /* label value */
1.1.1.2   misho     139:     uint8_t tc[MAXLABELS];     /* Traffic Class bits */
1.1       misho     140:     uint8_t ttl[MAXLABELS];     /* MPLS TTL */
                    141:     char s[MAXLABELS];          /* bottom of stack */
                    142:     char labels;                /* how many labels did we get? */
                    143: };
                    144: 
1.1.1.2   misho     145: 
                    146: #ifdef USING_CYGWIN
                    147: #define running_as_root() 1
                    148: #else
                    149: #define running_as_root() (getuid() == 0)
                    150: #endif
                    151: 
1.1.1.3 ! misho     152: int get_addrinfo_from_name(
        !           153:     struct mtr_ctl *ctl,
        !           154:     struct addrinfo **res,
        !           155:     const char *name);
        !           156: 
1.1       misho     157: #endif                          /* MTR_MTR_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>