A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
flame-protocol-mac.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 IITP RAS
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Kirill Andreev <andreev@iitp.ru>
7 */
8
9#ifndef FLAME_PROTOCOL_MAC_H
10#define FLAME_PROTOCOL_MAC_H
11
12#include "ns3/mesh-wifi-interface-mac.h"
13
14namespace ns3
15{
16namespace flame
17{
18class FlameProtocol;
19
20/**
21 * \ingroup flame
22 *
23 * \brief Interface MAC plugin for FLAME routing protocol
24 */
26{
27 public:
28 /**
29 * Constructor
30 *
31 * \param protocol flame protocol object
32 */
34 ~FlameProtocolMac() override;
35
36 // Inherited from MAC plugin
37 /**
38 * Set parent of this instance
39 * \param parent pointer to the parent MeshWifiInterfaceMac
40 */
41 void SetParent(Ptr<MeshWifiInterfaceMac> parent) override;
42 /**
43 * Receive and process a packet; packets are given a FlameTag packet tag
44 * \param packet the packet received
45 * \param header the header
46 * \returns true if successful
47 */
48 bool Receive(Ptr<Packet> packet, const WifiMacHeader& header) override;
49 /**
50 * Process an outgoing frame. Remove the FlameTag and increment stats
51 * counters.
52 * \param packet the packet received
53 * \param header the header
54 * \param from the MAC address of the sender
55 * \param to the MAC address of the receiver
56 * \returns true if successful
57 */
59 WifiMacHeader& header,
60 Mac48Address from,
61 Mac48Address to) override;
62 /**
63 * Update beacon is empty, because FLAME does not know anything about beacons
64 * \param beacon the beacon
65 */
66 void UpdateBeacon(MeshWifiBeacon& beacon) const override{};
67
68 /**
69 * AssignStreams is empty, because this model doesn't use random variables
70 * \param stream
71 * \returns 0 (no streams used)
72 */
73 int64_t AssignStreams(int64_t stream) override
74 {
75 return 0;
76 }
77
78 /**
79 * Get channel ID function
80 * \returns the channel
81 */
82 uint16_t GetChannelId() const;
83 /**
84 * Report statistics
85 * \param os the output stream
86 */
87 void Report(std::ostream& os) const;
88 /// Reset statistics function
89 void ResetStats();
90
91 private:
92 // MeshPointDevice parameters:
95
96 /// Statistics structure
98 {
99 uint16_t txUnicast; ///< transmit unicast
100 uint16_t txBroadcast; ///< transit broadcast
101 uint32_t txBytes; ///< transmit bytes
102 uint16_t rxUnicast; ///< receive unicast
103 uint16_t rxBroadcast; ///< receive broadcast
104 uint32_t rxBytes; ///< receive bytes
105
106 /**
107 * Print function
108 * \param os the output stream
109 */
110 void Print(std::ostream& os) const;
111 /// constructor
112 Statistics();
113 };
114
115 Statistics m_stats; ///< statistics
116};
117} // namespace flame
118} // namespace ns3
119#endif /* FLAME_PROTOCOL_MAC_H */
an EUI-48 address
Beacon is beacon header + list of arbitrary information elements.
Common interface for mesh point interface MAC plugins.
Smart pointer class similar to boost::intrusive_ptr.
Implements the IEEE 802.11 MAC header.
Interface MAC plugin for FLAME routing protocol.
int64_t AssignStreams(int64_t stream) override
AssignStreams is empty, because this model doesn't use random variables.
void ResetStats()
Reset statistics function.
void Report(std::ostream &os) const
Report statistics.
void UpdateBeacon(MeshWifiBeacon &beacon) const override
Update beacon is empty, because FLAME does not know anything about beacons.
Ptr< FlameProtocol > m_protocol
protocol
FlameProtocolMac(Ptr< FlameProtocol > protocol)
Constructor.
uint16_t GetChannelId() const
Get channel ID function.
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) override
Process an outgoing frame.
void SetParent(Ptr< MeshWifiInterfaceMac > parent) override
Set parent of this instance.
Ptr< MeshWifiInterfaceMac > m_parent
parent
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header) override
Receive and process a packet; packets are given a FlameTag packet tag.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Print(std::ostream &os) const
Print function.