Changeset 49babe0 for lib/wag.h


Ignore:
Timestamp:
02/15/06 15:18:38 (16 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
643105b
Parents:
6eb91ff
Message:

Added initial format_rt and rt_protocol source files
Updated wag to be consistent with latest lt2 fixes and Dean's framing
Added a type field back into libtrace_packet
Fixed return value for trace_start

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/wag.h

    r7068467 r49babe0  
    33 *
    44 * Copyright (c) 2004 The University of Waikato, Hamilton, New Zealand.
    5  * Authors: Daniel Lawson 
    6  *          Perry Lorier 
    7  *         
     5 * Authors: Daniel Lawson
     6 *          Perry Lorier
     7 *
    88 * All rights reserved.
    99 *
    10  * This code has been developed by the University of Waikato WAND 
     10 * This code has been developed by the University of Waikato WAND
    1111 * research group. For further information please see http://www.wand.net.nz/
    1212 *
     
    2828 *
    2929 */
    30 #ifndef _WAG_H_
    31 #define _WAG_H_
    3230
    33 /* Generic field breakdowns */
    34 struct wag_frame_hdr {
    35   uint16_t magic;
    36   uint16_t size;
    37   uint16_t type;
    38   uint16_t subtype;
     31#ifndef _WAG_H
     32#define _WAG_H
     33
     34// This is the WAG magic number - used to delimit frames
     35#define WAG_MAGIC               (0xdaa1)
     36
     37// Define frame types
     38#define FRAME_TYPE_DATA         (0x0000)
     39#define FRAME_TYPE_UNDEFINED    (0xffff)
     40
     41// Define frame subtypes
     42#define FRAME_SUBTYPE_DATA_RX   (0x0000)
     43#define FRAME_SUBTYPE_DATA_TX   (0x0001)
     44
     45// This is the common part of the frame header.
     46// We synchronise by scanning a stream to look for the magic number (WAG_MAGIC).
     47// We can then tell the size and type of this frame, and pass over it if necessary.
     48struct frame_t {
     49  uint16_t magic;                                   // magic number (0xdaa1)
     50  uint16_t size;                                    // total frame size in bytes
     51  uint16_t type;                                    // frame type
     52  uint16_t subtype;                                 // frame subtype
    3953};
    4054
    41 struct wag_timestamp {
    42   uint32_t secs;
    43   uint32_t subsecs;
     55///////////////////////////////////////////////////////////////////////////////////
     56//
     57// Frames that the radio part of the WAG framework understands
     58//
     59///////////////////////////////////////////////////////////////////////////////////
     60// Common subfields...
     61
     62// timestamp
     63struct timestamp_t {
     64  uint32_t           secs;                          // seconds since start of 01-01-1970
     65  uint32_t           subsecs;                       // (1/(2^32))ths of a second
    4466};
    4567
    46 /* Received packet frame fields */
    47 struct wag_stream_info {
     68// frame stream information
     69struct strinfo_t {
    4870  uint16_t unused_1;
    4971  uint16_t unused_2;
     
    5274};
    5375
    54 struct wag_plcp_hdr {
    55   uint8_t  signal;
    56   uint8_t  service;
    57   uint16_t length;
     76// Type: DATA, Subtype: RX
     77struct frame_data_rx_t {
     78  struct frame_t                 hdr;               // common frame header
     79  struct strinfo_t               strinfo;           // stream status
     80  struct timestamp_t             ts;                // timestamp of reception of this frame
     81  struct {
     82    uint8_t              rssi;                      // receive signal strength of this frame
     83    uint8_t              rxstatus;                  // rx status bits from the modem
     84    uint16_t             length;                    // length in bytes of the frame payload
     85    struct {
     86      uint8_t  signal;                              // 802.11PLCP signal field
     87      uint8_t  service;                             // 802.11PLCP service field
     88      uint16_t length; } plcp; } rxinfo;            // 802.11PLCP length field (uS)
     89  char                           data[0];           // placeholder to allow payload access
    5890};
    5991
    60 struct wag_rxparams {
    61   uint8_t         rssi;
    62   uint8_t         rxstatus;
    63   uint16_t        length;
    64   struct wag_plcp_hdr plcp;
    65 };
    66 
    67 struct wag_data_frame {
    68   struct wag_frame_hdr hdr;
    69   struct wag_stream_info strinfo;
    70   struct wag_timestamp ts;
    71   struct wag_rxparams rxinfo;
    72   char data[1];
    73 };
    74 
    75 /* Transmit packet frame fields */
    76 struct wag_txparams {
    77   uint8_t         gain;
    78   uint8_t         mode;
    79   uint16_t        length;
    80   uint32_t        unused_1;
    81 };
    82 
    83 struct wag_tx_data_frame {
    84   struct wag_frame_hdr hdr;
    85   uint32_t         unused_1;
    86   uint32_t         unused_2;
    87   struct wag_txparams  txinfo;
    88   char data[1];
     92// Type: DATA, Subtype: TX
     93struct frame_data_tx_t {
     94  struct frame_t                 hdr;               // common frame header
     95  uint64_t                       unused_1;          //
     96  uint64_t                       unused_2;          //
     97  struct {
     98    uint8_t  gain;                                  // tx gain with which to send this packet
     99    uint8_t  mode;                                  // tx mode with which to send this packet
     100    uint16_t length;                                // length in bytes of the frame payload
     101    uint32_t unused_1; }         txinfo;            //
     102  char                           data[0];           // placeholder to allow payload access
    89103};
    90104
    91105struct ieee_802_11_header {
    92         unsigned int protocol:2;
    93         unsigned int type:2;
    94         unsigned int subtype:4;
    95         unsigned int to_ds:1;
    96         unsigned int from_ds:1;
    97         unsigned int more_frag:1;
    98         unsigned int retry:1;
    99         unsigned int power:1;
    100         unsigned int more_data:1;
    101         unsigned int wep:1;
    102         unsigned int order:1;
    103         uint16_t     duration;
    104         uint8_t      mac1[6];
    105         uint8_t      mac2[6];
    106         uint8_t      mac3[6];
    107         uint16_t     SeqCtl;
    108         uint8_t      mac4[6];
    109         uint8_t      data[1];
     106        uint8_t      protocol:2;
     107        uint8_t      type:2;
     108        uint8_t      subtype:4;
     109        uint8_t      to_ds:1;
     110        uint8_t      from_ds:1;
     111        uint8_t      more_frag:1;
     112        uint8_t      retry:1;
     113        uint8_t      power:1;
     114        uint8_t      more_data:1;
     115        uint8_t      wep:1;
     116        uint8_t      order:1;
     117        uint16_t     duration;
     118        uint8_t      mac1[6];
     119        uint8_t      mac2[6];
     120        uint8_t      mac3[6];
     121        uint16_t     SeqCtl;
     122        uint8_t      mac4[6];
     123        uint8_t      data[1];
    110124};
    111125
    112126struct ieee_802_11_payload {
    113         uint16_t     type;
    114         uint8_t      data[1];
     127        uint16_t     type;
     128        uint8_t      data[1];
    115129};
    116130
     131
    117132#endif
Note: See TracChangeset for help on using the changeset viewer.