include/trace-tools/rtap_header.hh

00001 /*
00002  * trace-tools - A library and a set of tools to manipulate wireless traces.
00003  * Copyright (C) 2007  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 RTAP_HEADER_HH_
00023 # define RTAP_HEADER_HH_
00024 
00025 # include <trace-tools/tool/microseconds.hh>
00026 
00028 namespace rtap
00029 {
00030 
00032   struct header
00033   {
00034 
00035     enum field
00036     {
00037       tsft              = 0x00000001,
00038       flags             = 0x00000002,
00039       rate              = 0x00000004,
00040       channel           = 0x00000008,
00041       fhss              = 0x00000010,
00042       dbm_antsignal     = 0x00000020,
00043       dbm_antnoise      = 0x00000040,
00044       lock_quality      = 0x00000080,
00045       tx_attenuation    = 0x00000100,
00046       db_tx_attenuation = 0x00000200,
00047       dbm_tx_power      = 0x00000400,
00048       antenna           = 0x00000800,
00049       db_antsignal      = 0x00001000,
00050       db_antnoise       = 0x00002000,
00051       ext               = 0x10000000,
00052     };
00053 
00054     uint8_t     it_version;     
00055     uint8_t     it_pad;         
00056     uint16_t    it_len;         
00057     uint32_t    it_present;     
00058   } __attribute__((__packed__));
00059 
00069   void
00070   check(const header* h, size_t caplen);
00071 
00078   const void*
00079   first_field(const header*, size_t caplen);
00080 
00087   const void*
00088   get_80211(const header*, size_t caplen);
00089 
00097   tool::microseconds
00098   get_tsft(const header*, size_t caplen, const void* first_field);
00099 
00112   bool
00113   eq_80211(const header* lhs, size_t lhs_caplen,
00114            const header* rhs, size_t rhs_caplen);
00115 
00130   bool
00131   eq_time_and_80211(const header* lhs, size_t lhs_caplen,
00132                     const header* rhs, size_t rhs_caplen,
00133                     unsigned    precision = 40);
00134 
00135 } // End of namespace rtap.
00136 
00137 # include "rtap_header.hxx"
00138 
00139 #endif // ! RTAP_HEADER_HH_

Generated on Tue Nov 13 13:48:01 2007 for trace-tools by  doxygen 1.5.3-20071008