Defines | Functions
radiotap.c File Reference
#include "includes.h"
#include "common.h"
#include "radiotap_iter.h"
Include dependency graph for radiotap.c:

Go to the source code of this file.

Defines

#define __le32   uint32_t
#define get_unaligned(p)
#define le16_to_cpu   le_to_host16
#define le32_to_cpu   le_to_host32
#define ulong   unsigned long
#define unlikely(cond)   (cond)

Functions

int ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, struct ieee80211_radiotap_header *radiotap_header, int max_length)
int ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator)

Define Documentation

#define __le32   uint32_t

Definition at line 27 of file radiotap.c.

#define get_unaligned (   p)
Value:
({                                                              \
        struct packed_dummy_struct {                            \
                typeof(*(p)) __val;                             \
        } __attribute__((packed)) *__ptr = (void *) (p);        \
                                                                \
        __ptr->__val;                                           \
})

Definition at line 30 of file radiotap.c.

#define le16_to_cpu   le_to_host16

Definition at line 25 of file radiotap.c.

#define le32_to_cpu   le_to_host32

Definition at line 26 of file radiotap.c.

#define ulong   unsigned long

Definition at line 28 of file radiotap.c.

#define unlikely (   cond)    (cond)

Definition at line 29 of file radiotap.c.


Function Documentation

int ieee80211_radiotap_iterator_init ( struct ieee80211_radiotap_iterator iterator,
struct ieee80211_radiotap_header radiotap_header,
int  max_length 
)

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: See Documentation/networking/radiotap-headers.txt

Definition at line 80 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 158 of file radiotap.c.



wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:39