A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "uan-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  Address GetAddress (void);
59  virtual void SetAddress (UanAddress addr);
60  virtual bool Enqueue (Ptr<Packet> pkt, const Address &dest, uint16_t protocolNumber);
61  virtual void SetForwardUpCb (Callback<void, Ptr<Packet>, const UanAddress& > cb);
62  virtual void AttachPhy (Ptr<UanPhy> phy);
63  virtual Address GetBroadcast (void) const;
64  virtual void Clear (void);
65  int64_t AssignStreams (int64_t stream);
66 
67 private:
75  bool m_cleared;
76 
84  void RxPacketGood (Ptr<Packet> pkt, double sinr, UanTxMode txMode);
85 
92  void RxPacketError (Ptr<Packet> pkt, double sinr);
93 protected:
94  virtual void DoDispose ();
95 
96 }; // class UanMacAloha
97 
98 } // namespace ns3
99 
100 #endif /* UAN_MAC_ALOHA_H */
Ptr< UanPhy > m_phy
PHY layer attached to this MAC.
Definition: uan-mac-aloha.h:71
Callback template class.
Definition: callback.h:924
virtual void SetAddress(UanAddress addr)
Set the address.
Callback< void, Ptr< Packet >, const UanAddress & > m_forUpCb
Forwarding up callback.
Definition: uan-mac-aloha.h:73
Address GetAddress(void)
Get the MAC Address.
virtual Address GetBroadcast(void) const
Get the broadcast address.
a polymophic address class
Definition: address.h:86
Virtual base class for all UAN MAC protocols.
Definition: uan-mac.h:47
A class used for addressing UAN MAC's.
Definition: uan-address.h:40
void RxPacketGood(Ptr< Packet > pkt, double sinr, UanTxMode txMode)
Receive packet from lower layer (passed to PHY as callback).
virtual void SetForwardUpCb(Callback< void, Ptr< Packet >, const UanAddress & > cb)
Set the callback to forward packets up to higher layers.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:41
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
virtual void Clear(void)
Clears all pointer references.
virtual bool Enqueue(Ptr< Packet > pkt, const Address &dest, uint16_t protocolNumber)
Enqueue packet to be transmitted.
bool m_cleared
Flag when we've been cleared.
Definition: uan-mac-aloha.h:75
virtual void AttachPhy(Ptr< UanPhy > phy)
Attach PHY layer to this MAC.
UanMacAloha()
Default constructor.
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
UanAddress m_address
The MAC address.
Definition: uan-mac-aloha.h:69
a unique identifier for an interface.
Definition: type-id.h:49