include/wipal/wifi/frame/frame.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 WIFI_FRAME_FRAME_HH_
00023 # define WIFI_FRAME_FRAME_HH_
00024 
00025 extern "C"
00026 {
00027 # include <stdint.h>
00028 }
00029 
00030 # include <wipal/wifi/addr.hh>
00031 
00032 namespace wifi
00033 {
00034 
00036   namespace frame
00037   {
00038 
00040     namespace type
00041     {
00042 
00044       enum frame_type
00045         {
00046           management            = 0,    
00047           control               = 1,    
00048           data                  = 2,    
00049           reserved              = 3     
00050         };
00051 
00052     } // End of namespace wifi::frame::type.
00053 
00054     /*---------------.
00055     | Control fields |
00056     `---------------*/
00057 
00059     unsigned
00060     protocol_version_of(const void*);
00061 
00063     type::frame_type
00064     type_of(const void*);
00065 
00067     unsigned
00068     subtype_of(const void*);
00069 
00071     uint8_t
00072     control_flags_of(const void*);
00073 
00074     /*--------------.
00075     | Control flags |
00076     `--------------*/
00077 
00079     bool
00080     control_flag(const unsigned flag, const void* frame);
00081 
00083     bool
00084     to_ds(const void*);
00085 
00087     bool
00088     from_ds(const void*);
00089 
00090     /*---------.
00091     | Duration |
00092     `---------*/
00093 
00095     unsigned
00096     duration_of(const void*);
00097 
00098     /*-----------------.
00099     | Sequence control |
00100     `-----------------*/
00101 
00102     // FIXME: TODO.
00103 
00104 //     unsigned
00105 //     fragment_number_of(const void*);
00106 
00107 //     unsigned
00108 //     sequence_number_of(const void*);
00109 
00110     /*------------------.
00111     | Misc. information |
00112     `------------------*/
00113 
00122     const addr*
00123     transmitter_address(const void* frame);
00124 
00135     const addr*
00136     bssid_address(const void*, size_t caplen = 30);
00137 
00138   } // End of namespace wifi::frame.
00139 
00140 } // End of namespace wifi.
00141 
00142 # include "frame.hxx"
00143 
00144 #endif // ! WIFI_FRAME_FRAME_HH_

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