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
* 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
14
namespace
ns3
15
{
16
namespace
flame
17
{
18
class
FlameProtocol;
19
20
/**
21
* \ingroup flame
22
*
23
* \brief Interface MAC plugin for FLAME routing protocol
24
*/
25
class
FlameProtocolMac
:
public
MeshWifiInterfaceMacPlugin
26
{
27
public
:
28
/**
29
* Constructor
30
*
31
* \param protocol flame protocol object
32
*/
33
FlameProtocolMac
(
Ptr<FlameProtocol>
protocol);
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
*/
58
bool
UpdateOutcomingFrame
(
Ptr<Packet>
packet,
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:
93
Ptr<FlameProtocol>
m_protocol
;
///< protocol
94
Ptr<MeshWifiInterfaceMac>
m_parent
;
///< parent
95
96
/// Statistics structure
97
struct
Statistics
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 */
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::MeshWifiBeacon
Beacon is beacon header + list of arbitrary information elements.
Definition
mesh-wifi-beacon.h:31
ns3::MeshWifiInterfaceMacPlugin
Common interface for mesh point interface MAC plugins.
Definition
mesh-wifi-interface-mac-plugin.h:31
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition
wifi-mac-header.h:87
ns3::flame::FlameProtocolMac
Interface MAC plugin for FLAME routing protocol.
Definition
flame-protocol-mac.h:26
ns3::flame::FlameProtocolMac::~FlameProtocolMac
~FlameProtocolMac() override
Definition
flame-protocol-mac.cc:30
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:73
ns3::flame::FlameProtocolMac::m_stats
Statistics m_stats
statistics
Definition
flame-protocol-mac.h:115
ns3::flame::FlameProtocolMac::ResetStats
void ResetStats()
Reset statistics function.
Definition
flame-protocol-mac.cc:146
ns3::flame::FlameProtocolMac::Report
void Report(std::ostream &os) const
Report statistics.
Definition
flame-protocol-mac.cc:137
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:66
ns3::flame::FlameProtocolMac::m_protocol
Ptr< FlameProtocol > m_protocol
protocol
Definition
flame-protocol-mac.h:93
ns3::flame::FlameProtocolMac::FlameProtocolMac
FlameProtocolMac(Ptr< FlameProtocol > protocol)
Constructor.
Definition
flame-protocol-mac.cc:25
ns3::flame::FlameProtocolMac::GetChannelId
uint16_t GetChannelId() const
Get channel ID function.
Definition
flame-protocol-mac.cc:98
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:70
ns3::flame::FlameProtocolMac::SetParent
void SetParent(Ptr< MeshWifiInterfaceMac > parent) override
Set parent of this instance.
Definition
flame-protocol-mac.cc:37
ns3::flame::FlameProtocolMac::m_parent
Ptr< MeshWifiInterfaceMac > m_parent
parent
Definition
flame-protocol-mac.h:94
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:43
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:98
ns3::flame::FlameProtocolMac::Statistics::rxBytes
uint32_t rxBytes
receive bytes
Definition
flame-protocol-mac.h:104
ns3::flame::FlameProtocolMac::Statistics::txUnicast
uint16_t txUnicast
transmit unicast
Definition
flame-protocol-mac.h:99
ns3::flame::FlameProtocolMac::Statistics::txBroadcast
uint16_t txBroadcast
transit broadcast
Definition
flame-protocol-mac.h:100
ns3::flame::FlameProtocolMac::Statistics::txBytes
uint32_t txBytes
transmit bytes
Definition
flame-protocol-mac.h:101
ns3::flame::FlameProtocolMac::Statistics::rxUnicast
uint16_t rxUnicast
receive unicast
Definition
flame-protocol-mac.h:102
ns3::flame::FlameProtocolMac::Statistics::Print
void Print(std::ostream &os) const
Print function.
Definition
flame-protocol-mac.cc:114
ns3::flame::FlameProtocolMac::Statistics::Statistics
Statistics()
constructor
Definition
flame-protocol-mac.cc:103
ns3::flame::FlameProtocolMac::Statistics::rxBroadcast
uint16_t rxBroadcast
receive broadcast
Definition
flame-protocol-mac.h:103
src
mesh
model
flame
flame-protocol-mac.h
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0