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 
37 namespace ns3
38 {
39 
40 class Packet;
41 class Address;
42 class Mac48Address;
43 class SatBbFrame;
44 class SatCrMessage;
45 class SatSignalParameters;
46 class SatFwdLinkScheduler;
47 
55 class SatGwMac : public SatMac
56 {
57  public:
62  static TypeId GetTypeId(void);
63 
67  TypeId GetInstanceTypeId(void) const;
68 
72  SatGwMac();
73 
85  SatGwMac(Ptr<Node> node,
86  uint32_t satId,
87  uint32_t beamId,
88  uint32_t feederSatId,
89  uint32_t feederBeamId);
90 
96  ~SatGwMac();
97 
102 
108  void Receive(SatPhy::PacketContainer_t packets, Ptr<SatSignalParameters> /*rxParams*/);
109 
114  void TbtpSent(Ptr<SatTbtpMessage> tbtp);
115 
121  uint32_t GetFeederSatId();
122 
128  uint32_t GetFeederBeamId();
129 
137  typedef Callback<void, uint32_t, uint32_t, Address, Ptr<SatCrMessage>> CrReceiveCallback;
138 
144 
151  typedef Callback<Ptr<Packet>, uint32_t, Mac48Address, uint32_t&> TxOpportunityCallback;
152 
159 
168  typedef Callback<void, Address, uint32_t, uint32_t, uint32_t, uint32_t> HandoverCallback;
169 
175 
183  typedef Callback<void, Address, uint32_t, uint32_t, Callback<void, uint32_t>> LogonCallback;
184 
190 
197  typedef Callback<void, uint32_t, uint32_t> PhyBeamCallback;
198 
204 
211  typedef Callback<void, Address, uint32_t, uint32_t> ControlMessageReceivedCallback;
212 
218 
225  typedef Callback<void, Address, uint32_t, uint32_t> RemoveUtCallback;
226 
232 
236  typedef Callback<void> ClearQueuesCallback;
237 
243 
248  void SetFwdScheduler(Ptr<SatFwdLinkScheduler> fwdScheduler);
249 
255  void ChangeBeam(uint32_t satId, uint32_t beamId);
256 
261  void ConnectUt(Mac48Address utAddress);
262 
267  void DisconnectUt(Mac48Address utAddress);
268 
269  private:
272 
273  void DoDispose(void);
274 
284  void StartTransmission(uint32_t carrierId);
285 
289  void StartNcrTransmission();
290 
297  void ReceiveSignalingPacket(Ptr<Packet> packet, uint32_t satId, uint32_t beamId);
298 
299  void SendNcrMessage();
300 
305  void RemoveTbtp(uint32_t superframeCounter);
306 
307  void SendCmtMessage(Address utId,
308  Time burstDuration,
309  Time satelliteReceptionTime,
310  uint32_t satId,
311  uint32_t beamId);
312 
313  void SendLogonResponse(Address utId, uint32_t raChannel);
314  static void SendLogonResponseHelper(SatGwMac* self, Address utId, uint32_t raChannel);
315 
319  virtual void StopPeriodicTransmissions();
320 
326  bool HasPeer();
327 
331  Ptr<Node> m_node;
332 
336  uint32_t m_feederSatId;
337 
341  uint32_t m_feederBeamId;
342 
346  std::map<uint32_t, std::vector<Ptr<SatTbtpMessage>>> m_tbtps;
347 
351  Ptr<SatFwdLinkScheduler> m_fwdScheduler;
352 
358 
363 
367  bool m_useCmt;
368 
372  std::map<Address, Time> m_lastCmtSent;
373 
378 
383 
389 
394 
398  std::set<Mac48Address> m_peers;
399 
403  TracedCallback<Ptr<SatBbFrame>> m_bbFrameTxTrace;
404 
409 
416 
421 
426 
431 
436 
441 
446 };
447 
448 } // namespace ns3
449 
450 #endif /* SAT_GW_MAC_H */
GW specific Mac class for Sat Net Devices.
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::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.
void DoDispose(void)
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.
SatGwMac & operator=(const SatGwMac &)
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.
TypeId GetInstanceTypeId(void) const
Derived from Object.
Time m_guardTime
Guard time for BB frames.
void SetClearQueuesCallback(SatGwMac::ClearQueuesCallback cb)
Method to set callback for LLC queues clearing.
Base MAC class for SatNetDevices.
Definition: satellite-mac.h:57
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
Definition: satellite-phy.h:79
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.