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