libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
|
Go to the source code of this file.
Data Structures | |
struct | radiotap_override |
struct | radiotap_align_size |
struct | ieee80211_radiotap_namespace |
struct | ieee80211_radiotap_vendor_namespaces |
struct | ieee80211_radiotap_iterator |
struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args @this_arg_index: index of current arg, valid after each successful call to ieee80211_radiotap_iterator_next() @this_arg: pointer to current radiotap arg; it is valid after each call to ieee80211_radiotap_iterator_next() but also after ieee80211_radiotap_iterator_init() where it will point to the beginning of the actual data portion @this_arg_size: length of the current arg, for convenience @current_namespace: pointer to the current namespace definition (or internally NULL if the current namespace is unknown) @is_radiotap_ns: indicates whether the current namespace is the default radiotap namespace or not More... | |
Macros | |
#define | CALLING_CONVENTION |
Functions | |
IMPORT CALLING_CONVENTION 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 @iterator: radiotap_iterator to initialize @radiotap_header: radiotap header to parse @max_length: total length we can parse into (eg, whole packet length) More... | |
IMPORT CALLING_CONVENTION int | ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator) |
ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg @iterator: radiotap_iterator to move to next arg (if any) More... | |
#define CALLING_CONVENTION |
Definition at line 90 of file radiotap_iter.h.
IMPORT CALLING_CONVENTION 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 @iterator: radiotap_iterator to initialize @radiotap_header: radiotap header to parse @max_length: 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 @this_arg 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 @this_arg_index 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 179 of file radiotap.c.
IMPORT CALLING_CONVENTION int ieee80211_radiotap_iterator_next | ( | struct ieee80211_radiotap_iterator * | iterator | ) |
ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg @iterator: 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 @this_arg_index and sets @this_arg to point to the payload for the field. It takes care of alignment handling and extended present fields. @this_arg 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 endianness 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 317 of file radiotap.c.