wit::importer Struct Reference

Functor to create WIT data files from PCAP traces. More...

#include </home/claveiro/work/lip6/wipal/src/wit-import/wit_importer.hh>

List of all members.

Public Types

enum  error {
  success = 0, malformed_frame = 1, malformed_prism = 2, malformed_802 = 3,
  malformed_other = 4, driver_reported = 5, unexpected_section = 6, bad_length = 7,
  bad_type_subtype = 8
}

Public Member Functions

 importer (const std::string &prefix)
void operator() (const pcapxx::frame_descriptor &d)

Protected Types

enum  { channels_max = 14 }

Protected Member Functions

std::string handle_time_data (const pcapxx::pkthdr *)
void handle_malformed_prism ()
const prism::headerhandle_prism_header (const std::string &time_string, const void *, size_t caplen)

Static Protected Member Functions

static std::string frames_data_filename (const std::string &, unsigned)
static std::string mapping_filename (const std::string &, unsigned)

Protected Attributes

unsigned last_channel_
boost::posix_time::ptime last_frame_
unsigned last_id_ [channels_max]
std::vector< tool::datafileframes_data_
std::vector< wifi::addr_mappingmappings_

Static Protected Attributes

static const std::string db_null = "\\N"

Classes

struct  hooks
 Parse a 802.11 frame and retrieve some fields that wit::importer needs. More...


Detailed Description

Functor to create WIT data files from PCAP traces.

The created data files are designed to be loaded into databases using LOAD DATA INFILE SQL commands.


Member Enumeration Documentation

WIT's createRawDataDatabase.pl error codes.

anonymous enum [protected]

Enumerator:
channels_max  Maximum number of Wi-Fi channels.


Constructor & Destructor Documentation

wit::importer::importer ( const std::string &  prefix  ) 

Contruct a wit::importer given a prefix to use for data files.

The created data files will have the name <prefix>_c<channel> (for raw frames) and <prefix>_c<channel>_MACIndex (for address to integer mappings).

References channels_max, frames_data_, frames_data_filename(), last_id_, mapping_filename(), and mappings_.


Member Function Documentation

void wit::importer::operator() ( const pcapxx::frame_descriptor d  )  [inline]

Import a frame in the data files.

Parameters:
[in] h Pointer to the frame's PCAP header.
[in] p Pointer to the frame.

References pcapxx::frame_descriptor::bytes(), pcapxx::pkthdr::caplen, db_null, frames_data_, handle_prism_header(), handle_time_data(), last_channel_, mappings_, and pcapxx::frame_descriptor::pcap_header().

std::string wit::importer::frames_data_filename ( const std::string &  prefix,
unsigned  channel 
) [inline, static, protected]

Get the name of a frames data file given a prefix and a channel.

References channels_max.

Referenced by importer(), and mapping_filename().

std::string wit::importer::mapping_filename ( const std::string &  prefix,
unsigned  channel 
) [inline, static, protected]

Get the name of a mapping data file given a prefix and a channel.

References channels_max, and frames_data_filename().

Referenced by importer().

std::string wit::importer::handle_time_data ( const pcapxx::pkthdr h  )  [inline, protected]

Update the object's time information and return a time string for a given frame's PCAP header.

References db_null, last_frame_, and pcapxx::pkthdr::ts.

Referenced by operator()().

void wit::importer::handle_malformed_prism (  )  [inline, protected]

Update data files when a Prism header was trucated.

References db_null, frames_data_, and last_channel_.

Referenced by handle_prism_header().

const prism::header * wit::importer::handle_prism_header ( const std::string &  time_string,
const void *  p,
size_t  caplen 
) [inline, protected]

Parse a frame's Prism header and update data files accordingly.

Returns:
A pointer to the Prism header, or NULL if the header is truncated. In this case, the data files have been fully updated and processing may stop safely for this frame.

References channels_max, frames_data_, handle_malformed_prism(), last_channel_, and last_id_.

Referenced by operator()().


Member Data Documentation

const std::string wit::importer::db_null = "\\N" [static, protected]

unsigned wit::importer::last_channel_ [protected]

Channel of last received frame.

Referenced by handle_malformed_prism(), handle_prism_header(), and operator()().

boost::posix_time::ptime wit::importer::last_frame_ [protected]

Time of arrival of last received frame.

Referenced by handle_time_data().

unsigned wit::importer::last_id_[channels_max] [protected]

ID of last receveid frame (per channel).

Referenced by handle_prism_header(), and importer().

std::vector<tool::datafile> wit::importer::frames_data_ [protected]

Frames data for each channel.

Referenced by handle_malformed_prism(), handle_prism_header(), importer(), and operator()().

std::vector<wifi::addr_mapping> wit::importer::mappings_ [protected]

Address to index mapping for each channel.

Referenced by importer(), and operator()().


The documentation for this struct was generated from the following files:

Generated on Wed Mar 26 17:56:24 2008 for wipal by  doxygen 1.5.5