Changes between Initial Version and Version 1 of Old/Documentation/OTG/FuncSpec/UseLibmac


Ignore:
Timestamp:
Sep 26, 2005, 3:59:51 PM (19 years ago)
Author:
zhibinwu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Old/Documentation/OTG/FuncSpec/UseLibmac

    v1 v1  
     1[wiki:WikiStart Orbit] > [wiki:Documentation/OTG OTG] > [wiki:Documentation/OTG/FuncSpec Function Specifications] > Using LIBMAC
     2
     3= Use LIBMAC in OTR Program =
     4
     5== Introduction to LIBMAC ==
     6Libmac is a user-space C library that brings the wireless driver application program interface (API) into user space allowing one to get or set values of driver parameters. This library supports operation for a variable number of parameters per call. Currently, the documentation of LIBMAC is created by Doxygen tool and can be found in
     7http://www.winlab.rutgers.edu/~kishore/libmac_docs/index.html
     8
     9List of libmac function used by OTR program:
     10 * mac_get_ifinfo
     11 * mac_append_params
     12 * mac_recv
     13
     14Some information about Libmac recv interface
     15 1. mac_append_params is the function to determine which parameters shouls be reported by the driver
     16 1. mac_recv is the "receive" function
     17 1. libmac does not use IP address at all
     18
     19== Gate with LIBMAC support ==
     20
     21At both ends of the OTG-OTR connection, regular sockets are opened. However, at the receiving end, in addition to regular sockets, we could use ''mac_recv'' of Libmac which is also waiting to hear from the interface. Two copies of the incoming frame are made by the kernel for pcap, one of which is given to the application on top of the listening socket and the other to mac_recv. mac_recv, extracts the RSSI value using its regular magic and reports to OML.
     22
     23To suppport this functionality for various Gate types, I defined LibmacRX class. LibmacRX is an encapsulation of all LIBMAC Related methods to retreiving MAC/PHY parameters.
     24I defined three custom Gate classes which inherits the LibmacRX class.
     25
     26http://www.winlab.rutgers.edu/~zhibinwu/image/classLibmacRX.png
     27
     28The major purpose to use LibmacRX class is to call mac_recv function to extract some parameters supported by Libmac-customized driver. In order to do this:
     29
     30Init:
     31 1. Get interface information by ''mac_get_ifinfo''
     32 1. finding the wireless dev interface. either by ''pickInterfacebyName'' or ''pickInterfacebyIPAddr''
     33 1. set "dst host" as libpcap filter
     34 1. determine whihc PHY/MAC parameters are needed and call ''mac_append_params''
     35 
     36When packet is received.
     37 1. use ''mac_recv'' to fetch parameters one by one.
     38
     39
     40== Rate Conversion ==
     41This is used only for Intel driver which does not do proper rate mapping from "signal field value" to actual rate value
     42{{{
     43short LibmacRX::rateMapping(unsigned short signal_bits)
     44{
     45  short val;
     46  switch (signal_bits){
     47    case 13:  val = 60;
     48              break;
     49    case 15:  val = 90;
     50              break;
     51    case 5:   val = 120;
     52              break;
     53    case 7:   val = 180;
     54              break;
     55    case 9:   val = 240;
     56              break;
     57    case 11:  val = 360;
     58              break;
     59    case 1:   val = 480;
     60              break;
     61    case 3:   val = 540;
     62              break;
     63  default:  val = (short)signal_bits;
     64  //for 802.11b , no need to map (10,20,55,110)
     65  }
     66  return val;
     67}
     68
     69}}}
     70