#ifndef __IFNOW_H__ #define __IFNOW_H__ #define IFNOW_MAX_RECEIVE (512) #define DATARATE_1Mbps 0x02 #define DATARATE_2Mbps 0x04 #define DATARATE_6Mbps 0x0c #define DATARATE_9Mbps 0x12 #define DATARATE_12Mbps 0x18 #define DATARATE_18Mbps 0x24 #define DATARATE_24Mbps 0x30 #define DATARATE_36Mbps 0x48 #define DATARATE_48Mbps 0x60 #define DATARATE_54Mbps 0x6c #define CHANNEL_freq_1 2412 #define CHANNEL_freq_2 2417 #define CHANNEL_freq_3 2422 #define CHANNEL_freq_4 2427 #define CHANNEL_freq_5 2432 #define CHANNEL_freq_6 2437 #define CHANNEL_freq_7 2442 #define CHANNEL_freq_8 2447 #define CHANNEL_freq_9 2452 #define CHANNEL_freq_10 2457 #define CHANNEL_freq_11 2462 #define CHANNEL_freq_12 2467 #define CHANNEL_freq_13 2472 #define WLAN_LEN 24 #define ACTIONFRAME_HEADER_LEN 8 #define VENDORSPECIFIC_CONTENT_LEN 7 struct IEEE80211_radiotap { uint8_t version; uint8_t pad; uint16_t length; uint32_t present; uint8_t flags; uint8_t datarate; uint16_t channel_freq; uint16_t channel_flags_quarter; }; #define IFNOW_RADIOTAP_DEFAULT() {\ .version = 0,\ .pad = 0,\ .length = sizeof(struct IEEE80211_radiotap),\ .present = 0x0000000e,\ .flags = 0x10,\ .datarate = DATARATE_6Mbps,\ .channel_freq = CHANNEL_freq_1,\ .channel_flags_quarter = 0x00c0,\ } struct IEEE80211_vendorspecific { uint8_t elementID; uint8_t length; uint8_t OUI[3]; uint8_t type; uint8_t version; uint8_t payload[250]; } __attribute__((__packed__)); #define IFNOW_VENDORSPECIFIC_DEFAULT() {\ .elementID = 0xdd,\ .OUI[0] = 0x18,\ .OUI[1] = 0xfe,\ .OUI[2] = 0x34,\ .type = 0x04,\ .version = 0x01,\ } struct IEEE80211_actionframe { uint8_t category_code; uint8_t OUI[3]; uint8_t unknown_bytes[4]; struct IEEE80211_vendorspecific content; } __attribute__((__packed__)); #define IFNOW_ACTIONFRAME_DEFAULT() {\ .category_code = 0x7f,\ .OUI[0] = 0x18,\ .OUI[1] = 0xfe,\ .OUI[2] = 0x34,\ } struct IEEE80211_wlan { uint8_t type; uint8_t flags; uint16_t duration; uint8_t da[6]; uint8_t sa[6]; uint8_t bssid[6]; uint16_t seq; struct IEEE80211_actionframe actionframe; uint32_t fcs; }; #define IFNOW_WLAN_DEFAULT() {\ .type = 0xd0,\ .flags = 0x00,\ .duration = 0x0000,\ .seq = 0x0280,\ .fcs = 0x00000000,\ } typedef struct { struct IEEE80211_radiotap radiotap; struct IEEE80211_wlan wlan; } ifnow_packet_t; #endif // __IFNOW_H__