wiki:Old/Documentation/OTG/FuncSpec/UseLibmac

Orbit > OTG > Function Specifications > Using LIBMAC

Use LIBMAC in OTR Program

Introduction to LIBMAC

Libmac 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 http://www.winlab.rutgers.edu/~kishore/libmac_docs/index.html

List of libmac function used by OTR program:

  • mac_get_ifinfo
  • mac_append_params
  • mac_recv

Some information about Libmac recv interface

  1. mac_append_params is the function to determine which parameters shouls be reported by the driver
  2. mac_recv is the "receive" function
  3. libmac does not use IP address at all

Gate with LIBMAC support

At 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.

To 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. I defined three custom Gate classes which inherits the LibmacRX class.

http://www.winlab.rutgers.edu/~zhibinwu/image/classLibmacRX.png

The 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:

Init:

  1. Get interface information by mac_get_ifinfo
  2. finding the wireless dev interface. either by pickInterfacebyName or pickInterfacebyIPAddr
  3. set "dst host" as libpcap filter
  4. determine whihc PHY/MAC parameters are needed and call mac_append_params

When packet is received.

  1. use mac_recv to fetch parameters one by one.

Rate Conversion

This is used only for Intel driver which does not do proper rate mapping from "signal field value" to actual rate value

short LibmacRX::rateMapping(unsigned short signal_bits)
{ 
  short val;
  switch (signal_bits){
    case 13:  val = 60; 
              break;
    case 15:  val = 90; 
              break;
    case 5:   val = 120; 
              break;
    case 7:   val = 180; 
              break;
    case 9:   val = 240; 
              break;
    case 11:  val = 360; 
              break;
    case 1:   val = 480; 
              break;
    case 3:   val = 540; 
              break;
  default:  val = (short)signal_bits; 
  //for 802.11b , no need to map (10,20,55,110)
  }
  return val;
}

Last modified 15 years ago Last modified on Feb 27, 2006, 8:46:43 PM
Note: See TracWiki for help on using the wiki.