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 namespace ns3
33 {
34 
35 class Packet;
36 class Address;
37 class Mac48Address;
38 class SatBbFrame;
39 class SatCrMessage;
40 class SatSignalParameters;
41 class SatFwdLinkScheduler;
42 
50 class SatGwMac : public SatMac
51 {
52  public:
57  static TypeId GetTypeId(void);
58 
62  TypeId GetInstanceTypeId(void) const;
63 
67  SatGwMac();
68 
79  SatGwMac(uint32_t satId,
80  uint32_t beamId,
81  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
82  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
83 
89  ~SatGwMac();
90 
95 
101  void Receive(SatPhy::PacketContainer_t packets, Ptr<SatSignalParameters> /*rxParams*/);
102 
107  void TbtpSent(Ptr<SatTbtpMessage> tbtp);
108 
116  typedef Callback<void, uint32_t, uint32_t, Address, Ptr<SatCrMessage>> CrReceiveCallback;
117 
123 
130  typedef Callback<Ptr<Packet>, uint32_t, Mac48Address, uint32_t&> TxOpportunityCallback;
131 
138 
146  typedef Callback<void, Address, uint32_t, uint32_t, uint32_t> HandoverCallback;
147 
153 
161  typedef Callback<void, Address, uint32_t, uint32_t, Callback<void, uint32_t>> LogonCallback;
162 
168 
175  typedef Callback<void, Address, uint32_t, uint32_t> ControlMessageReceivedCallback;
176 
182 
189  typedef Callback<void, Address, uint32_t, uint32_t> RemoveUtCallback;
190 
196 
201  void SetFwdScheduler(Ptr<SatFwdLinkScheduler> fwdScheduler);
202 
203  private:
206 
207  void DoDispose(void);
208 
218  void StartTransmission(uint32_t carrierId);
219 
223  void StartNcrTransmission();
224 
231  void ReceiveSignalingPacket(Ptr<Packet> packet, uint32_t satId, uint32_t beamId);
232 
233  void SendNcrMessage();
234 
239  void RemoveTbtp(uint32_t superframeCounter);
240 
241  void SendCmtMessage(Address utId,
242  Time burstDuration,
243  Time satelliteReceptionTime,
244  uint32_t satId,
245  uint32_t beamId);
246 
247  void SendLogonResponse(Address utId, uint32_t raChannel);
248  static void SendLogonResponseHelper(SatGwMac* self, Address utId, uint32_t raChannel);
249 
253  std::map<uint32_t, std::vector<Ptr<SatTbtpMessage>>> m_tbtps;
254 
258  Ptr<SatFwdLinkScheduler> m_fwdScheduler;
259 
265 
270 
274  bool m_useCmt;
275 
279  std::map<Address, Time> m_lastCmtSent;
280 
285 
290 
294  TracedCallback<Ptr<SatBbFrame>> m_bbFrameTxTrace;
295 
300 
307 
312 
317 
322 
327 };
328 
329 } // namespace ns3
330 
331 #endif /* SAT_GW_MAC_H */
RegenerationMode_t
The regeneration mode used in satellites.
GW specific Mac class for Sat Net Devices.
void SetLogonCallback(SatGwMac::LogonCallback cb)
Method to set logon callback.
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.
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.
Callback< Ptr< Packet >, uint32_t, Mac48Address, uint32_t & > TxOpportunityCallback
Callback to notify upper layer about Tx opportunity.
Callback< void, Address, uint32_t, uint32_t, uint32_t > HandoverCallback
Callback to query/apply handover on the terrestrial network.
SatGwMac::CrReceiveCallback m_crReceiveCallback
Capacity request receive callback.
bool m_broadcastNcr
Broadcast NCR messages to all UTs.
static void SendLogonResponseHelper(SatGwMac *self, Address utId, uint32_t raChannel)
void SetHandoverCallback(SatGwMac::HandoverCallback cb)
Method to set handover callback.
void SetCrReceiveCallback(SatGwMac::CrReceiveCallback cb)
Method to set read control message callback.
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.
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.
SatGwMac(const SatGwMac &)
bool m_useCmt
Use CMT control messages to correct time on the UTs.
void RemoveTbtp(uint32_t superframeCounter)
Function used to clear old TBTP.
SatGwMac & operator=(const SatGwMac &)
void StartPeriodicTransmissions()
Starts periodical transmissions.
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.
TypeId GetInstanceTypeId(void) const
Derived from Object.
Time m_guardTime
Guard time for BB frames.
Base MAC class for SatNetDevices.
Definition: satellite-mac.h:52
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
Definition: satellite-phy.h:78
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.