00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TOOL_ARGS_HH_
00023 # define TOOL_ARGS_HH_
00024
00025 # include <vector>
00026 # include <string>
00027 # include <set>
00028 # include <utility>
00029
00030 # include <wipal/tool/options.hh>
00031 # include <wipal/pcap/descriptor.hh>
00032
00033
00034
00035
00036
00037
00038 # define WP_ARGS_OPTIONS \
00039 ((8, "Only compare 802.11 frames (no PHY header, no PCAP).")) \
00040 ((a, ("Attributes for unique frames identification (default: " + \
00041 def::attributes() + ")."))) \
00042 ((b, "Only compare frame bytes (no PCAP header).")) \
00043 ((c, "Do not print column headers (default if output is not a tty).")) \
00044 ((C, "Print column headers (default if output is a tty).")) \
00045 ((d, "Compare everything: PCAP data and bytes (default).")) \
00046 ((e, "Do not print error values (default).")) \
00047 ((E, "Print error values.")) \
00048 ((g, "Print debug information.")) \
00049 ((h, "Print this help.")) \
00050 ((i, "Do not print frame indices.")) \
00051 ((I, "Print frame indices (default).")) \
00052 ((m, ("MAC addresses mapping file (default: " + def::mac_map() + ")."))) \
00053 ((n, "Force little endian for PHY headers.")) \
00054 ((N, "Force big endian for PHY headers.")) \
00055 ((o, "Compare everything and count how many bytes differ.")) \
00056 ((p, "Prism noise fields have no special meaning (default).")) \
00057 ((P, "Consider a non-zero Prism noise field as a PHY error.")) \
00058 ((q, "Quiet ; produce minimal output (no column headers, etc.).")) \
00059 ((r, "Ignore reference. Blacklist a given x-y reference frame.")) \
00060 ((s, ("ESSID mapping file (default: " + def::essid_map() + ")."))) \
00061 ((t, "Compare 802.11 frames and time of arrival. " \
00062 "Use a precision of 106us.")) \
00063 ((u, "Do not print microseconds (default).")) \
00064 ((U, "Print microseconds.")) \
00065 ((v, "Print version information.")) \
00066 ((x, "Precision when comparing timestamps (default: 106).")) \
00067 ((y, "Use PCAP timestamps.")) \
00068 ((Y, "Use PHY header timestamps when available (default)."))
00069
00070
00071
00072
00073
00074
00075 # define WP_ATTR_HELP_hsh_en2 "802.3 - MD5 hash."
00076 # define WP_ATTR_HELP_hsh_80211 "802.11 - MD5 hash (only parse MAC " \
00077 "headers)."
00078 # define WP_ATTR_HELP_hsh_80211_x "802.11 - MD5 hash (decapsulate " \
00079 "frames)."
00080 # define WP_ATTR_HELP_tmp "802.11 - Tstamp."
00081 # define WP_ATTR_HELP_dst_tmp "802.11 - dst., Tstamp."
00082 # define WP_ATTR_HELP_src_tmp "802.11 - src., Tstamp."
00083 # define WP_ATTR_HELP_bss_tmp "802.11 - BSS., Tstamp."
00084 # define WP_ATTR_HELP_src_bss_tmp "802.11 - src., BSS., Tstamp."
00085 # define WP_ATTR_HELP_seq_tmp "802.11 - SeqCtl, Tstamp."
00086 # define WP_ATTR_HELP_seq_bss_tmp "802.11 - SeqCtl, BSS., Tstamp."
00087 # define WP_ATTR_HELP_seq_dst_bss_tmp "802.11 - SeqCtl, dst., BSS., Tstamp."
00088 # define WP_ATTR_HELP_seq_src_bss_tmp "802.11 - SeqCtl, src., BSS., Tstamp."
00089
00090
00091 namespace tool
00092 {
00093
00094 namespace args
00095 {
00096 typedef std::vector<std::string> input;
00097 typedef std::vector<std::string> output;
00098
00099 enum comp_method
00100 {
00101 cmp_default,
00102 cmp_802,
00103 cmp_bytes,
00104 cmp_time,
00105 cmp_score
00106 };
00107
00108 enum count
00109 {
00110 none = 0,
00111 arbitrary = 8,
00112 };
00113
00114 void
00115 parse(int argc,
00116 char* const* argv,
00117 opt::list& opts,
00118 count ninputs,
00119 count noutputs);
00120
00121 template <class Fun>
00122 int
00123 dispatch_unique_id(opt::list& options, Fun fun);
00124
00125 void
00126 unsupported_linktype(const pcapxx::descriptor<>::link_type lt);
00127
00128 void
00129 check_options(opt::list& o, const pcapxx::descriptor<>::link_type l);
00130
00131 void
00132 ensure_80211(const pcapxx::descriptor<>::link_type lt);
00133
00135 namespace def
00136 {
00137
00138 endian::endianness endianness();
00139 std::set< std::pair<unsigned, unsigned> > ref_blacklist();
00140 undefined_type mapping();
00141 bool ignore_noisy_prism();
00142 std::string mac_map();
00143 std::string essid_map();
00144 std::string attributes();
00145 comp_method cmp();
00146 bool ui_errors();
00147 bool ui_indices();
00148 bool ui_headers();
00149 bool ui_microseconds();
00150 bool ui_summary();
00151
00162 unsigned precision();
00163
00164 bool phy_tstamps();
00165
00166 }
00167
00168 }
00169
00170 }
00171
00172 # include "args.hxx"
00173
00174 #endif // TOOL_ARGS_HH_