From 7dd131d6b54c408d08bfe757f71dda6342df546d Mon Sep 17 00:00:00 2001 From: Ruakij Date: Wed, 24 Nov 2021 01:11:42 +0100 Subject: [PATCH] Implemented dto-obj Packet --- src/dto/Packet.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/dto/Packet.js diff --git a/src/dto/Packet.js b/src/dto/Packet.js new file mode 100644 index 0000000..57a0120 --- /dev/null +++ b/src/dto/Packet.js @@ -0,0 +1,46 @@ +const PacketType = { + Beacon: 'Beacon', + ProbeRequest: 'ProbeRequest', + ProbeResponse: 'ProbeResponse', + Data: 'Data', + RequestToSend: 'RequestToSend', + ClearToSend: 'ClearToSend', + Acknowledgment: 'Acknowledgment', + BlockAcknowledgment: 'BlockAcknowledgment', + NoData: 'NoData', + Unknown: 'Unknown' +} + +class Packet{ + timestampMicros; + + srcMac; + dstMac; + bssid; + + signal; + frequency; + dataRate; + + packetType; +} + +// Extensions of Packet +class PacketWithSSID extends Packet{ + ssid; +} + +class BeaconPacket extends PacketWithSSID{} +class ProbeRequestPacket extends PacketWithSSID{} +class ProbeResponsePacket extends PacketWithSSID{} + + +// Specify exports +module.exports = { + PacketType, + Packet, + PacketWithSSID, + BeaconPacket, + ProbeRequestPacket, + ProbeResponsePacket +};