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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Kirill Andreev <andreev@iitp.ru>
18 */
19
20#ifndef FLAME_PROTOCOL_MAC_H
21#define FLAME_PROTOCOL_MAC_H
22
23#include "ns3/mesh-wifi-interface-mac.h"
24
25namespace ns3
26{
27namespace flame
28{
29class FlameProtocol;
30
31/**
32 * \ingroup flame
33 *
34 * \brief Interface MAC plugin for FLAME routing protocol
35 */
37{
38 public:
39 /**
40 * Constructor
41 *
42 * \param protocol flame protocol object
43 */
45 ~FlameProtocolMac() override;
46
47 // Inherited from MAC plugin
48 /**
49 * Set parent of this instance
50 * \param parent pointer to the parent MeshWifiInterfaceMac
51 */
52 void SetParent(Ptr<MeshWifiInterfaceMac> parent) override;
53 /**
54 * Receive and process a packet; packets are given a FlameTag packet tag
55 * \param packet the packet received
56 * \param header the header
57 * \returns true if successful
58 */
59 bool Receive(Ptr<Packet> packet, const WifiMacHeader& header) override;
60 /**
61 * Process an outgoing frame. Remove the FlameTag and increment stats
62 * counters.
63 * \param packet the packet received
64 * \param header the header
65 * \param from the MAC address of the sender
66 * \param to the MAC address of the receiver
67 * \returns true if successful
68 */
70 WifiMacHeader& header,
71 Mac48Address from,
72 Mac48Address to) override;
73 /**
74 * Update beacon is empty, because FLAME does not know anything about beacons
75 * \param beacon the beacon
76 */
77 void UpdateBeacon(MeshWifiBeacon& beacon) const override{};
78
79 /**
80 * AssignStreams is empty, because this model doesn't use random variables
81 * \param stream
82 * \returns 0 (no streams used)
83 */
84 int64_t AssignStreams(int64_t stream) override
85 {
86 return 0;
87 }
88
89 /**
90 * Get channel ID function
91 * \returns the channel
92 */
93 uint16_t GetChannelId() const;
94 /**
95 * Report statistics
96 * \param os the output stream
97 */
98 void Report(std::ostream& os) const;
99 /// Reset statistics function
100 void ResetStats();
101
102 private:
103 // MeshPointDevice parameters:
106
107 /// Statistics structure
109 {
110 uint16_t txUnicast; ///< transmit unicast
111 uint16_t txBroadcast; ///< transit broadcast
112 uint32_t txBytes; ///< transmit bytes
113 uint16_t rxUnicast; ///< receive unicast
114 uint16_t rxBroadcast; ///< receive broadcast
115 uint32_t rxBytes; ///< receive bytes
116
117 /**
118 * Print function
119 * \param os the output stream
120 */
121 void Print(std::ostream& os) const;
122 /// constructor
123 Statistics();
124 };
125
126 Statistics m_stats; ///< statistics
127};
128} // namespace flame
129} // namespace ns3
130#endif /* FLAME_PROTOCOL_MAC_H */
an EUI-48 address
Definition: mac48-address.h:46
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.
Definition: ptr.h:77
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 UpdateBeacon(MeshWifiBeacon &beacon) const override
Update beacon is empty, because FLAME does not know anything about beacons.
Ptr< FlameProtocol > m_protocol
protocol
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.