options.h 1.9 KB

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