Compare commits

..

No commits in common. "bbd96232563d53ef657de4b12ec8a493c537908d" and "ca1b59e4c6b13cc2181293abd885d9d70f615635" have entirely different histories.

3 changed files with 1 additions and 62 deletions

View File

@ -3,19 +3,6 @@
#include <string>
enum PacketType {
Beacon,
ProbeRequest,
ProbeResponse,
Data,
RequestToSend,
ClearToSend,
Acknowledgment,
BlockAcknowledgment,
NoData,
Unknown
};
struct Packet {
uint64_t timestampMicros;
@ -29,7 +16,7 @@ struct Packet {
unsigned int frequency;
unsigned char dataRate;
PacketType type;
std::string type;
};
#endif /* C42FA9F6_8CF3_453F_8FA0_918E543DCD59 */

View File

@ -10,19 +10,6 @@
#include "../helper/split.hpp"
#include "../helper/timestampConvert.hpp"
#include "../helper/find.hpp"
#include "../helper/vector-stats.hpp"
#include <unordered_map>
const std::unordered_map<std::string, PacketType> PACKET_TYPE_MAP({
{"Beacon", PacketType::Beacon},
{"Probe Request", PacketType::ProbeRequest},
{"Probe Response", PacketType::ProbeResponse},
{"Data", PacketType::Data},
{"Request-To-Send", PacketType::RequestToSend},
{"Clear-To-Send", PacketType::ClearToSend},
{"Acknowledgment", PacketType::Acknowledgment},
{"BA", PacketType::BlockAcknowledgment}
});
void textPacketHandler(std::vector<std::string> textPacket){
/// Here we have to parse the packet
@ -76,26 +63,6 @@ void textPacketHandler(std::vector<std::string> textPacket){
packet.srcMac = sAddr;
packet.dstMac = dAddr;
packet.bssid = bssidAddr;
// Identify type of packet
// -> comes right after the addresses
int typeIndex = max(std::vector({saIndex, daIndex, bssidIndex, taIndex, raIndex}))+1;
PacketType type = PacketType::Unknown;
if(typeIndex == headerData.size()) type = PacketType::NoData;
else {
std::string textType = headerData[typeIndex];
// Check for incomplete types
if(textType == "Probe"){
textType += " "+ headerData[typeIndex+1];
}
// If type is in map, use map-value, otherwise keep default
if(PACKET_TYPE_MAP.find(textType) != PACKET_TYPE_MAP.end())
type = PACKET_TYPE_MAP[textType];
}
//
}
#endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */

View File

@ -1,15 +0,0 @@
#ifndef C437A277_1F23_496D_9B69_A21D771ECA91
#define C437A277_1F23_496D_9B69_A21D771ECA91
#include <vector>
#include <limits.h>
int max(std::vector<int> vec){
int max = INT_MIN;
for(int i=0; i<vec.size(); ++i){
if(vec[i] > max) max = vec[i];
}
return max;
}
#endif /* C437A277_1F23_496D_9B69_A21D771ECA91 */