Loading...
Searching...
No Matches
satellite-gw-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: Jani Puttonen <jani.puttonen@magister.fi>
19 */
20
21#ifndef SAT_GW_MAC_H
22#define SAT_GW_MAC_H
23
24#include "satellite-mac.h"
25#include "satellite-phy.h"
26
27#include "ns3/callback.h"
28#include "ns3/nstime.h"
29#include "ns3/ptr.h"
30#include "ns3/traced-callback.h"
31
32#include <map>
33#include <set>
34#include <stdint.h>
35#include <vector>
36
37namespace ns3
38{
39
40class Packet;
41class Address;
42class Mac48Address;
43class SatBbFrame;
44class SatCrMessage;
47
54
55class SatGwMac : public SatMac
56{
57 public:
62 static TypeId GetTypeId(void);
63
67 SatGwMac();
68
80 SatGwMac(Ptr<Node> node,
81 uint32_t satId,
82 uint32_t beamId,
83 uint32_t feederSatId,
84 uint32_t feederBeamId);
85
91 ~SatGwMac();
92
97
103 void Receive(SatPhy::PacketContainer_t packets, Ptr<SatSignalParameters> /*rxParams*/);
104
109 void TbtpSent(Ptr<SatTbtpMessage> tbtp);
110
116 uint32_t GetFeederSatId();
117
123 uint32_t GetFeederBeamId();
124
132 typedef Callback<void, uint32_t, uint32_t, Address, Ptr<SatCrMessage>> CrReceiveCallback;
133
139
146 typedef Callback<Ptr<Packet>, uint32_t, Mac48Address, uint32_t&> TxOpportunityCallback;
147
154
163 typedef Callback<void, Address, uint32_t, uint32_t, uint32_t, uint32_t> HandoverCallback;
164
170
178 typedef Callback<void, Address, uint32_t, uint32_t, Callback<void, uint32_t>> LogonCallback;
179
185
192 typedef Callback<void, uint32_t, uint32_t> PhyBeamCallback;
193
199
206 typedef Callback<void, Address, uint32_t, uint32_t> ControlMessageReceivedCallback;
207
213
220 typedef Callback<void, Address, uint32_t, uint32_t> RemoveUtCallback;
221
227
231 typedef Callback<void> ClearQueuesCallback;
232
238
243 void SetFwdScheduler(Ptr<SatFwdLinkScheduler> fwdScheduler);
244
250 void ChangeBeam(uint32_t satId, uint32_t beamId);
251
256 void ConnectUt(Mac48Address utAddress);
257
262 void DisconnectUt(Mac48Address utAddress);
263
264 private:
267
268 void DoDispose(void);
269
279 void StartTransmission(uint32_t carrierId);
280
285
292 void ReceiveSignalingPacket(Ptr<Packet> packet, uint32_t satId, uint32_t beamId);
293
294 void SendNcrMessage();
295
300 void RemoveTbtp(uint32_t superframeCounter);
301
302 void SendCmtMessage(Address utId,
303 Time burstDuration,
304 Time satelliteReceptionTime,
305 uint32_t satId,
306 uint32_t beamId);
307
308 void SendLogonResponse(Address utId, uint32_t raChannel);
309 static void SendLogonResponseHelper(SatGwMac* self, Address utId, uint32_t raChannel);
310
314 virtual void StopPeriodicTransmissions();
315
321 bool HasPeer();
322
326 Ptr<Node> m_node;
327
332
337
341 std::map<uint32_t, std::vector<Ptr<SatTbtpMessage>>> m_tbtps;
342
346 Ptr<SatFwdLinkScheduler> m_fwdScheduler;
347
353
358
363
367 std::map<Address, Time> m_lastCmtSent;
368
373
378
384
389
393 std::set<Mac48Address> m_peers;
394
398 TracedCallback<Ptr<SatBbFrame>> m_bbFrameTxTrace;
399
404
411
416
421
426
431
436
441};
442
443} // namespace ns3
444
445#endif /* SAT_GW_MAC_H */
SatBbFrame class implements functionality for BB frames.
The packet for the Capacity Request (CR) messages.
void SetLogonCallback(SatGwMac::LogonCallback cb)
Method to set logon callback.
bool m_disableSchedulingIfNoDeviceConnected
If true, the periodic calls of StartTransmission are not called when no devices are connected to this...
SatGwMac::HandoverCallback m_handoverCallback
Callback to query/apply handover on the terrestrial network.
Ptr< SatFwdLinkScheduler > m_fwdScheduler
Scheduler for the forward link.
void TbtpSent(Ptr< SatTbtpMessage > tbtp)
Function called when a TBTP has been sent by the SatBeamScheduler.
Callback< void > ClearQueuesCallback
Callback to clear LLC queues.
SatGwMac::TxOpportunityCallback m_txOpportunityCallback
Callback to notify the txOpportunity to upper layer Returns a packet Attributes: payload in bytes.
void SendLogonResponse(Address utId, uint32_t raChannel)
std::map< Address, Time > m_lastCmtSent
Time of last CMT sending for each UT.
void SetTxOpportunityCallback(SatGwMac::TxOpportunityCallback cb)
Method to set Tx opportunity callback.
void SetRemoveUtCallback(SatGwMac::RemoveUtCallback cb)
Method to set callback for UT removing.
Time m_cmtPeriodMin
Minimum interval between two CMT control messages for a same UT.
Callback< void, Address, uint32_t, uint32_t > RemoveUtCallback
Callback to indicate NCC a UT needs to be removed.
void SetFwdScheduler(Ptr< SatFwdLinkScheduler > fwdScheduler)
Method to set forward link scheduler.
static TypeId GetTypeId(void)
Get the type ID.
SatGwMac::PhyBeamCallback m_beamCallback
Callback to change phy-layer beam ID.
Callback< Ptr< Packet >, uint32_t, Mac48Address, uint32_t & > TxOpportunityCallback
Callback to notify upper layer about Tx opportunity.
SatGwMac::CrReceiveCallback m_crReceiveCallback
Capacity request receive callback.
bool m_broadcastNcr
Broadcast NCR messages to all UTs.
void ChangeBeam(uint32_t satId, uint32_t beamId)
Method handling beam handover.
static void SendLogonResponseHelper(SatGwMac *self, Address utId, uint32_t raChannel)
void SetHandoverCallback(SatGwMac::HandoverCallback cb)
Method to set handover callback.
void ConnectUt(Mac48Address utAddress)
Connect a UT to this satellite.
bool HasPeer()
Indicates if at least one device is connected in this beam.
SatGwMac::ClearQueuesCallback m_clearQueuesCallback
Callback to clear LLC queues.
void SetCrReceiveCallback(SatGwMac::CrReceiveCallback cb)
Method to set read control message callback.
uint32_t m_feederBeamId
ID of beam linked to this GW.
SatGwMac & operator=(const SatGwMac &)
SatGwMac::LogonCallback m_logonCallback
Callback to log a terminal on.
Callback< void, Address, uint32_t, uint32_t, Callback< void, uint32_t > > LogonCallback
Callback to register UT logon.
void StartNcrTransmission()
Send a NCR packet to the UTs.
void ReceiveSignalingPacket(Ptr< Packet > packet, uint32_t satId, uint32_t beamId)
Signaling packet receiver, which handles all the signaling packet receptions.
~SatGwMac()
Destroy a SatGwMac.
SatGwMac()
Default constructor, which is not used.
uint32_t GetFeederBeamId()
Get ID of beam linked to this GW.
TracedCallback< Ptr< SatBbFrame > > m_bbFrameTxTrace
Trace for transmitted BB frames.
void SendCmtMessage(Address utId, Time burstDuration, Time satelliteReceptionTime, uint32_t satId, uint32_t beamId)
void StartTransmission(uint32_t carrierId)
Start sending a Packet Down the Wire.
Callback< void, uint32_t, uint32_t, Address, Ptr< SatCrMessage > > CrReceiveCallback
Callback to receive capacity request (CR) messages.
SatGwMac::RemoveUtCallback m_removeUtCallback
Callback to indicate NCC a UT needs to be removed.
SatGwMac::ControlMessageReceivedCallback m_controlMessageReceivedCallback
Callback to indicate NCC a control burst has been received.
std::map< uint32_t, std::vector< Ptr< SatTbtpMessage > > > m_tbtps
List of TBTPs sent to UTs.
void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters >)
Receive packet from lower layer.
void SetControlMessageReceivedCallback(SatGwMac::ControlMessageReceivedCallback cb)
Method to set callback for control burst reception.
Callback< void, Address, uint32_t, uint32_t, uint32_t, uint32_t > HandoverCallback
Callback to query/apply handover on the terrestrial network.
SatGwMac(const SatGwMac &)
bool m_useCmt
Use CMT control messages to correct time on the UTs.
uint32_t GetFeederSatId()
Get ID of satellite linked to this GW.
void RemoveTbtp(uint32_t superframeCounter)
Function used to clear old TBTP.
bool m_periodicTransmissionEnabled
Indicated if periodic transmission is enabled.
Callback< void, uint32_t, uint32_t > PhyBeamCallback
Callback to change phy-layer beam ID.
void StartPeriodicTransmissions()
Starts periodical transmissions.
void SetBeamCallback(SatGwMac::PhyBeamCallback cb)
Method to set phy-layer beam handover callback.
virtual void StopPeriodicTransmissions()
Stop periodic transmission, until a pacquet in enqued.
std::set< Mac48Address > m_peers
List of UT MAC connected to this MAC.
void DisconnectUt(Mac48Address utAddress)
Disconnect a UT to this satellite.
Ptr< Node > m_node
Node containing this MAC.
Time m_ncrInterval
Interval between two broadcast of NCR dates.
Callback< void, Address, uint32_t, uint32_t > ControlMessageReceivedCallback
Callback to inform NCC a control burst has been received.
uint32_t m_feederSatId
ID of satellite linked to this GW.
Time m_guardTime
Guard time for BB frames.
void SetClearQueuesCallback(SatGwMac::ClearQueuesCallback cb)
Method to set callback for LLC queues clearing.
SatMac()
Construct a SatMac.
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
Actual physical layer transmission container.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.