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/stream.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 ((f, "Dump an hexadecimal summary of 802.11 frames on a single line.")) \
00049 ((F, "Provide a full hexadecimal dump for each frame.")) \
00050 ((g, "Print debug information.")) \
00051 ((h, "Print this help.")) \
00052 ((i, "Do not print frame indices.")) \
00053 ((I, "Print frame indices (default).")) \
00054 ((m, ("MAC addresses mapping file (default: " + def::mac_map() + ")."))) \
00055 ((n, "Force little endian for PHY headers.")) \
00056 ((N, "Force big endian for PHY headers.")) \
00057 ((o, "Compare everything and count how many bytes differ.")) \
00058 ((p, "Prism noise fields have no special meaning (default).")) \
00059 ((P, "Consider a non-zero Prism noise field as a PHY error.")) \
00060 ((q, "Quiet ; produce minimal output (no column headers, etc.).")) \
00061 ((r, "Ignore reference. Blacklist a given x-y reference frame.")) \
00062 ((s, ("ESSID mapping file (default: " + def::essid_map() + ")."))) \
00063 ((t, "Compare 802.11 frames and time of arrival. " \
00064 "Use a precision of 106us.")) \
00065 ((u, "Do not print microseconds (default).")) \
00066 ((U, "Print microseconds.")) \
00067 ((v, "Print version information.")) \
00068 ((x, "Precision when comparing timestamps (default: 106).")) \
00069 ((y, "Use PCAP timestamps.")) \
00070 ((Y, "Use PHY header timestamps when available (default)."))
00071
00072
00073
00074
00075
00076
00077 # define WP_ATTR_HELP_hsh_en2 "802.3 - MD5 hash."
00078 # define WP_ATTR_HELP_hsh_80211 "802.11 - MD5 hash (only parse MAC " \
00079 "headers)."
00080 # define WP_ATTR_HELP_hsh_80211_x "802.11 - MD5 hash (decapsulate " \
00081 "frames)."
00082 # define WP_ATTR_HELP_tmp "802.11 - Tstamp."
00083 # define WP_ATTR_HELP_dst_tmp "802.11 - dst., Tstamp."
00084 # define WP_ATTR_HELP_src_tmp "802.11 - src., Tstamp."
00085 # define WP_ATTR_HELP_bss_tmp "802.11 - BSS., Tstamp."
00086 # define WP_ATTR_HELP_src_bss_tmp "802.11 - src., BSS., Tstamp."
00087 # define WP_ATTR_HELP_seq_tmp "802.11 - SeqCtl, Tstamp."
00088 # define WP_ATTR_HELP_seq_bss_tmp "802.11 - SeqCtl, BSS., Tstamp."
00089 # define WP_ATTR_HELP_seq_dst_bss_tmp "802.11 - SeqCtl, dst., BSS., Tstamp."
00090 # define WP_ATTR_HELP_seq_src_bss_tmp "802.11 - SeqCtl, src., BSS., Tstamp."
00091
00092
00093 namespace wpl
00094 {
00095
00096 namespace args
00097 {
00098 typedef std::vector<std::string> input;
00099 typedef std::vector<std::string> output;
00100
00101 enum comp_method
00102 {
00103 cmp_default,
00104 cmp_802,
00105 cmp_bytes,
00106 cmp_time,
00107 cmp_score
00108 };
00109
00110 enum hex_summary
00111 {
00112 nohex,
00113 short80211,
00114 full
00115 };
00116
00117 enum count
00118 {
00119 none = 0,
00120 arbitrary = 8,
00121 };
00122
00123 void
00124 parse(int argc,
00125 char* const* argv,
00126 opt::list& opts,
00127 count ninputs,
00128 count noutputs);
00129
00130 template <class Fun>
00131 int
00132 dispatch_unique_id(opt::list& options, Fun fun);
00133
00134 void
00135 unsupported_linktype(const pkt::type t);
00136
00137 void
00138 check_options(opt::list& o, const pkt::type t);
00139
00140 void
00141 ensure_80211(const pkt::type t);
00142
00144 namespace def
00145 {
00146
00147 tool::end::endianness endianness();
00148 std::set< std::pair<unsigned, unsigned> > ref_blacklist();
00149 tool::undefined_type mapping();
00150 bool ignore_noisy_prism();
00151 std::string mac_map();
00152 std::string essid_map();
00153 std::string attributes();
00154 comp_method cmp();
00155 bool ui_errors();
00156 bool ui_indices();
00157 bool ui_headers();
00158 bool ui_microseconds();
00159 hex_summary ui_hex_summary();
00160 bool ui_summary();
00161
00172 unsigned precision();
00173
00174 bool phy_tstamps();
00175
00176 }
00177
00178 }
00179
00180 }
00181
00182 # include "args.hxx"
00183
00184 #endif // TOOL_ARGS_HH_