A Discrete-Event Network Simulator
API
uan-mac-aloha.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 #ifndef UAN_MAC_ALOHA_H
22 #define UAN_MAC_ALOHA_H
23 
24 #include "uan-mac.h"
25 #include "ns3/mac8-address.h"
26 
27 namespace ns3
28 {
29 
30 
31 class UanPhy;
32 class UanTxMode;
33 
43 class UanMacAloha : public UanMac
44 {
45 public:
47  UanMacAloha ();
49  virtual ~UanMacAloha ();
54  static TypeId GetTypeId (void);
55 
56 
57  // Inherited methods
58  virtual bool Enqueue (Ptr<Packet> pkt, uint16_t protocolNumber, const Address &dest);
59  virtual void SetForwardUpCb (Callback<void, Ptr<Packet>, uint16_t, const Mac8Address&> cb);
60  virtual void AttachPhy (Ptr<UanPhy> phy);
61  virtual void Clear (void);
62  int64_t AssignStreams (int64_t stream);
63 
64 private:
70  bool m_cleared;
71 
79  void RxPacketGood (Ptr<Packet> pkt, double sinr, UanTxMode txMode);
80 
87  void RxPacketError (Ptr<Packet> pkt, double sinr);
88 protected:
89  virtual void DoDispose ();
90 
91 }; // class UanMacAloha
92 
93 } // namespace ns3
94 
95 #endif /* UAN_MAC_ALOHA_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::Mac8Address
A class used for addressing MAC8 MAC's.
Definition: mac8-address.h:43
ns3::UanMacAloha::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition: uan-mac-aloha.cc:62
ns3::Callback
Callback template class.
Definition: callback.h:1279
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::UanMacAloha::m_cleared
bool m_cleared
Flag when we've been cleared.
Definition: uan-mac-aloha.h:70
ns3::UanMacAloha::UanMacAloha
UanMacAloha()
Default constructor.
Definition: uan-mac-aloha.cc:36
ns3::UanMacAloha::~UanMacAloha
virtual ~UanMacAloha()
Dummy destructor, see DoDispose.
Definition: uan-mac-aloha.cc:42
ns3::UanMacAloha::SetForwardUpCb
virtual void SetForwardUpCb(Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > cb)
Set the callback to forward packets up to higher layers.
Definition: uan-mac-aloha.cc:104
ns3::UanMacAloha::RxPacketError
void RxPacketError(Ptr< Packet > pkt, double sinr)
Packet received at lower layer in error.
Definition: uan-mac-aloha.cc:132
ns3::Ptr< Packet >
ns3::UanMacAloha::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: uan-mac-aloha.cc:69
ns3::Address
a polymophic address class
Definition: address.h:91
uan-mac.h
ns3::UanTxMode
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:42
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:117
ns3::UanMacAloha::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: uan-mac-aloha.cc:138
ns3::UanMac
Virtual base class for all UAN MAC protocols.
Definition: uan-mac.h:50
ns3::UanMacAloha::m_phy
Ptr< UanPhy > m_phy
PHY layer attached to this MAC.
Definition: uan-mac-aloha.h:66
ns3::UanMacAloha::m_forUpCb
Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > m_forUpCb
Forwarding up callback.
Definition: uan-mac-aloha.h:68
ns3::UanMacAloha::AttachPhy
virtual void AttachPhy(Ptr< UanPhy > phy)
Attach PHY layer to this MAC.
Definition: uan-mac-aloha.cc:109
ns3::UanMacAloha::Enqueue
virtual bool Enqueue(Ptr< Packet > pkt, uint16_t protocolNumber, const Address &dest)
Enqueue packet to be transmitted.
Definition: uan-mac-aloha.cc:80
third.phy
phy
Definition: third.py:93
ns3::UanMacAloha
ALOHA MAC Protocol, the simplest MAC protocol for wireless networks.
Definition: uan-mac-aloha.h:44
ns3::UanMacAloha::Clear
virtual void Clear(void)
Clears all pointer references.
Definition: uan-mac-aloha.cc:47