]> gitweb.fperrin.net Git - iftop.git/blob - options.h
gitignore
[iftop.git] / options.h
1 /*
2  * options.h:
3  *
4  */
5
6 #ifndef __OPTIONS_H_ /* include guard */
7 #define __OPTIONS_H_
8
9 #include <sys/types.h>
10 #include <sys/socket.h>
11 #include <netinet/in.h>
12 #include <arpa/inet.h>
13
14
15 typedef enum {
16   OPTION_PORTS_OFF,
17   OPTION_PORTS_SRC,
18   OPTION_PORTS_DEST,
19   OPTION_PORTS_ON
20 } option_port_t;
21
22 typedef enum {
23   OPTION_SORT_DIV1,
24   OPTION_SORT_DIV2,
25   OPTION_SORT_DIV3,
26   OPTION_SORT_SRC,
27   OPTION_SORT_DEST
28 } option_sort_t;
29
30 typedef enum {
31   OPTION_LINEDISPLAY_TWO_LINE,
32   OPTION_LINEDISPLAY_ONE_LINE_BOTH,
33   OPTION_LINEDISPLAY_ONE_LINE_RECV,
34   OPTION_LINEDISPLAY_ONE_LINE_SENT
35 } option_linedisplay_t;
36
37 typedef enum {
38   OPTION_BW_BITS,
39   OPTION_BW_BYTES,
40   OPTION_BW_PKTS,
41 } option_bw_unit_t;
42
43 /* 
44  * This structure has to be defined in the same order as the config 
45  * directives in cfgfile.c.  Clearly this is EBW.
46  */
47 typedef struct {
48     /* interface on which to listen */
49     char *interface;
50
51     int dnsresolution;
52     int portresolution;
53     /* pcap filter code */
54     char *filtercode;
55
56     int showbars;
57     option_port_t showports;
58
59     int promiscuous;
60     int promiscuous_but_choosy;
61     int aggregate_src;
62     int aggregate_dest;
63     int paused;
64     int showhelp;
65     int timed_output;
66     int no_curses;
67     int num_lines;
68     option_bw_unit_t bandwidth_unit;
69     option_sort_t sort;
70
71     int bar_interval;
72
73     char* screenfilter;
74     int freezeorder;
75
76     int screen_offset;
77
78     option_linedisplay_t linedisplay;
79
80     int show_totals;
81
82     long long max_bandwidth;
83     int log_scale;
84
85     /* Cross network filter */
86     int netfilter;
87     struct in_addr netfilternet;
88     struct in_addr netfiltermask;
89
90     int netfilter6;
91     struct in6_addr netfilter6net;
92     struct in6_addr netfilter6mask;
93
94     /* Account for link-local traffic. */
95     int link_local;
96
97     char *config_file;
98     int config_file_specified;
99
100 } options_t;
101
102
103 void options_set_defaults();
104 void options_read(int argc, char **argv);
105 void options_read_args(int argc, char **argv);
106 void options_make();
107
108 #endif /* __OPTIONS_H_ */