Skip to content

Commit

Permalink
optimize IEE80211 header usage, document
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Aug 6, 2023
1 parent 1401c21 commit 9565703
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions src/Ieee80211Header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ struct Ieee80211HeaderOpenHD{
uint8_t mac_dst_radio_port=0;
// iee80211 sequence control ( 2 bytes ) - might be overridden by the driver, and or even repurposed
uint16_t sequence_control=0;
// See the data layout above for more info
// ----------------------------------- DATA LAYOUT END -----------------------------------
/**
* We use some of the available bytes for a 8 bytes "nonce"
*/
void write_nonce(const uint64_t& nonce){
memcpy((uint8_t*)&mac_src_nonce_part1,(uint8_t*)&nonce,4);
memcpy((uint8_t*)&mac_dst_nonce_part2,((uint8_t*)&nonce)+4,4);
Expand All @@ -91,12 +94,16 @@ struct Ieee80211HeaderOpenHD{
memcpy(((uint8_t*)nonce)+4,(uint8_t*)&mac_dst_nonce_part2,4);
return nonce;
}
// NOTE: We write the radio port 2 times - this way we have a pretty reliable way to check if this is an openhd packet or packet from someone else
/**
* NOTE: We write the radio port 2 times - this way we have a pretty reliable way to check if this is an openhd packet or packet from someone else
*/
void write_radio_port_src_dst(uint8_t radio_port){
mac_src_radio_port=radio_port;
mac_dst_radio_port=radio_port;
}
// NOTE: We also write the unique id 2 times - same reason like with radio port
/*
* We also write the unique id 2 times - same reason like with radio port
*/
void write_unique_id_src_dst(uint8_t id){
mac_src_unique_id_part=id;
mac_dst_unique_id_part=id;
Expand Down
4 changes: 2 additions & 2 deletions src/WBTxRx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ void WBTxRx::on_new_packet(const uint8_t wlan_idx, const pcap_pkthdr &hdr,
}
{
// Same for iee80211 seq nr
uint16_t iee_seq_nr=parsedPacket->ieee80211Header->getSequenceNumber();
m_seq_nr_helper_iee80211.on_new_sequence_number(iee_seq_nr);
//uint16_t iee_seq_nr=parsedPacket->ieee80211Header->getSequenceNumber();
//m_seq_nr_helper_iee80211.on_new_sequence_number(iee_seq_nr);
//m_console->debug("IEE SEQ NR PACKET LOSS {}",m_seq_nr_helper_iee80211.get_current_loss_percent());
}
// Adjustment of which card is used for injecting packets in case there are multiple RX card(s)
Expand Down

0 comments on commit 9565703

Please sign in to comment.