include/wipal/tool/tt_options.hh

00001 /*
00002  * WiPal - A library and a set of tools to manipulate wireless traces.
00003  * Copyright (C) 2007, 2008  Universite Pierre et Marie Curie - Paris 6
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  * MA  02110-1301  USA
00019  *
00020  * Author: Thomas Claveirole <thomas.claveirole@lip6.fr>
00021  */
00022 #ifndef TOOL_TT_OPTIONS_HH_
00023 # define TOOL_TT_OPTIONS_HH_
00024 
00025 # include <vector>
00026 # include <string>
00027 # include <set>
00028 # include <utility>
00029 
00030 # include <wipal/tool/endianness.hh>
00031 
00032 # define tt_opt_none            ""
00033 # define tt_opt_802cmp          "8"
00034 # define tt_opt_attr            "a:"
00035 # define tt_opt_bytescmp        "b"
00036 # define tt_opt_colheads        "cC"
00037 # define tt_opt_defaultcmp      "d"
00038 # define tt_opt_errs            "eE"
00039 # define tt_opt_help            "h"
00040 # define tt_opt_frm_idx         "iI"
00041 # define tt_opt_mapping         "m:"
00042 # define tt_opt_endianness      "nN"
00043 # define tt_opt_prism_noise     "pP"
00044 # define tt_opt_quiet           "q"
00045 # define tt_opt_ignore_ref      "r:"
00046 # define tt_opt_timecmp         "t"
00047 # define tt_opt_usec            "uU"
00048 # define tt_opt_version         "v"
00049 
00050 # define tt_help_make(L, M) "  -" #L "   " M "\n"
00051 
00052 # define tt_help_802cmp                                                 \
00053   tt_help_make(8, "Only compare 802.11 frames (no Prism, no PCAP).")
00054 
00055 # define tt_help_attr                                                   \
00056   tt_help_make(a, "Attributes for unique frames identification "        \
00057                   "(default: " tt_attr_default ").")
00058 
00059 # define tt_help_bytescmp                                       \
00060   tt_help_make(b, "Only compare frame bytes (no PCAP header).")
00061 
00062 # define tt_help_colheads                                               \
00063   tt_help_make(c, "Do not print column headers "                        \
00064                   "(default if output is not a tty).")                  \
00065   tt_help_make(C, "Print column headers (default if output is a tty).")
00066 
00067 # define tt_help_defaultcmp                                             \
00068   tt_help_make(d, "Compare everything: PCAP data and bytes (default).")
00069 
00070 # define tt_help_errs                                           \
00071   tt_help_make(e, "Do not print error values (default).")       \
00072   tt_help_make(E, "Print error values.")
00073 
00074 # define tt_help_help                           \
00075   tt_help_make(h, "Print this help.")
00076 
00077 # define tt_help_frm_idx                                \
00078   tt_help_make(i, "Do not print frame indices.")        \
00079   tt_help_make(I, "Print frame indices (default).")
00080 
00081 # define tt_help_mapping                                \
00082   tt_help_make(m, "MAC addresses mapping file "         \
00083                   "(default: " tt_mapping_default ").")
00084 
00085 # define tt_help_endianness                                     \
00086   tt_help_make(n, "Force little endian for PHY headers.")       \
00087   tt_help_make(N, "Force big endian for PHY headers.")
00088 
00089 # define tt_help_prism_noise                                            \
00090   tt_help_make(p, "Prism noise fields have no special meaning (default).") \
00091   tt_help_make(P, "Consider a non-zero Prism noise field as a PHY error.")
00092 
00093 # define tt_help_quiet                                                  \
00094   tt_help_make(q, "Quiet ; produce minimal output (no column headers, etc.).")
00095 
00096 # define tt_help_ignore_ref \
00097   tt_help_make(r, "Ignore reference.  Blacklist a given x-y reference frame.")
00098 
00099 # define tt_help_timecmp                                                \
00100 tt_help_make(t, "Assume Prism headers and compare 802.11 frames, host time, " \
00101                 "and MAC time. Use a precision of 106us.")
00102 
00103 # define tt_help_usec                                           \
00104   tt_help_make(u, "Do not print microseconds (default).")       \
00105   tt_help_make(U, "Print microseconds.")
00106 
00107 # define tt_help_version                        \
00108   tt_help_make(v, "Print version information.")
00109 
00110 # define tt_attr_tmp                    "timestamp"
00111 # define tt_attr_dst_tmp                "dest-timestamp"
00112 # define tt_attr_src_tmp                "source-timestamp"
00113 # define tt_attr_bss_tmp                "bssid-timestamp"
00114 # define tt_attr_src_bss_tmp            "source-bssid-timestamp"
00115 # define tt_attr_seq_tmp                "seqctl-timestamp"
00116 # define tt_attr_seq_bss_tmp            "seqctl-bssid-timestamp"
00117 # define tt_attr_seq_dst_bss_tmp        "seqctl-dest-bssid-timestamp"
00118 # define tt_attr_seq_src_bss_tmp        "seqctl-source-bssid-timestamp"
00119 
00120 # define tt_attr_default                tt_attr_seq_bss_tmp
00121 # define tt_mapping_default             "mapping"
00122 
00123 namespace tool
00124 {
00125 
00126   namespace opt
00127   {
00128 
00129     struct options
00130     {
00131       typedef std::vector<std::string>                  input_type;
00132       typedef std::vector<std::string>                  output_type;
00133       typedef std::set< std::pair<unsigned, unsigned> > ref_blacklist_type;
00134 
00135       enum
00136         {
00137           no_input                      = 0,
00138           no_output                     = 0,
00139           arbitrary_number_of_inputs    = 8,
00140           arbitrary_number_of_outputs   = 8,
00141         };
00142 
00143       enum comp_method
00144         {
00145           cmp_default,
00146           cmp_802,
00147           cmp_bytes,
00148           cmp_time
00149         };
00150 
00151       input_type                input;
00152       output_type               output;
00153       std::string               mapping;
00154       std::string               attributes;
00155       endian::endianness        endianness;
00156       ref_blacklist_type        ref_blacklist;
00157       comp_method               cmp;
00158       bool                      prism_noise_means_error;
00159       bool                      print_column_headers;
00160       bool                      print_errors;
00161       bool                      print_frame_indices;
00162       bool                      print_microseconds;
00163       bool                      print_summary;
00164     };
00165 
00166     options     parse_args(int argc, char* const* argv,
00167                            const std::string& available_options,
00168                            int ninputs, int noutputs);
00169 
00170   } // End of namespace tool::opt.
00171 
00172 } // End of namespace tool.
00173 
00174 # include "tt_options.hxx"
00175 
00176 #endif // TOOL_TT_OPTIONS_HH_

Generated on Tue Jan 15 19:32:31 2008 for wipal by  doxygen 1.5.4