A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
uan-mac-aloha.h
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 
42 class UanMacAloha : public UanMac
43 {
44 public:
45  UanMacAloha ();
46  virtual ~UanMacAloha ();
47  static TypeId GetTypeId (void);
48 
49 
50  //Inheritted functions
51  Address GetAddress (void);
52  virtual void SetAddress (UanAddress addr);
53  virtual bool Enqueue (Ptr<Packet> pkt, const Address &dest, uint16_t protocolNumber);
54  virtual void SetForwardUpCb (Callback<void, Ptr<Packet>, const UanAddress& > cb);
55  virtual void AttachPhy (Ptr<UanPhy> phy);
56  virtual Address GetBroadcast (void) const;
57  virtual void Clear (void);
58 
67  int64_t AssignStreams (int64_t stream);
68 
69 private:
70  UanAddress m_address;
71  Ptr<UanPhy> m_phy;
72  Callback<void, Ptr<Packet>, const UanAddress& > m_forUpCb;
73  bool m_cleared;
74 
81  void RxPacketGood (Ptr<Packet> pkt, double sinr, UanTxMode txMode);
82 
88  void RxPacketError (Ptr<Packet> pkt, double sinr);
89 protected:
90  virtual void DoDispose ();
91 };
92 
93 }
94 
95 #endif /* UAN_MAC_ALOHA_H */
Callback template class.
Definition: callback.h:369
virtual void SetAddress(UanAddress addr)
Address GetAddress(void)
virtual Address GetBroadcast(void) const
a polymophic address class
Definition: address.h:86
Virtual base class for all UAN MAC protocols.
Definition: uan-mac.h:47
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)
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:36
void RxPacketError(Ptr< Packet > pkt, double sinr)
Packet received at lower layer in error.
ALOHA MAC Protocol.
Definition: uan-mac-aloha.h:42
virtual void Clear(void)
virtual bool Enqueue(Ptr< Packet > pkt, const Address &dest, uint16_t protocolNumber)
virtual void AttachPhy(Ptr< UanPhy > phy)
virtual void DoDispose()
int64_t AssignStreams(int64_t stream)
a unique identifier for an interface.
Definition: type-id.h:44