options.h 1.74 KB
Newer Older
pdw's avatar
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's avatar
pdw committed
10 11 12 13
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

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's avatar
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's avatar
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;

pdw's avatar
pdw committed
37 38 39 40
/* 
 * This structure has to be defined in the same order as the config 
 * directives in cfgfile.c.  Clearly this is EBW.
 */
pdw's avatar
pdw committed
41
typedef struct {
chris's avatar
chris committed
42
    /* interface on which to listen */
pdw's avatar
pdw committed
43 44
    char *interface;

pdw's avatar
pdw committed
45 46
    int dnsresolution;
    int portresolution;
pdw's avatar
pdw committed
47 48 49
    /* pcap filter code */
    char *filtercode;

pdw's avatar
pdw committed
50
    int showbars;
51
    option_port_t showports;
pdw's avatar
pdw committed
52 53 54

    int promiscuous;
    int promiscuous_but_choosy;
55 56
    int aggregate_src;
    int aggregate_dest;
pdw's avatar
pdw committed
57
    int paused;
pdw's avatar
pdw committed
58
    int showhelp;
59
    int bandwidth_in_bytes;
pdw's avatar
pdw committed
60
    option_sort_t sort;
pdw's avatar
pdw committed
61

pdw's avatar
pdw committed
62 63
    int bar_interval;

64
    char* screenfilter;
65
    int freezeorder;
66

pdw's avatar
pdw committed
67 68 69 70
    int screen_offset;

    option_linedisplay_t linedisplay;

pdw's avatar
pdw committed
71 72
    int show_totals;

73 74 75
    long long max_bandwidth;
    int log_scale;

pdw's avatar
pdw committed
76 77 78 79 80
    /* Cross network filter */
    int netfilter;
    struct in_addr netfilternet;
    struct in_addr netfiltermask;

81 82 83 84 85 86 87
    int netfilter6;
    struct in6_addr netfilter6net;
    struct in6_addr netfilter6mask;

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

pdw's avatar
pdw committed
88
    char *config_file;
89
    int config_file_specified;
pdw's avatar
pdw committed
90

pdw's avatar
pdw committed
91 92
} options_t;

pdw's avatar
pdw committed
93 94 95 96

void options_set_defaults();
void options_read(int argc, char **argv);

pdw's avatar
pdw committed
97
#endif /* __OPTIONS_H_ */