Compare commits
No commits in common. "bbd96232563d53ef657de4b12ec8a493c537908d" and "ca1b59e4c6b13cc2181293abd885d9d70f615635" have entirely different histories.
bbd9623256
...
ca1b59e4c6
@ -3,19 +3,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
enum PacketType {
|
|
||||||
Beacon,
|
|
||||||
ProbeRequest,
|
|
||||||
ProbeResponse,
|
|
||||||
Data,
|
|
||||||
RequestToSend,
|
|
||||||
ClearToSend,
|
|
||||||
Acknowledgment,
|
|
||||||
BlockAcknowledgment,
|
|
||||||
NoData,
|
|
||||||
Unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Packet {
|
struct Packet {
|
||||||
uint64_t timestampMicros;
|
uint64_t timestampMicros;
|
||||||
|
|
||||||
@ -29,7 +16,7 @@ struct Packet {
|
|||||||
unsigned int frequency;
|
unsigned int frequency;
|
||||||
unsigned char dataRate;
|
unsigned char dataRate;
|
||||||
|
|
||||||
PacketType type;
|
std::string type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* C42FA9F6_8CF3_453F_8FA0_918E543DCD59 */
|
#endif /* C42FA9F6_8CF3_453F_8FA0_918E543DCD59 */
|
||||||
|
@ -10,19 +10,6 @@
|
|||||||
#include "../helper/split.hpp"
|
#include "../helper/split.hpp"
|
||||||
#include "../helper/timestampConvert.hpp"
|
#include "../helper/timestampConvert.hpp"
|
||||||
#include "../helper/find.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){
|
void textPacketHandler(std::vector<std::string> textPacket){
|
||||||
/// Here we have to parse the packet
|
/// Here we have to parse the packet
|
||||||
@ -76,26 +63,6 @@ void textPacketHandler(std::vector<std::string> textPacket){
|
|||||||
packet.srcMac = sAddr;
|
packet.srcMac = sAddr;
|
||||||
packet.dstMac = dAddr;
|
packet.dstMac = dAddr;
|
||||||
packet.bssid = bssidAddr;
|
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 */
|
#endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */
|
||||||
|
@ -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 */
|
|
Loading…
x
Reference in New Issue
Block a user