From 989aeac148e95f8cf59a557037a3bf5126c51a60 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sun, 9 Jun 2024 00:09:04 +0000 Subject: [PATCH 1/2] Restyled by astyle --- minigotchi/structs.h | 184 +++++++++++++++++++++---------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/minigotchi/structs.h b/minigotchi/structs.h index 7e15a37..ace2901 100644 --- a/minigotchi/structs.h +++ b/minigotchi/structs.h @@ -18,120 +18,120 @@ // source: // https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/components/esp8266/include/esp_wifi_types.h#L381 typedef struct { - signed rssi : 8; /**< signal intensity of packet */ - unsigned rate : 4; /**< data rate */ - unsigned is_group : 1; /**< usually not used */ - unsigned : 1; /**< reserve */ - unsigned sig_mode : 2; /**< 0:is not 11n packet; 1:is 11n packet */ - unsigned legacy_length : 12; /**< Length of 11bg mode packet */ - unsigned damatch0 : 1; /**< usually not used */ - unsigned damatch1 : 1; /**< usually not used */ - unsigned bssidmatch0 : 1; /**< usually not used */ - unsigned bssidmatch1 : 1; /**< usually not used */ - unsigned mcs : 7; /**< if is 11n packet, shows the modulation(range from 0 to + signed rssi : 8; /**< signal intensity of packet */ + unsigned rate : 4; /**< data rate */ + unsigned is_group : 1; /**< usually not used */ + unsigned : 1; /**< reserve */ + unsigned sig_mode : 2; /**< 0:is not 11n packet; 1:is 11n packet */ + unsigned legacy_length : 12; /**< Length of 11bg mode packet */ + unsigned damatch0 : 1; /**< usually not used */ + unsigned damatch1 : 1; /**< usually not used */ + unsigned bssidmatch0 : 1; /**< usually not used */ + unsigned bssidmatch1 : 1; /**< usually not used */ + unsigned mcs : 7; /**< if is 11n packet, shows the modulation(range from 0 to 76) */ - unsigned cwb : 1; /**< if is 11n packet, shows if is HT40 packet or not */ - unsigned HT_length : 16; /**< Length of 11n mode packet */ - unsigned smoothing : 1; /**< reserve */ - unsigned not_sounding : 1; /**< reserve */ - unsigned : 1; /**< reserve */ - unsigned aggregation : 1; /**< Aggregation */ - unsigned stbc : 2; /**< STBC */ - unsigned fec_coding : 1; /**< Flag is set for 11n packets which are LDPC */ - unsigned sgi : 1; /**< SGI */ - unsigned rxend_state : 8; /**< usually not used */ - unsigned ampdu_cnt : 8; /**< ampdu cnt */ - unsigned channel : 4; /**< which channel this packet in */ - unsigned : 4; /**< reserve */ - signed noise_floor : 8; /**< usually not used */ + unsigned cwb : 1; /**< if is 11n packet, shows if is HT40 packet or not */ + unsigned HT_length : 16; /**< Length of 11n mode packet */ + unsigned smoothing : 1; /**< reserve */ + unsigned not_sounding : 1; /**< reserve */ + unsigned : 1; /**< reserve */ + unsigned aggregation : 1; /**< Aggregation */ + unsigned stbc : 2; /**< STBC */ + unsigned fec_coding : 1; /**< Flag is set for 11n packets which are LDPC */ + unsigned sgi : 1; /**< SGI */ + unsigned rxend_state : 8; /**< usually not used */ + unsigned ampdu_cnt : 8; /**< ampdu cnt */ + unsigned channel : 4; /**< which channel this packet in */ + unsigned : 4; /**< reserve */ + signed noise_floor : 8; /**< usually not used */ } wifi_pkt_rx_ctrl_t; typedef struct { - wifi_pkt_rx_ctrl_t rx_ctrl; //< metadata header - uint8_t payload[0]; //< Data or management payload. Length of payload is - // described by rx_ctrl.sig_len. Type of content determined - // by packet type argument of callback. + wifi_pkt_rx_ctrl_t rx_ctrl; //< metadata header + uint8_t payload[0]; //< Data or management payload. Length of payload is + // described by rx_ctrl.sig_len. Type of content determined + // by packet type argument of callback. } wifi_promiscuous_pkt_t; typedef struct { // Size: 128 - wifi_pkt_rx_ctrl_t rx_ctrl; - uint8_t buf[1000]; - uint16_t cnt; - uint16_t len; // length of packet + wifi_pkt_rx_ctrl_t rx_ctrl; + uint8_t buf[1000]; + uint16_t cnt; + uint16_t len; // length of packet } wifi_pkt_mgmt_t; // https://github.com/justcallmekoko/ESP32Marauder/blob/master/esp32_marauder/WiFiScan.h typedef struct { - int16_t fctl; - int16_t duration; - uint8_t da; - uint8_t sa; - uint8_t bssid; - int16_t seqctl; - unsigned char payload[]; + int16_t fctl; + int16_t duration; + uint8_t da; + uint8_t sa; + uint8_t bssid; + int16_t seqctl; + unsigned char payload[]; } __attribute__((packed)) WifiMgmtHdr; typedef struct { - uint16_t length; - uint16_t seq; - uint8_t address3[6]; + uint16_t length; + uint16_t seq; + uint8_t address3[6]; } wifi_pkt_lenseq_t; typedef struct { - wifi_pkt_rx_ctrl_t rx_ctrl; - uint8_t buf[36]; - uint16_t cnt; - wifi_pkt_lenseq_t lenseq[1]; + wifi_pkt_rx_ctrl_t rx_ctrl; + uint8_t buf[36]; + uint16_t cnt; + wifi_pkt_lenseq_t lenseq[1]; } wifi_pkt_data_t; // IEEE802.11 data structures --------------------- typedef enum { - WIFI_PKT_MGMT, - WIFI_PKT_CTRL, - WIFI_PKT_DATA, - WIFI_PKT_MISC, + WIFI_PKT_MGMT, + WIFI_PKT_CTRL, + WIFI_PKT_DATA, + WIFI_PKT_MISC, } wifi_promiscuous_pkt_type_t; typedef enum { - ASSOCIATION_REQ, - ASSOCIATION_RES, - REASSOCIATION_REQ, - REASSOCIATION_RES, - PROBE_REQ, - PROBE_RES, - NU1, /* ......................*/ - NU2, /* 0110, 0111 not used */ - BEACON, - ATIM, - DISASSOCIATION, - AUTHENTICATION, - DEAUTHENTICATION, - ACTION, - ACTION_NACK, + ASSOCIATION_REQ, + ASSOCIATION_RES, + REASSOCIATION_REQ, + REASSOCIATION_RES, + PROBE_REQ, + PROBE_RES, + NU1, /* ......................*/ + NU2, /* 0110, 0111 not used */ + BEACON, + ATIM, + DISASSOCIATION, + AUTHENTICATION, + DEAUTHENTICATION, + ACTION, + ACTION_NACK, } wifi_mgmt_subtypes_t; typedef struct { - unsigned interval : 16; - unsigned capability : 16; - unsigned tag_number : 8; - unsigned tag_length : 8; - char ssid[0]; - uint8_t rates[1]; + unsigned interval : 16; + unsigned capability : 16; + unsigned tag_number : 8; + unsigned tag_length : 8; + char ssid[0]; + uint8_t rates[1]; } wifi_mgmt_beacon_t; typedef struct { - unsigned protocol : 2; - unsigned type : 2; - unsigned subtype : 4; - unsigned to_ds : 1; - unsigned from_ds : 1; - unsigned more_frag : 1; - unsigned retry : 1; - unsigned pwr_mgmt : 1; - unsigned more_data : 1; - unsigned wep : 1; - unsigned strict : 1; + unsigned protocol : 2; + unsigned type : 2; + unsigned subtype : 4; + unsigned to_ds : 1; + unsigned from_ds : 1; + unsigned more_frag : 1; + unsigned retry : 1; + unsigned pwr_mgmt : 1; + unsigned more_data : 1; + unsigned wep : 1; + unsigned strict : 1; } wifi_header_frame_control_t; /** @@ -139,20 +139,20 @@ typedef struct { * https://github.com/lpodkalicki/blog/blob/master/esp32/016_wifi_sniffer/main/main.c */ typedef struct { - wifi_header_frame_control_t frame_ctrl; - // unsigned duration_id:16; /* !!!! ugly hack */ - uint8_t addr1[6]; /* receiver address */ - uint8_t addr2[6]; /* sender address */ - uint8_t addr3[6]; /* filtering address */ - unsigned sequence_ctrl : 16; - uint8_t addr4[6]; /* optional */ + wifi_header_frame_control_t frame_ctrl; + // unsigned duration_id:16; /* !!!! ugly hack */ + uint8_t addr1[6]; /* receiver address */ + uint8_t addr2[6]; /* sender address */ + uint8_t addr3[6]; /* filtering address */ + unsigned sequence_ctrl : 16; + uint8_t addr4[6]; /* optional */ } wifi_ieee80211_mac_hdr_t; // source: // https://github.com/justcallmekoko/ESP32Marauder/blob/c0554b95ceb379d29b9a8925d27cc2c0377764a9/esp32_marauder/WiFiScan.h#L213 typedef struct { - uint8_t payload[0]; - WifiMgmtHdr hdr; + uint8_t payload[0]; + WifiMgmtHdr hdr; } wifi_ieee80211_packet_t; #endif From bb258d6506b0fd5846e77412c9bd67510c3de201 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sun, 9 Jun 2024 00:09:04 +0000 Subject: [PATCH 2/2] Restyled by clang-format --- minigotchi/structs.h | 186 +++++++++++++++++++++---------------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/minigotchi/structs.h b/minigotchi/structs.h index ace2901..8ca1a72 100644 --- a/minigotchi/structs.h +++ b/minigotchi/structs.h @@ -18,120 +18,120 @@ // source: // https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/components/esp8266/include/esp_wifi_types.h#L381 typedef struct { - signed rssi : 8; /**< signal intensity of packet */ - unsigned rate : 4; /**< data rate */ - unsigned is_group : 1; /**< usually not used */ - unsigned : 1; /**< reserve */ - unsigned sig_mode : 2; /**< 0:is not 11n packet; 1:is 11n packet */ - unsigned legacy_length : 12; /**< Length of 11bg mode packet */ - unsigned damatch0 : 1; /**< usually not used */ - unsigned damatch1 : 1; /**< usually not used */ - unsigned bssidmatch0 : 1; /**< usually not used */ - unsigned bssidmatch1 : 1; /**< usually not used */ - unsigned mcs : 7; /**< if is 11n packet, shows the modulation(range from 0 to - 76) */ - unsigned cwb : 1; /**< if is 11n packet, shows if is HT40 packet or not */ - unsigned HT_length : 16; /**< Length of 11n mode packet */ - unsigned smoothing : 1; /**< reserve */ - unsigned not_sounding : 1; /**< reserve */ - unsigned : 1; /**< reserve */ - unsigned aggregation : 1; /**< Aggregation */ - unsigned stbc : 2; /**< STBC */ - unsigned fec_coding : 1; /**< Flag is set for 11n packets which are LDPC */ - unsigned sgi : 1; /**< SGI */ - unsigned rxend_state : 8; /**< usually not used */ - unsigned ampdu_cnt : 8; /**< ampdu cnt */ - unsigned channel : 4; /**< which channel this packet in */ - unsigned : 4; /**< reserve */ - signed noise_floor : 8; /**< usually not used */ + signed rssi : 8; /**< signal intensity of packet */ + unsigned rate : 4; /**< data rate */ + unsigned is_group : 1; /**< usually not used */ + unsigned : 1; /**< reserve */ + unsigned sig_mode : 2; /**< 0:is not 11n packet; 1:is 11n packet */ + unsigned legacy_length : 12; /**< Length of 11bg mode packet */ + unsigned damatch0 : 1; /**< usually not used */ + unsigned damatch1 : 1; /**< usually not used */ + unsigned bssidmatch0 : 1; /**< usually not used */ + unsigned bssidmatch1 : 1; /**< usually not used */ + unsigned mcs : 7; /**< if is 11n packet, shows the modulation(range from 0 to + 76) */ + unsigned cwb : 1; /**< if is 11n packet, shows if is HT40 packet or not */ + unsigned HT_length : 16; /**< Length of 11n mode packet */ + unsigned smoothing : 1; /**< reserve */ + unsigned not_sounding : 1; /**< reserve */ + unsigned : 1; /**< reserve */ + unsigned aggregation : 1; /**< Aggregation */ + unsigned stbc : 2; /**< STBC */ + unsigned fec_coding : 1; /**< Flag is set for 11n packets which are LDPC */ + unsigned sgi : 1; /**< SGI */ + unsigned rxend_state : 8; /**< usually not used */ + unsigned ampdu_cnt : 8; /**< ampdu cnt */ + unsigned channel : 4; /**< which channel this packet in */ + unsigned : 4; /**< reserve */ + signed noise_floor : 8; /**< usually not used */ } wifi_pkt_rx_ctrl_t; typedef struct { - wifi_pkt_rx_ctrl_t rx_ctrl; //< metadata header - uint8_t payload[0]; //< Data or management payload. Length of payload is - // described by rx_ctrl.sig_len. Type of content determined - // by packet type argument of callback. + wifi_pkt_rx_ctrl_t rx_ctrl; //< metadata header + uint8_t payload[0]; //< Data or management payload. Length of payload is + // described by rx_ctrl.sig_len. Type of content determined + // by packet type argument of callback. } wifi_promiscuous_pkt_t; typedef struct { // Size: 128 - wifi_pkt_rx_ctrl_t rx_ctrl; - uint8_t buf[1000]; - uint16_t cnt; - uint16_t len; // length of packet + wifi_pkt_rx_ctrl_t rx_ctrl; + uint8_t buf[1000]; + uint16_t cnt; + uint16_t len; // length of packet } wifi_pkt_mgmt_t; // https://github.com/justcallmekoko/ESP32Marauder/blob/master/esp32_marauder/WiFiScan.h typedef struct { - int16_t fctl; - int16_t duration; - uint8_t da; - uint8_t sa; - uint8_t bssid; - int16_t seqctl; - unsigned char payload[]; + int16_t fctl; + int16_t duration; + uint8_t da; + uint8_t sa; + uint8_t bssid; + int16_t seqctl; + unsigned char payload[]; } __attribute__((packed)) WifiMgmtHdr; typedef struct { - uint16_t length; - uint16_t seq; - uint8_t address3[6]; + uint16_t length; + uint16_t seq; + uint8_t address3[6]; } wifi_pkt_lenseq_t; typedef struct { - wifi_pkt_rx_ctrl_t rx_ctrl; - uint8_t buf[36]; - uint16_t cnt; - wifi_pkt_lenseq_t lenseq[1]; + wifi_pkt_rx_ctrl_t rx_ctrl; + uint8_t buf[36]; + uint16_t cnt; + wifi_pkt_lenseq_t lenseq[1]; } wifi_pkt_data_t; // IEEE802.11 data structures --------------------- typedef enum { - WIFI_PKT_MGMT, - WIFI_PKT_CTRL, - WIFI_PKT_DATA, - WIFI_PKT_MISC, + WIFI_PKT_MGMT, + WIFI_PKT_CTRL, + WIFI_PKT_DATA, + WIFI_PKT_MISC, } wifi_promiscuous_pkt_type_t; typedef enum { - ASSOCIATION_REQ, - ASSOCIATION_RES, - REASSOCIATION_REQ, - REASSOCIATION_RES, - PROBE_REQ, - PROBE_RES, - NU1, /* ......................*/ - NU2, /* 0110, 0111 not used */ - BEACON, - ATIM, - DISASSOCIATION, - AUTHENTICATION, - DEAUTHENTICATION, - ACTION, - ACTION_NACK, + ASSOCIATION_REQ, + ASSOCIATION_RES, + REASSOCIATION_REQ, + REASSOCIATION_RES, + PROBE_REQ, + PROBE_RES, + NU1, /* ......................*/ + NU2, /* 0110, 0111 not used */ + BEACON, + ATIM, + DISASSOCIATION, + AUTHENTICATION, + DEAUTHENTICATION, + ACTION, + ACTION_NACK, } wifi_mgmt_subtypes_t; typedef struct { - unsigned interval : 16; - unsigned capability : 16; - unsigned tag_number : 8; - unsigned tag_length : 8; - char ssid[0]; - uint8_t rates[1]; + unsigned interval : 16; + unsigned capability : 16; + unsigned tag_number : 8; + unsigned tag_length : 8; + char ssid[0]; + uint8_t rates[1]; } wifi_mgmt_beacon_t; typedef struct { - unsigned protocol : 2; - unsigned type : 2; - unsigned subtype : 4; - unsigned to_ds : 1; - unsigned from_ds : 1; - unsigned more_frag : 1; - unsigned retry : 1; - unsigned pwr_mgmt : 1; - unsigned more_data : 1; - unsigned wep : 1; - unsigned strict : 1; + unsigned protocol : 2; + unsigned type : 2; + unsigned subtype : 4; + unsigned to_ds : 1; + unsigned from_ds : 1; + unsigned more_frag : 1; + unsigned retry : 1; + unsigned pwr_mgmt : 1; + unsigned more_data : 1; + unsigned wep : 1; + unsigned strict : 1; } wifi_header_frame_control_t; /** @@ -139,20 +139,20 @@ typedef struct { * https://github.com/lpodkalicki/blog/blob/master/esp32/016_wifi_sniffer/main/main.c */ typedef struct { - wifi_header_frame_control_t frame_ctrl; - // unsigned duration_id:16; /* !!!! ugly hack */ - uint8_t addr1[6]; /* receiver address */ - uint8_t addr2[6]; /* sender address */ - uint8_t addr3[6]; /* filtering address */ - unsigned sequence_ctrl : 16; - uint8_t addr4[6]; /* optional */ + wifi_header_frame_control_t frame_ctrl; + // unsigned duration_id:16; /* !!!! ugly hack */ + uint8_t addr1[6]; /* receiver address */ + uint8_t addr2[6]; /* sender address */ + uint8_t addr3[6]; /* filtering address */ + unsigned sequence_ctrl : 16; + uint8_t addr4[6]; /* optional */ } wifi_ieee80211_mac_hdr_t; // source: // https://github.com/justcallmekoko/ESP32Marauder/blob/c0554b95ceb379d29b9a8925d27cc2c0377764a9/esp32_marauder/WiFiScan.h#L213 typedef struct { - uint8_t payload[0]; - WifiMgmtHdr hdr; + uint8_t payload[0]; + WifiMgmtHdr hdr; } wifi_ieee80211_packet_t; #endif