A Discrete-Event Network Simulator
API
uan-mac-aloha.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 University of Washington
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: Leonard Tracy <lentracy@gmail.com>
18 */
19
20#ifndef UAN_MAC_ALOHA_H
21#define UAN_MAC_ALOHA_H
22
23#include "uan-mac.h"
24
25#include "ns3/mac8-address.h"
26
27namespace ns3
28{
29
30class UanPhy;
31class UanTxMode;
32
42class UanMacAloha : public UanMac
43{
44 public:
48 ~UanMacAloha() override;
53 static TypeId GetTypeId();
54
55 // Inherited methods
56 bool Enqueue(Ptr<Packet> pkt, uint16_t protocolNumber, const Address& dest) override;
57 void SetForwardUpCb(Callback<void, Ptr<Packet>, uint16_t, const Mac8Address&> cb) override;
58 void AttachPhy(Ptr<UanPhy> phy) override;
59 void Clear() override;
60 int64_t AssignStreams(int64_t stream) override;
61
62 private:
69
77 void RxPacketGood(Ptr<Packet> pkt, double sinr, UanTxMode txMode);
78
85 void RxPacketError(Ptr<Packet> pkt, double sinr);
86
87 protected:
88 void DoDispose() override;
89
90}; // class UanMacAloha
91
92} // namespace ns3
93
94#endif /* UAN_MAC_ALOHA_H */
a polymophic address class
Definition: address.h:100
Callback template class.
Definition: callback.h:443
A class used for addressing MAC8 MAC's.
Definition: mac8-address.h:44
a unique identifier for an interface.
Definition: type-id.h:60
ALOHA MAC Protocol, the simplest MAC protocol for wireless networks.
Definition: uan-mac-aloha.h:43
static TypeId GetTypeId()
Register this type.
Ptr< UanPhy > m_phy
PHY layer attached to this MAC.
Definition: uan-mac-aloha.h:64
void DoDispose() override
Destructor implementation.
bool m_cleared
Flag when we've been cleared.
Definition: uan-mac-aloha.h:68
bool Enqueue(Ptr< Packet > pkt, uint16_t protocolNumber, const Address &dest) override
Enqueue packet to be transmitted.
UanMacAloha()
Default constructor.
void AttachPhy(Ptr< UanPhy > phy) override
Attach PHY layer to this MAC.
void SetForwardUpCb(Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > cb) override
Set the callback to forward packets up to higher layers.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > m_forUpCb
Forwarding up callback.
Definition: uan-mac-aloha.h:66
void RxPacketGood(Ptr< Packet > pkt, double sinr, UanTxMode txMode)
Receive packet from lower layer (passed to PHY as callback).
~UanMacAloha() override
Dummy destructor, see DoDispose.
void RxPacketError(Ptr< Packet > pkt, double sinr)
Packet received at lower layer in error.
void Clear() override
Clears all pointer references.
Virtual base class for all UAN MAC protocols.
Definition: uan-mac.h:46
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:82