A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
uan-mac.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_H
21#define UAN_MAC_H
22
23#include "ns3/address.h"
24#include "ns3/mac8-address.h"
25#include "ns3/nstime.h"
26#include "ns3/object.h"
27#include "ns3/packet.h"
28#include "ns3/ptr.h"
29
30namespace ns3
31{
32
33class UanPhy;
34class UanChannel;
35class UanNetDevice;
36class UanTransducer;
37class UanTxMode;
38class Mac8Address;
39
40/**
41 * \ingroup uan
42 *
43 * Virtual base class for all UAN MAC protocols.
44 */
45class UanMac : public Object
46{
47 public:
48 /** Default constructor */
49 UanMac();
50 /**
51 * Register this type.
52 * \return The TypeId.
53 */
54 static TypeId GetTypeId();
55
56 /**
57 * Get the MAC Address.
58 *
59 * \return MAC Address.
60 */
61 virtual Address GetAddress();
62
63 /**
64 * Set the address.
65 *
66 * \param addr Mac8Address for this MAC.
67 */
68 virtual void SetAddress(Mac8Address addr);
69
70 /**
71 * Enqueue packet to be transmitted.
72 *
73 * \param pkt Packet to be transmitted.
74 * \param dest Destination address.
75 * \param protocolNumber The type of the packet.
76 * \return True if packet was successfully enqueued.
77 */
78 virtual bool Enqueue(Ptr<Packet> pkt, uint16_t protocolNumber, const Address& dest) = 0;
79 /**
80 * Set the callback to forward packets up to higher layers.
81 *
82 * \param cb The callback.
83 * \pname{packet} The packet.
84 * \pname{address} The source address.
85 */
86 virtual void SetForwardUpCb(Callback<void, Ptr<Packet>, uint16_t, const Mac8Address&> cb) = 0;
87
88 /**
89 * Attach PHY layer to this MAC.
90 *
91 * Some MACs may be designed to work with multiple PHY
92 * layers. Others may only work with one.
93 *
94 * \param phy Phy layer to attach to this MAC.
95 */
96 virtual void AttachPhy(Ptr<UanPhy> phy) = 0;
97
98 /**
99 * Get the broadcast address.
100 *
101 * \return The broadcast address.
102 */
103 virtual Address GetBroadcast() const;
104
105 /** Clears all pointer references. */
106 virtual void Clear() = 0;
107
108 /**
109 * Assign a fixed random variable stream number to the random variables
110 * used by this model. Return the number of streams (possibly zero) that
111 * have been assigned.
112 *
113 * \param stream First stream index to use.
114 * \return The number of stream indices assigned by this model.
115 */
116 virtual int64_t AssignStreams(int64_t stream) = 0;
117
118 /**
119 * TracedCallback signature for packet reception/enqueue/dequeue events.
120 *
121 * \param [in] packet The Packet.
122 * \param [in] mode The UanTxMode.
123 */
125
126 /**
127 * Get the Tx mode index (Modulation type).
128 * \return the Tx mode index
129 */
130 uint32_t GetTxModeIndex() const;
131
132 /**
133 * Set the Tx mode index (Modulation type).
134 * \param txModeIndex the Tx mode index
135 */
136 void SetTxModeIndex(uint32_t txModeIndex);
137
138 private:
139 /** Modulation type */
141 /** The MAC address. */
143
144}; // class UanMac
145
146} // namespace ns3
147
148#endif /* UAN_MAC_H */
a polymophic address class
Definition: address.h:101
Callback template class.
Definition: callback.h:438
A class used for addressing MAC8 MAC's.
Definition: mac8-address.h:44
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Virtual base class for all UAN MAC protocols.
Definition: uan-mac.h:46
virtual void Clear()=0
Clears all pointer references.
void SetTxModeIndex(uint32_t txModeIndex)
Set the Tx mode index (Modulation type).
Definition: uan-mac.cc:40
virtual void SetForwardUpCb(Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > cb)=0
Set the callback to forward packets up to higher layers.
uint32_t GetTxModeIndex() const
Get the Tx mode index (Modulation type).
Definition: uan-mac.cc:46
void(* PacketModeTracedCallback)(Ptr< const Packet > packet, UanTxMode mode)
TracedCallback signature for packet reception/enqueue/dequeue events.
Definition: uan-mac.h:124
virtual bool Enqueue(Ptr< Packet > pkt, uint16_t protocolNumber, const Address &dest)=0
Enqueue packet to be transmitted.
virtual void SetAddress(Mac8Address addr)
Set the address.
Definition: uan-mac.cc:58
uint32_t m_txModeIndex
Modulation type.
Definition: uan-mac.h:140
virtual void AttachPhy(Ptr< UanPhy > phy)=0
Attach PHY layer to this MAC.
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
Mac8Address m_address
The MAC address.
Definition: uan-mac.h:142
virtual Address GetBroadcast() const
Get the broadcast address.
Definition: uan-mac.cc:64
virtual Address GetAddress()
Get the MAC Address.
Definition: uan-mac.cc:52
UanMac()
Default constructor.
Definition: uan-mac.cc:27
static TypeId GetTypeId()
Register this type.
Definition: uan-mac.cc:33
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.