IEEE 802.15.4 Packet Sniffer using T-Mote Sky
---------------------------------------------

Purpose:
  You can use this tool if you want to verify the packets that are in the air.
  It also helps to check whether an ACK was sent or if the timing is right.

Limitations:
  Also, the timing is limited to the resolution of the rtimer on the T-Mote 
  Sky. This is 32.8 ticks per ms. Since the packet is timestamped when it is 
  fully received, the time-stamping is somewhat inaccurate. This emerges as a 
  problem as soon as you have packets of differing length because then the 
  reception time differs.

Usage:
  Modify the Makefile with the correct path to Contiki and then issue

    make sniffer.upload

  to upload it to your nodes. Then enter the "linux" directory and hit "make".
  The binary

    ./sniffer

  can be directly executed and offers a number of options with the --help 
  screen. 

  After the sniffer node has started up, it will start operation with a channel
  scan. If it has found at least one packet with intact CRC in a channel, it 
  will stop there. The same happens, if at least three packets with broken CRC
  have been found on a channel.

Keyboard commands
  The sniffer tool offers you three commands on the keyboard.

  (c) Change channel
  (s) Start channel scan
  (q) Quit

Feeding Packets into Wireshark
Alternative 1
  Packets can also be forwarded using UDP to an arbitrary port and host. This 
  is useful, if you want to use the wireshark dissector. In order to do that, 
  wireshark has to be patched. Using the latest release version 1.2.6, you can 
  apply the patch like so:

    patch -p0 < udp_patch.patch

  Afterwards just compile wireshark and listen to the loopback interface. Then
  call the sniffer with this argument:
    ./sniffer --udp-port 4444

Alternative 2
  As an alternative, the sniffer can wrap incoming packets in raw ethernet 
  frames and then send them to the loopback interface. Wireshark can then be
  attached to this loopback interface and subsequently analyse incoming 
  packets. The drawback of this method is, that it requires root priviledges.

  To enable this functionality, call the sniffer with the following options:
    ./sniffer --ethdevice lo --ethtype 32922
  
  The sniffer will then send all packets to the loopback device with ether-
  type set to 32922 (0x809A).

  If you want to use the GinMAC dissector, the ethertype has to be 32923 
  (0x809B).

Interpreting the Format:
  The output format of the sniffer command line tool is as follows:
    timestamp [Length, Rssi, Channel]: HEX DUMP [CRC]
 
  timestamp = Time since last packet (30.8 us resolution)
  length    = length of the IEEE 802.15.4 packet that came from the radio
  rssi      = RSSI reported by the CC2420
  channel   = Channel on which the packet was received
  HEX DUMP  = Hex dump of the packet (including the CC2420 footer)
  CRC       = information about the CRC of a packet
