ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
radio_sniff.h File Reference

Receive-only radio channel sniffer -> pcap capture records (PROTOCORE_ENABLE_RADIO_SNIFF). More...

#include "protocore_config.h"

Go to the source code of this file.

Classes

struct  RadioSniffNs
 Dispatch table. Addressed by offset, so the layout is asserted below. More...
 

Macros

#define RADIO_SNIFF_TAP_LEN   20
 The TAP pseudo-header length this codec emits: 4 header + RSSI TLV(8) + channel TLV(8).
 

Functions

 PROTOCORE_NS_LAYOUT (RadioSniffNs, global_header, i2f32, tap_record)
 
size_t protocore_radio_sniff_global_header (uint8_t *work, uint8_t *out, size_t cap)
 Write the pcap global header for a TAP-framed 802.15.4 sniff. 24, .
 
uint32_t protocore_radio_sniff_i2f32 (uint8_t *work, int32_t dbm)
 Encode a signed integer dBm value as an IEEE-754 float32 .
 
size_t protocore_radio_sniff_tap_record (uint8_t *work, uint8_t *out, size_t cap, const uint8_t *frame, size_t flen, int32_t rssi_dbm, uint16_t channel, uint32_t ts_sec, uint32_t ts_usec)
 Write one capture record: a pcap record header, the 802.15.4 TAP .
 

Variables

PROTOCORE_NS RadioSniffNs RadioSniff PROTOCORE_UNUSED
 Module namespace.
 

Detailed Description

Receive-only radio channel sniffer -> pcap capture records (PROTOCORE_ENABLE_RADIO_SNIFF).

The RF gateway drivers (CC1101, LoRa, the Thread 802.15.4 RCP) can run receive-only - sniff a channel without joining - and the frames they pull off the air belong in the same capture pipeline as the CAN and Wi-Fi captures (shared/protocore_pcap). For 802.15.4 that means wrapping each frame in the Wireshark IEEE 802.15.4 TAP pseudo-header so the per-frame RSSI and channel travel with it, then a standard pcap record, giving a .pcap a wired Wireshark opens with the radio metadata intact.

This is that pure framing: ::protocore_radiosniff_global writes the pcap global header (DLT TAP), and ::protocore_radiosniff_tap_record writes one record (TAP header + RSSI/channel TLVs + the MAC frame). The radio drivers own the receive; this owns the on-wire capture bytes. No heap, no stdlib, host-testable.

work is bytes the CALLER holds. This module reads none of them: it carries nothing between calls, so there is no state to keep and nothing to wipe. The parameter is there so a caller drives every namespace the same way.

Definition in file radio_sniff.h.

Macro Definition Documentation

◆ RADIO_SNIFF_TAP_LEN

#define RADIO_SNIFF_TAP_LEN   20

The TAP pseudo-header length this codec emits: 4 header + RSSI TLV(8) + channel TLV(8).

Definition at line 35 of file radio_sniff.h.

Function Documentation

◆ PROTOCORE_NS_LAYOUT()

PROTOCORE_NS_LAYOUT ( RadioSniffNs  ,
global_header  ,
i2f32  ,
tap_record   
)

◆ protocore_radio_sniff_global_header()

size_t protocore_radio_sniff_global_header ( uint8_t *  work,
uint8_t *  out,
size_t  cap 
)

Write the pcap global header for a TAP-framed 802.15.4 sniff. 24, .

Parameters
workPROTOCORE_RADIO_SNIFF_BORROW bytes the caller took. Not held past the call.
outOut
capCap
Returns
The size_t.

◆ protocore_radio_sniff_i2f32()

uint32_t protocore_radio_sniff_i2f32 ( uint8_t *  work,
int32_t  dbm 
)

Encode a signed integer dBm value as an IEEE-754 float32 .

Parameters
workPROTOCORE_RADIO_SNIFF_BORROW bytes the caller took. Not held past the call.
dbmDbm
Returns
The uint32_t.

◆ protocore_radio_sniff_tap_record()

size_t protocore_radio_sniff_tap_record ( uint8_t *  work,
uint8_t *  out,
size_t  cap,
const uint8_t *  frame,
size_t  flen,
int32_t  rssi_dbm,
uint16_t  channel,
uint32_t  ts_sec,
uint32_t  ts_usec 
)

Write one capture record: a pcap record header, the 802.15.4 TAP .

Parameters
workPROTOCORE_RADIO_SNIFF_BORROW bytes the caller took. Not held past the call.
outOut
capCap
frameFrame
flenFlen
rssi_dbmRssi dbm
channelChannel
ts_secTs sec
ts_usecTs usec
Returns
The size_t.

Variable Documentation

◆ PROTOCORE_UNUSED

PROTOCORE_NS RadioSniffNs RadioSniff PROTOCORE_UNUSED
Initial value:
size_t protocore_radio_sniff_global_header(uint8_t *work, uint8_t *out, size_t cap)
Write the pcap global header for a TAP-framed 802.15.4 sniff. 24, .
size_t protocore_radio_sniff_tap_record(uint8_t *work, uint8_t *out, size_t cap, const uint8_t *frame, size_t flen, int32_t rssi_dbm, uint16_t channel, uint32_t ts_sec, uint32_t ts_usec)
Write one capture record: a pcap record header, the 802.15.4 TAP .
uint32_t protocore_radio_sniff_i2f32(uint8_t *work, int32_t dbm)
Encode a signed integer dBm value as an IEEE-754 float32 .

Module namespace.

Definition at line 78 of file radio_sniff.h.