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:
72  bool m_cleared;
73 
81  void RxPacketGood (Ptr<Packet> pkt, double sinr, UanTxMode txMode);
82 
89  void RxPacketError (Ptr<Packet> pkt, double sinr);
90 protected:
91  virtual void DoDispose ();
92 
93 }; // class UanMacAloha
94 
95 } // namespace ns3
96 
97 #endif /* UAN_MAC_ALOHA_H */
Ptr< UanPhy > m_phy
PHY layer attached to this MAC.
Definition: uan-mac-aloha.h:68
Callback template class.
Definition: callback.h:1176
a polymophic address class
Definition: address.h:90
phy
Definition: third.py:86
virtual bool Enqueue(Ptr< Packet > pkt, uint16_t protocolNumber, const Address &dest)
Enqueue packet to be transmitted.
Virtual base class for all UAN MAC protocols.
Definition: uan-mac.h:49
Mac8Address m_address
The MAC address.
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).
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:41
A class used for addressing MAC8 MAC&#39;s.
Definition: mac8-address.h:42
Callback< void, Ptr< Packet >, uint16_t, const Mac8Address &> m_forUpCb
Forwarding up callback.
Definition: uan-mac-aloha.h:70
static TypeId GetTypeId(void)
Register this type.
void RxPacketError(Ptr< Packet > pkt, double sinr)
Packet received at lower layer in error.
virtual ~UanMacAloha()
Dummy destructor, see DoDispose.
ALOHA MAC Protocol, the simplest MAC protocol for wireless networks.
Definition: uan-mac-aloha.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Clear(void)
Clears all pointer references.
bool m_cleared
Flag when we&#39;ve been cleared.
Definition: uan-mac-aloha.h:72
virtual void AttachPhy(Ptr< UanPhy > phy)
Attach PHY layer to this MAC.
UanMacAloha()
Default constructor.
virtual void DoDispose()
Destructor implementation.
virtual void SetForwardUpCb(Callback< void, Ptr< Packet >, uint16_t, const Mac8Address &> cb)
Set the callback to forward packets up to higher layers.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
a unique identifier for an interface.
Definition: type-id.h:58