Blame view

options.h 1.97 KB
pdw committed
1 2 3 4 5 6 7 8
/*
 * options.h:
 *
 */

#ifndef __OPTIONS_H_ /* include guard */
#define __OPTIONS_H_

9
#include <sys/types.h>
pdw committed
10 11 12 13
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

pdw committed
14

15 16
typedef enum {
  OPTION_PORTS_OFF,
17 18
  OPTION_PORTS_SRC,
  OPTION_PORTS_DEST,
19 20 21
  OPTION_PORTS_ON
} option_port_t;

pdw committed
22 23 24 25 26 27 28 29
typedef enum {
  OPTION_SORT_DIV1,
  OPTION_SORT_DIV2,
  OPTION_SORT_DIV3,
  OPTION_SORT_SRC,
  OPTION_SORT_DEST
} option_sort_t;

pdw committed
30 31 32 33 34 35 36
typedef enum {
  OPTION_LINEDISPLAY_TWO_LINE,
  OPTION_LINEDISPLAY_ONE_LINE_BOTH,
  OPTION_LINEDISPLAY_ONE_LINE_RECV,
  OPTION_LINEDISPLAY_ONE_LINE_SENT
} option_linedisplay_t;

37 38 39 40 41 42
typedef enum {
  OPTION_BW_BITS,
  OPTION_BW_BYTES,
  OPTION_BW_PKTS,
} option_bw_unit_t;

pdw committed
43 44 45 46
/* 
 * This structure has to be defined in the same order as the config 
 * directives in cfgfile.c.  Clearly this is EBW.
 */
pdw committed
47
typedef struct {
chris committed
48
    /* interface on which to listen */
pdw committed
49 50
    char *interface;

pdw committed
51 52
    int dnsresolution;
    int portresolution;
pdw committed
53 54 55
    /* pcap filter code */
    char *filtercode;

pdw committed
56
    int showbars;
57
    option_port_t showports;
pdw committed
58 59 60

    int promiscuous;
    int promiscuous_but_choosy;
61 62
    int aggregate_src;
    int aggregate_dest;
pdw committed
63
    int paused;
pdw committed
64
    int showhelp;
65 66 67
    int timed_output;
    int no_curses;
    int num_lines;
68
    option_bw_unit_t bandwidth_unit;
pdw committed
69
    option_sort_t sort;
pdw committed
70

pdw committed
71 72
    int bar_interval;

73
    char* screenfilter;
pdw committed
74
    int freezeorder;
75

pdw committed
76 77 78 79
    int screen_offset;

    option_linedisplay_t linedisplay;

pdw committed
80 81
    int show_totals;

82 83 84
    long long max_bandwidth;
    int log_scale;

pdw committed
85 86 87 88 89
    /* Cross network filter */
    int netfilter;
    struct in_addr netfilternet;
    struct in_addr netfiltermask;

90 91 92 93 94 95 96
    int netfilter6;
    struct in6_addr netfilter6net;
    struct in6_addr netfilter6mask;

    /* Account for link-local traffic. */
    int link_local;

pdw committed
97
    char *config_file;
98
    int config_file_specified;
pdw committed
99

pdw committed
100 101
} options_t;

pdw committed
102 103 104

void options_set_defaults();
void options_read(int argc, char **argv);
105 106
void options_read_args(int argc, char **argv);
void options_make();
pdw committed
107

pdw committed
108
#endif /* __OPTIONS_H_ */