include/wipal/phy/rtap_header.hh

00001 /*
00002  * WiPal - 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 <wipal/phy/phy.hh>
00026 # include <wipal/tool/microseconds.hh>
00027 
00029 namespace rtap
00030 {
00031 
00033   struct header
00034   {
00035 
00036     enum field
00037     {
00038       tsft              = 0x00000001,
00039       flags             = 0x00000002,
00040       rate              = 0x00000004,
00041       channel           = 0x00000008,
00042       fhss              = 0x00000010,
00043       dbm_antsignal     = 0x00000020,
00044       dbm_antnoise      = 0x00000040,
00045       lock_quality      = 0x00000080,
00046       tx_attenuation    = 0x00000100,
00047       db_tx_attenuation = 0x00000200,
00048       dbm_tx_power      = 0x00000400,
00049       antenna           = 0x00000800,
00050       db_antsignal      = 0x00001000,
00051       db_antnoise       = 0x00002000,
00052       ext               = 0x10000000,
00053     };
00054 
00055     uint8_t     it_version;     
00056     uint8_t     it_pad;         
00057     uint16_t    it_len;         
00058     uint32_t    it_present;     
00059   } __attribute__((__packed__));
00060 
00070   void
00071   check(const header* h, size_t caplen);
00072 
00079   const void*
00080   first_field(const header*, size_t caplen);
00081 
00088   const void*
00089   get_80211(const header*, size_t caplen);
00090 
00098   tool::microseconds
00099   get_tsft(const header*, size_t caplen, const void* first_field);
00100 
00113   bool
00114   eq_80211(const header* lhs, size_t lhs_caplen,
00115            const header* rhs, size_t rhs_caplen);
00116 
00131   bool
00132   eq_time_and_80211(const header* lhs, size_t lhs_caplen,
00133                     const header* rhs, size_t rhs_caplen,
00134                     unsigned    precision = phy::eq_time_default_precision);
00135 
00136 } // End of namespace rtap.
00137 
00138 # include "rtap_header.hxx"
00139 
00140 #endif // ! RTAP_HEADER_HH_

Generated on Wed Jan 16 16:15:14 2008 for wipal by  doxygen 1.5.4