4#ifndef PROTOCORE_PROMISC_H
5#define PROTOCORE_PROMISC_H
39EMBED_ENUM_BYTE(WifiFrameType, WIFI_FT_MGMT = 0, WIFI_FT_CTRL = 1, WIFI_FT_DATA = 2, WIFI_FT_EXT = 3, );
72 void (*
end)(uint8_t *);
#define PROTOCORE_UNUSED
Suppress the unused warning. Every module ends in a namespace most callers only partly use.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
embed_bool protocore_promisc_begin(uint8_t *work, uint8_t channel, protocore_promisc_sink_fn sink)
Start promiscuous capture on channel; every frame is delivered to .
EMBED_ENUM_BYTE(WifiFrameType, WIFI_FT_MGMT=0, WIFI_FT_CTRL=1, WIFI_FT_DATA=2, WIFI_FT_EXT=3,)
802.11 frame type (frame-control bits 2-3).
void protocore_promisc_end(uint8_t *work)
Stop promiscuous capture.
uint8_t * protocore_promisc_span(void)
The PROTOCORE_PROMISC_BORROW bytes this module's state lives in.
void protocore_promisc_set_channel(const uint8_t *work, uint8_t channel)
Retune the capture to a different channel (1..14).
embed_bool protocore_promisc_wifi_frame_parse(const uint8_t *work, const uint8_t *frame, uint16_t len, WifiFrameInfo *out)
Parse an 802.11 MAC header (IEEE 802.11 §9.2 / §9.3.2, the .
void(* protocore_promisc_sink_fn)(const uint8_t *frame, uint16_t len, int8_t rssi, uint8_t channel)
Sink for one captured frame: the raw 802.11 bytes plus radio metadata.
Dispatch table. Addressed by offset, so the layout is asserted below.
void(* set_channel)(const uint8_t *, uint8_t)
embed_bool(* begin)(uint8_t *, uint8_t, protocore_promisc_sink_fn)
embed_bool(* wifi_frame_parse)(const uint8_t *, const uint8_t *, uint16_t, WifiFrameInfo *)
Decoded 802.11 MAC header. src / dst / bssid point into the frame (6 bytes) or null.
const uint8_t * src
source (transmitter) MAC
embed_bool is_qos
QoS data subtype (adds 2 header bytes).
uint16_t hdr_len
MAC header length (bytes).
embed_bool protected_frame
the Protected-Frame (WEP/CCMP) bit
uint16_t seq
12-bit sequence number
const uint8_t * dst
destination (receiver) MAC, per the to/from-DS layout
const uint8_t * bssid
BSSID (null for a WDS 4-address frame).
WifiFrameType type
WifiFrameType.