Loading...
Searching...
No Matches
satellite-mac.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd
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: Sami Rantanen <sami.rantanen@magister.fi>
19 */
20
21#ifndef SAT_MAC_H
22#define SAT_MAC_H
23
26#include "satellite-node-info.h"
27#include "satellite-phy.h"
28#include "satellite-queue.h"
30
31#include "ns3/address.h"
32#include "ns3/callback.h"
33#include "ns3/mac48-address.h"
34#include "ns3/ptr.h"
35#include "ns3/traced-callback.h"
36
37#include <cstring>
38#include <queue>
39#include <stdint.h>
40#include <string>
41
42namespace ns3
43{
44
45class Packet;
47
56class SatMac : public Object
57{
58 public:
62 static TypeId GetTypeId(void);
63
70 SatMac();
71
77 SatMac(uint32_t satId, uint32_t beamId);
78
84 ~SatMac();
85
90 inline uint32_t GetSatId() const
91 {
92 return m_satId;
93 }
94
99 inline uint32_t GetBeamId() const
100 {
101 return m_beamId;
102 }
103
108 inline void SetSatId(uint32_t satId)
109 {
110 m_satId = satId;
111 }
112
117 inline void SetBeamId(uint32_t beamId)
118 {
119 m_beamId = beamId;
120 }
121
126 inline Address GetAddress() const
127 {
128 return m_nodeInfo->GetMacAddress();
129 }
130
136 void SetHandoverModule(Ptr<SatHandoverModule> handoverModule);
137
144 typedef Callback<void, SatPhy::PacketContainer_t, uint32_t, Time, SatSignalParameters::txInfo_s>
146
153
160 typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ReceiveCallback;
161
166 typedef Callback<void, Ptr<const Packet>> LoraReceiveCallback;
167
174
181
188 typedef Callback<Ptr<SatControlMessage>, uint32_t> ReadCtrlMsgCallback;
189
196 typedef Callback<uint32_t, Ptr<SatControlMessage>> ReserveCtrlMsgCallback;
197
203 typedef Callback<uint32_t, uint32_t> SendCtrlMsgCallback;
204
208 typedef Callback<Ptr<SatBeamScheduler>, uint32_t, uint32_t> BeamSchedulerCallback;
209
213 typedef Callback<void> UpdateIslCallback;
214
220
227
233
239
245
251 typedef Callback<void, Address, Address> RoutingUpdateCallback;
252
258
263 virtual void SetNodeInfo(Ptr<SatNodeInfo> nodeInfo);
264
271 uint32_t ReserveIdAndStoreCtrlMsgToContainer(Ptr<SatControlMessage> msg);
272
279 uint32_t SendCtrlMsgFromContainer(uint32_t sendId);
280
288 virtual void ReceiveQueueEvent(SatQueue::QueueEvent_t event, uint8_t flowIndex);
289
294 virtual void Enable();
295
300 virtual void Disable();
301
305 virtual void SetSatelliteAddress(Address satelliteAddress);
306
307 private:
309 SatMac(const SatMac&);
310
311 protected:
315 void DoDispose(void);
316
322
330 virtual void SendPacket(SatPhy::PacketContainer_t packets,
331 uint32_t carrierId,
332 Time duration,
334
340
345
350
355
360
365
370
375
380
385
392
396 TracedCallback<Time,
399 uint32_t,
400 Mac48Address,
403 std::string>
405
410 TracedCallback<Ptr<const Packet>, const Address&> m_rxTrace;
411
416 TracedCallback<const Time&, const Address&> m_rxDelayTrace;
417
422 TracedCallback<const Time&, const Address&> m_rxLinkDelayTrace;
423
428 TracedCallback<const Time&, const Address&> m_rxJitterTrace;
429
434 TracedCallback<const Time&, const Address&> m_rxLinkJitterTrace;
435
439 TracedCallback<Time> m_beamServiceTrace;
440
445
450 Ptr<SatNodeInfo> m_nodeInfo;
451
455 uint32_t m_satId;
456
460 uint32_t m_beamId;
461
465 Ptr<SatHandoverModule> m_handoverModule;
466
473
478
483
487 std::queue<Ptr<SatNcrMessage>> m_ncrMessagesToSend;
488
492 std::queue<Time> m_lastSOF;
493
498
503
508
513
518};
519
520} // namespace ns3
521
522#endif /* SAT_MAC_H */
class for module Beam Scheduler.
SatLinkDir_t
Link direction used for packet tracing.
SatNodeType_t
Node type used for packet tracing.
SatPacketEvent_t
Packet event used for packet tracing.
SatLogLevel_t
Log level used for packet tracing.
RegenerationMode_t
The regeneration mode used in satellites.
Callback< void > UpdateIslCallback
Callback to update ISL routes when handovers are performed.
TracedCallback< const Time &, const Address & > m_rxJitterTrace
Traced callback for all received packets, including jitter information and the address of the senders...
uint32_t GetBeamId() const
Get beam ID of the object.
SatMac::TransmitCallback m_txCallback
The lower layer packet transmit callback.
void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
void SetBeamSchedulerCallback(SatMac::BeamSchedulerCallback cb)
Set the beam scheduler callback.
uint32_t ReserveIdAndStoreCtrlMsgToContainer(Ptr< SatControlMessage > msg)
Reserve id and store the control message.
void SetBeamId(uint32_t beamId)
Set beam ID of the object.
TracedCallback< Time > m_beamServiceTrace
Traced callback for beam being disabled and including service time.
uint32_t m_beamId
The ID of the beam where mac belongs.
static TypeId GetTypeId(void)
Derived from Object.
void SetReserveCtrlCallback(SatMac::ReserveCtrlMsgCallback cb)
Method to set reserve control message id callback.
virtual void SetSatelliteAddress(Address satelliteAddress)
Set the satellite MAC address on the other side of this link (if regenerative satellite).
SatMac & operator=(const SatMac &)
Callback< void, SatPhy::PacketContainer_t, uint32_t, Time, SatSignalParameters::txInfo_s > TransmitCallback
Callback to send packet to lower layer.
Address GetAddress() const
Get MAC address.
SatMac::BeamSchedulerCallback m_beamSchedulerCallback
Callback to get the SatBeamScheduler linked to a beam ID.
Callback< Ptr< SatBeamScheduler >, uint32_t, uint32_t > BeamSchedulerCallback
Callback to get the SatBeamScheduler from the beam ID for handover.
void SetTransmitCallback(SatMac::TransmitCallback cb)
Method to set transmit callback.
bool m_isStatisticsTagsEnabled
EnableStatisticsTags attribute.
Time m_beamEnabledTime
Time of the last beam enable event.
SatMac::RoutingUpdateCallback m_routingUpdateCallback
Callback to update routing and ARP tables after a beam handover.
std::queue< Ptr< SatNcrMessage > > m_ncrMessagesToSend
List of NCR control messages created but not sent yet.
TracedCallback< Time, SatEnums::SatPacketEvent_t, SatEnums::SatNodeType_t, uint32_t, Mac48Address, SatEnums::SatLogLevel_t, SatEnums::SatLinkDir_t, std::string > m_packetTrace
Trace callback used for packet tracing.
SatMac::SendCtrlMsgCallback m_sendCtrlCallback
The send control message callback.
void SetTimeTag(SatPhy::PacketContainer_t packets)
Set SatMacTimeTag of packets.
Callback< uint32_t, Ptr< SatControlMessage > > ReserveCtrlMsgCallback
Callback to reserve an id and initially store the control message.
Address m_satelliteAddress
MAC address of satellite on other side of the link.
virtual void Enable()
Enable the MAC layer, i.e.
SatMac::LoraReceiveCallback m_rxLoraCallback
The upper layer package receive callback.
void SetSendCtrlCallback(SatMac::SendCtrlMsgCallback cb)
Method to set send control message callback.
virtual void SetNodeInfo(Ptr< SatNodeInfo > nodeInfo)
Set the node info.
uint32_t GetSatId() const
Get sat ID of the object.
void DoDispose(void)
Dispose of SatMac.
virtual void ReceiveQueueEvent(SatQueue::QueueEvent_t event, uint8_t flowIndex)
Receive a queue event:
TracedCallback< const Time &, const Address & > m_rxLinkJitterTrace
Traced callback for all received packets, including link jitter information and the address of the se...
TracedCallback< const Time &, const Address & > m_rxDelayTrace
Traced callback for all received packets, including delay information and the address of the senders.
Time m_lastDelay
Last delay measurement.
Callback< void, Ptr< const Packet > > LoraReceiveCallback
Callback to receive packet by upper layer.
~SatMac()
Destroy a SatMac.
void SetRoutingUpdateCallback(SatMac::RoutingUpdateCallback cb)
Method to set the routing update callback.
SatMac::ReceiveCallback m_rxCallback
The upper layer package receive callback.
bool m_ncrV2
Use of version 2 of NCR dates.
void SetUpdateIslCallback(SatMac::UpdateIslCallback cb)
Method to set update ISL callback.
bool m_isRegenerative
Indicate if satellite is regeneration (at least LINK level) for TX.
Callback< void, Address, Address > RoutingUpdateCallback
Callback to update routing and ARP tables after handover.
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced callback for all received packets, including the address of the senders.
Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > ReceiveCallback
Callback to receive packet by upper layer.
void SetSatId(uint32_t satId)
Set sat ID of the object.
Ptr< SatHandoverModule > m_handoverModule
Module used to perform handovers.
void SetReadCtrlCallback(SatMac::ReadCtrlMsgCallback cb)
Method to set read control message callback.
void SetHandoverModule(Ptr< SatHandoverModule > handoverModule)
Set the handover module.
bool m_txEnabled
Flag indicating whether the MAC is enabled, i.e.
TracedCallback< const Time &, const Address & > m_rxLinkDelayTrace
Traced callback for all received packets, including link delay information and the address of the sen...
SatMac::ReadCtrlMsgCallback m_readCtrlCallback
The read control message callback.
Callback< uint32_t, uint32_t > SendCtrlMsgCallback
Callback to send a control message and allocate a recv ID for it.
SatMac()
Construct a SatMac.
SatEnums::RegenerationMode_t m_forwardLinkRegenerationMode
Regeneration mode on forward link.
Ptr< SatNodeInfo > m_nodeInfo
Node info containing node related information, such as node type, node id and MAC address (of the Sat...
void SetLoraReceiveCallback(SatMac::LoraReceiveCallback cb)
Method to set receive callback.
SatEnums::RegenerationMode_t m_returnLinkRegenerationMode
Regeneration mode on return link.
uint32_t SendCtrlMsgFromContainer(uint32_t sendId)
Send the control message from the container.
Time m_lastLinkDelay
Last delay measurement for link.
Callback< Ptr< SatControlMessage >, uint32_t > ReadCtrlMsgCallback
Callback to read control messages from container storing control messages.
void SetReceiveCallback(SatMac::ReceiveCallback cb)
Method to set receive callback.
SatMac::ReserveCtrlMsgCallback m_reserveCtrlCallback
The reserve control message id callback.
uint32_t m_satId
The ID of the sat where mac belongs.
virtual void Disable()
Disable the MAC layer, i.e.
virtual void SendPacket(SatPhy::PacketContainer_t packets, uint32_t carrierId, Time duration, SatSignalParameters::txInfo_s txInfo)
Send packets to lower layer by using a callback.
SatMac(const SatMac &)
std::queue< Time > m_lastSOF
Store last 3 SOF date for Forward messages, to insert in NCR packets.
SatMac::UpdateIslCallback m_updateIslCallback
The update ISL routes callback.
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Struct for storing the packet specific Tx information.