Functions | Variables
radiotap.c File Reference
#include "radiotap_iter.h"
#include "platform.h"
Include dependency graph for radiotap.c:

Go to the source code of this file.

Functions

static void find_ns (struct ieee80211_radiotap_iterator *iterator, uint32_t oui, uint8_t subns)
int ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, struct ieee80211_radiotap_header *radiotap_header, int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns)
int ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator)

Variables

static struct
ieee80211_radiotap_namespace 
radiotap_ns
static struct radiotap_align_size rtap_namespace_sizes []

Function Documentation

static void find_ns ( struct ieee80211_radiotap_iterator iterator,
uint32_t  oui,
uint8_t  subns 
) [static]

Definition at line 154 of file radiotap.c.

int ieee80211_radiotap_iterator_init ( struct ieee80211_radiotap_iterator iterator,
struct ieee80211_radiotap_header radiotap_header,
int  max_length,
const struct ieee80211_radiotap_vendor_namespaces vns 
)

ieee80211_radiotap_iterator_init - radiotap parser iterator initialization : radiotap_iterator to initialize : radiotap header to parse : total length we can parse into (eg, whole packet length)

Returns: 0 or a negative error code if there is a problem.

This function initializes an opaque iterator struct which can then be passed to ieee80211_radiotap_iterator_next() to visit every radiotap argument which is present in the header. It knows about extended present headers and handles them.

How to use: call __ieee80211_radiotap_iterator_init() to init a semi-opaque iterator struct ieee80211_radiotap_iterator (no need to init the struct beforehand) checking for a good 0 return code. Then loop calling __ieee80211_radiotap_iterator_next()... it returns either 0, -ENOENT if there are no more args to parse, or -EINVAL if there is a problem. The iterator's member points to the start of the argument associated with the current argument index that is present, which can be found in the iterator's member. This arg index corresponds to the IEEE80211_RADIOTAP_... defines.

Radiotap header length: You can find the CPU-endian total radiotap header length in iterator->max_length after executing ieee80211_radiotap_iterator_init() successfully.

Alignment Gotcha: You must take care when dereferencing iterator.this_arg for multibyte types... the pointer is not aligned. Use get_unaligned((type *)iterator.this_arg) to dereference iterator.this_arg for type "type" safely on all arches.

Example code: parse.c

Definition at line 90 of file radiotap.c.

ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg : radiotap_iterator to move to next arg (if any)

Returns: 0 if there is an argument to handle, -ENOENT if there are no more args or -EINVAL if there is something else wrong.

This function provides the next radiotap arg index (IEEE80211_RADIOTAP_*) in and sets to point to the payload for the field. It takes care of alignment handling and extended present fields. can be changed by the caller (eg, incremented to move inside a compound argument like IEEE80211_RADIOTAP_CHANNEL). The args pointed to are in little-endian format whatever the endianess of your CPU.

Alignment Gotcha: You must take care when dereferencing iterator.this_arg for multibyte types... the pointer is not aligned. Use get_unaligned((type *)iterator.this_arg) to dereference iterator.this_arg for type "type" safely on all arches.

Definition at line 222 of file radiotap.c.


Variable Documentation

Initial value:
 {
        .n_bits = sizeof(rtap_namespace_sizes) / sizeof(rtap_namespace_sizes[0]),
        .align_size = rtap_namespace_sizes,
}

Definition at line 47 of file radiotap.c.

Initial value:
 {
        [IEEE80211_RADIOTAP_TSFT] = { .align = 8, .size = 8, },
        [IEEE80211_RADIOTAP_FLAGS] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_RATE] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_CHANNEL] = { .align = 2, .size = 4, },
        [IEEE80211_RADIOTAP_FHSS] = { .align = 2, .size = 2, },
        [IEEE80211_RADIOTAP_DBM_ANTSIGNAL] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_DBM_ANTNOISE] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_LOCK_QUALITY] = { .align = 2, .size = 2, },
        [IEEE80211_RADIOTAP_TX_ATTENUATION] = { .align = 2, .size = 2, },
        [IEEE80211_RADIOTAP_DB_TX_ATTENUATION] = { .align = 2, .size = 2, },
        [IEEE80211_RADIOTAP_DBM_TX_POWER] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_ANTENNA] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_DB_ANTSIGNAL] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_DB_ANTNOISE] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_RX_FLAGS] = { .align = 2, .size = 2, },
        [IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, },
        [IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
        [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
        [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
        
}

Definition at line 21 of file radiotap.c.



ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:07:57