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 /**
64 * Update beacon is empty, because FLAME does not know anything about beacons
65 * @param beacon the beacon
66 */
67 void UpdateBeacon(MeshWifiBeacon& beacon) const override
68 {
69 }
70
71 /**
72 * AssignStreams is empty, because this model doesn't use random variables
73 * @param stream
74 * @returns 0 (no streams used)
75 */
76 int64_t AssignStreams(int64_t stream) override
77 {
78 return 0;
79 }
80
81 /**
82 * Get channel ID function
83 * @returns the channel
84 */
85 uint16_t GetChannelId() const;
86 /**
87 * Report statistics
88 * @param os the output stream
89 */
90 void Report(std::ostream& os) const;
91 /// Reset statistics function
92 void ResetStats();
93
94 private:
95 // MeshPointDevice parameters:
98
99 /// Statistics structure
101 {
102 uint16_t txUnicast; ///< transmit unicast
103 uint16_t txBroadcast; ///< transit broadcast
104 uint32_t txBytes; ///< transmit bytes
105 uint16_t rxUnicast; ///< receive unicast
106 uint16_t rxBroadcast; ///< receive broadcast
107 uint32_t rxBytes; ///< receive bytes
108
109 /**
110 * Print function
111 * @param os the output stream
112 */
113 void Print(std::ostream& os) const;
114 /// constructor
115 Statistics();
116 };
117
118 Statistics m_stats; ///< statistics
119};
120} // namespace flame
121} // namespace ns3
122#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.