-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEEBTPPacketManager.h
102 lines (78 loc) · 3.12 KB
/
EEBTPPacketManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* EEBTPTxQueue.h
*
* Created on: 15.08.2020
* Author: krassus
*/
#ifndef BROADCAST_EEBTPTXQUEUE_H_
#define BROADCAST_EEBTPTXQUEUE_H_
#include "ns3/wifi-mac.h"
#include "ns3/wifi-phy.h"
#include "ns3/energy-module.h"
#include "ns3/node-container.h"
#include "ns3/wifi-net-device.h"
#include "ns3/llc-snap-header.h"
#include "ns3/wifi-radio-energy-model-helper.h"
#include "ns3/EEBTPTag.h"
namespace ns3
{
class EEBTPPacketManager : public Object
{
public:
EEBTPPacketManager();
~EEBTPPacketManager();
static TypeId GetTypeId();
virtual TypeId GetInstanceTypeId() const;
void setDevice(Ptr<WifiNetDevice> device);
void sendPacket(Ptr<Packet> pkt, Mac48Address recipient);
void onRxStart(Ptr<const Packet> packet);
void onRxEnd(Ptr<const Packet> packet);
void onTx(Ptr<const Packet> packet);
void onTxStart(Ptr<const Packet> packet, double txPowerW);
void onTxDrop(Ptr<const Packet> packet);
void onTxEnd(Ptr<const Packet> packet);
void onPacketTx(Ptr<const Packet> packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu);
void onPacketRx(Ptr<const Packet> packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise);
void onTxFailed(const WifiMacHeader &header);
void onTxDropped(Ptr<const Packet> packet);
void onTxSuccessful(const WifiMacHeader &header);
void onTxFinalRtsFailed(Mac48Address address);
void onTxFinalDataFailed(Mac48Address address);
bool isPacketAcked(uint16_t seqNo);
bool isPacketLost(uint16_t seqNo);
void deleteSeqNoEntry(uint16_t seqNo);
uint16_t getSeqNoByMacSeqNo(uint16_t macSeqNo);
EEBTPTag createPacketTag(Ptr<Packet> packet, WifiTxVector txVector, SignalNoiseDbm signalNoise);
EEBTPTag getPacketTag(uint16_t seqNo);
double getTotalEnergyConsumed(uint64_t gid);
double getEnergyByRecvFrame(uint64_t gid, uint8_t ft);
double getEnergyBySentFrame(uint64_t gid, uint8_t ft);
uint32_t getDataRecv(uint64_t gid);
uint32_t getDataSent(uint64_t gid);
uint32_t getDataRecvByFrame(uint64_t gid, uint8_t ft);
uint32_t getDataSentByFrame(uint64_t gid, uint8_t ft);
uint32_t getFrameTypeRecv(uint64_t gid, uint8_t ft);
uint32_t getFrameTypeSent(uint64_t gid, uint8_t ft);
private:
Ptr<WifiNetDevice> device;
Ptr<TrafficControlLayer> tcl;
Ptr<EnergySource> energySource;
std::map<uint16_t, uint16_t> packets;
std::map<Mac48Address, uint16_t> receiver;
std::map<uint16_t, bool> packetsAcked;
std::map<uint16_t, bool> packetsLost;
std::map<uint16_t, EEBTPTag> packetTag;
std::map<Mac48Address, std::vector<uint16_t>> addrSeqCache;
double energyAtStart;
uint16_t seqNoAtStart;
std::map<uint64_t, std::map<uint8_t, double>> frameEnergySent;
std::map<uint64_t, std::map<uint8_t, double>> frameEnergyRecv;
std::map<uint64_t, uint32_t> dataSent;
std::map<uint64_t, uint32_t> dataRecv;
std::map<uint64_t, std::map<uint8_t, uint32_t>> frameDataSent;
std::map<uint64_t, std::map<uint8_t, uint32_t>> frameDataRecv;
std::map<uint64_t, std::map<uint8_t, uint32_t>> frameTypesSent;
std::map<uint64_t, std::map<uint8_t, uint32_t>> frameTypesRecv;
};
}
#endif /* BROADCAST_EEBTPTXQUEUE_H_ */