A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
25
namespace
ns3
26
{
27
namespace
flame
28
{
29
class
FlameProtocol;
30
31
/**
32
* \ingroup flame
33
*
34
* \brief Interface MAC plugin for FLAME routing protocol
35
*/
36
class
FlameProtocolMac
:
public
MeshWifiInterfaceMacPlugin
37
{
38
public
:
39
/**
40
* Constructor
41
*
42
* \param protocol flame protocol object
43
*/
44
FlameProtocolMac
(
Ptr<FlameProtocol>
protocol);
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
*/
69
bool
UpdateOutcomingFrame
(
Ptr<Packet>
packet,
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:
104
Ptr<FlameProtocol>
m_protocol
;
///< protocol
105
Ptr<MeshWifiInterfaceMac>
m_parent
;
///< parent
106
107
/// Statistics structure
108
struct
Statistics
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 */
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::MeshWifiBeacon
Beacon is beacon header + list of arbitrary information elements.
Definition:
mesh-wifi-beacon.h:42
ns3::MeshWifiInterfaceMacPlugin
Common interface for mesh point interface MAC plugins.
Definition:
mesh-wifi-interface-mac-plugin.h:42
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition:
wifi-mac-header.h:98
ns3::flame::FlameProtocolMac
Interface MAC plugin for FLAME routing protocol.
Definition:
flame-protocol-mac.h:37
ns3::flame::FlameProtocolMac::~FlameProtocolMac
~FlameProtocolMac() override
Definition:
flame-protocol-mac.cc:41
ns3::flame::FlameProtocolMac::AssignStreams
int64_t AssignStreams(int64_t stream) override
AssignStreams is empty, because this model doesn't use random variables.
Definition:
flame-protocol-mac.h:84
ns3::flame::FlameProtocolMac::m_stats
Statistics m_stats
statistics
Definition:
flame-protocol-mac.h:126
ns3::flame::FlameProtocolMac::ResetStats
void ResetStats()
Reset statistics function.
Definition:
flame-protocol-mac.cc:157
ns3::flame::FlameProtocolMac::UpdateBeacon
void UpdateBeacon(MeshWifiBeacon &beacon) const override
Update beacon is empty, because FLAME does not know anything about beacons.
Definition:
flame-protocol-mac.h:77
ns3::flame::FlameProtocolMac::m_protocol
Ptr< FlameProtocol > m_protocol
protocol
Definition:
flame-protocol-mac.h:104
ns3::flame::FlameProtocolMac::GetChannelId
uint16_t GetChannelId() const
Get channel ID function.
Definition:
flame-protocol-mac.cc:109
ns3::flame::FlameProtocolMac::UpdateOutcomingFrame
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) override
Process an outgoing frame.
Definition:
flame-protocol-mac.cc:81
ns3::flame::FlameProtocolMac::SetParent
void SetParent(Ptr< MeshWifiInterfaceMac > parent) override
Set parent of this instance.
Definition:
flame-protocol-mac.cc:48
ns3::flame::FlameProtocolMac::m_parent
Ptr< MeshWifiInterfaceMac > m_parent
parent
Definition:
flame-protocol-mac.h:105
ns3::flame::FlameProtocolMac::Receive
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header) override
Receive and process a packet; packets are given a FlameTag packet tag.
Definition:
flame-protocol-mac.cc:54
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::flame::FlameProtocolMac::Statistics
Statistics structure.
Definition:
flame-protocol-mac.h:109
ns3::flame::FlameProtocolMac::Statistics::rxBytes
uint32_t rxBytes
receive bytes
Definition:
flame-protocol-mac.h:115
ns3::flame::FlameProtocolMac::Statistics::txUnicast
uint16_t txUnicast
transmit unicast
Definition:
flame-protocol-mac.h:110
ns3::flame::FlameProtocolMac::Statistics::txBroadcast
uint16_t txBroadcast
transit broadcast
Definition:
flame-protocol-mac.h:111
ns3::flame::FlameProtocolMac::Statistics::txBytes
uint32_t txBytes
transmit bytes
Definition:
flame-protocol-mac.h:112
ns3::flame::FlameProtocolMac::Statistics::rxUnicast
uint16_t rxUnicast
receive unicast
Definition:
flame-protocol-mac.h:113
ns3::flame::FlameProtocolMac::Statistics::Print
void Print(std::ostream &os) const
Print function.
Definition:
flame-protocol-mac.cc:125
ns3::flame::FlameProtocolMac::Statistics::Statistics
Statistics()
constructor
Definition:
flame-protocol-mac.cc:114
ns3::flame::FlameProtocolMac::Statistics::rxBroadcast
uint16_t rxBroadcast
receive broadcast
Definition:
flame-protocol-mac.h:114
src
mesh
model
flame
flame-protocol-mac.h
Generated on Tue May 28 2024 23:38:11 for ns-3 by
1.9.6