forked from fnoop/wifibroadcast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.h
45 lines (32 loc) · 1.03 KB
/
lib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include <stdint.h>
#include <stdlib.h>
#include "wifibroadcast.h"
typedef struct {
uint32_t received_packet_cnt;
uint32_t wrong_crc_cnt;
int8_t current_signal_dbm;
} wifi_adapter_rx_status_t;
typedef struct {
time_t last_update;
uint32_t received_block_cnt;
uint32_t damaged_block_cnt;
uint32_t tx_restart_cnt;
uint32_t wifi_adapter_cnt;
wifi_adapter_rx_status_t adapter[MAX_PENUMBRA_INTERFACES];
} wifibroadcast_rx_status_t;
typedef struct {
int valid;
int crc_correct;
size_t len; //this is the actual length of the packet stored in data
uint8_t *data;
} packet_buffer_t;
//this sits at the payload of the wifi packet (outside of FEC)
typedef struct {
uint32_t sequence_number;
} __attribute__((packed)) wifi_packet_header_t;
//this sits at the data payload (which is usually right after the wifi_packet_header_t) (inside of FEC)
typedef struct {
uint32_t data_length;
} __attribute__((packed)) payload_header_t;
packet_buffer_t *lib_alloc_packet_buffer_list(size_t num_packets, size_t packet_length);