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
uan-mac-aloha.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Leonard Tracy <lentracy@gmail.com>
7
*/
8
9
#ifndef UAN_MAC_ALOHA_H
10
#define UAN_MAC_ALOHA_H
11
12
#include "
uan-mac.h
"
13
14
#include "ns3/mac8-address.h"
15
16
namespace
ns3
17
{
18
19
class
UanPhy
;
20
class
UanTxMode
;
21
22
/**
23
* @ingroup uan
24
*
25
* ALOHA MAC Protocol, the simplest MAC protocol for wireless networks.
26
*
27
* Packets enqueued are immediately transmitted. This MAC attaches
28
* a UanHeaderCommon to outgoing packets for address information.
29
* (The type field is not used)
30
*/
31
class
UanMacAloha
:
public
UanMac
32
{
33
public
:
34
/** Default constructor */
35
UanMacAloha
();
36
/** Dummy destructor, see DoDispose. */
37
~UanMacAloha
()
override
;
38
/**
39
* Register this type.
40
* @return The TypeId.
41
*/
42
static
TypeId
GetTypeId
();
43
44
// Inherited methods
45
bool
Enqueue
(
Ptr<Packet>
pkt, uint16_t protocolNumber,
const
Address
& dest)
override
;
46
void
SetForwardUpCb
(
Callback
<
void
,
Ptr<Packet>
, uint16_t,
const
Mac8Address
&> cb)
override
;
47
void
AttachPhy
(
Ptr<UanPhy>
phy)
override
;
48
void
Clear
()
override
;
49
int64_t
AssignStreams
(int64_t stream)
override
;
50
51
private
:
52
/** PHY layer attached to this MAC. */
53
Ptr<UanPhy>
m_phy
;
54
/** Forwarding up callback. */
55
Callback<void, Ptr<Packet>
, uint16_t,
const
Mac8Address
&>
m_forUpCb
;
56
/** Flag when we've been cleared. */
57
bool
m_cleared
;
58
59
/**
60
* Receive packet from lower layer (passed to PHY as callback).
61
*
62
* @param pkt Packet being received.
63
* @param sinr SINR of received packet.
64
* @param txMode Mode of received packet.
65
*/
66
void
RxPacketGood
(
Ptr<Packet>
pkt,
double
sinr,
UanTxMode
txMode);
67
68
/**
69
* Packet received at lower layer in error.
70
*
71
* @param pkt Packet received in error.
72
* @param sinr SINR of received packet.
73
*/
74
void
RxPacketError
(
Ptr<Packet>
pkt,
double
sinr);
75
76
protected
:
77
void
DoDispose
()
override
;
78
};
79
80
}
// namespace ns3
81
82
#endif
/* UAN_MAC_ALOHA_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Callback
Callback template class.
Definition
callback.h:422
ns3::Mac8Address
A class used for addressing MAC8 MAC's.
Definition
mac8-address.h:33
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:66
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:49
ns3::UanMacAloha::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
uan-mac-aloha.cc:59
ns3::UanMacAloha::m_phy
Ptr< UanPhy > m_phy
PHY layer attached to this MAC.
Definition
uan-mac-aloha.h:53
ns3::UanMacAloha::DoDispose
void DoDispose() override
Destructor implementation.
Definition
uan-mac-aloha.cc:52
ns3::UanMacAloha::m_cleared
bool m_cleared
Flag when we've been cleared.
Definition
uan-mac-aloha.h:57
ns3::UanMacAloha::Enqueue
bool Enqueue(Ptr< Packet > pkt, uint16_t protocolNumber, const Address &dest) override
Enqueue packet to be transmitted.
Definition
uan-mac-aloha.cc:69
ns3::UanMacAloha::UanMacAloha
UanMacAloha()
Default constructor.
Definition
uan-mac-aloha.cc:26
ns3::UanMacAloha::AttachPhy
void AttachPhy(Ptr< UanPhy > phy) override
Attach PHY layer to this MAC.
Definition
uan-mac-aloha.cc:102
ns3::UanMacAloha::SetForwardUpCb
void SetForwardUpCb(Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > cb) override
Set the callback to forward packets up to higher layers.
Definition
uan-mac-aloha.cc:96
ns3::UanMacAloha::AssignStreams
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Definition
uan-mac-aloha.cc:130
ns3::UanMacAloha::m_forUpCb
Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > m_forUpCb
Forwarding up callback.
Definition
uan-mac-aloha.h:55
ns3::UanMacAloha::RxPacketGood
void RxPacketGood(Ptr< Packet > pkt, double sinr, UanTxMode txMode)
Receive packet from lower layer (passed to PHY as callback).
Definition
uan-mac-aloha.cc:110
ns3::UanMacAloha::~UanMacAloha
~UanMacAloha() override
Dummy destructor, see DoDispose.
Definition
uan-mac-aloha.cc:32
ns3::UanMacAloha::RxPacketError
void RxPacketError(Ptr< Packet > pkt, double sinr)
Packet received at lower layer in error.
Definition
uan-mac-aloha.cc:123
ns3::UanMacAloha::Clear
void Clear() override
Clears all pointer references.
Definition
uan-mac-aloha.cc:37
ns3::UanMac::UanMac
UanMac()
Default constructor.
Definition
uan-mac.cc:16
ns3::UanPhy
Base class for UAN Phy models.
Definition
uan-phy.h:171
ns3::UanTxMode
Abstraction of packet modulation information.
Definition
uan-tx-mode.h:32
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uan-mac.h
src
uan
model
uan-mac-aloha.h
Generated on Wed Jun 11 2025 13:15:39 for ns-3 by
1.13.2