satellite-orbiter-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: Bastien Tauran <bastien.tauran@viveris.fr>
19  */
20 
21 #ifndef SATELLITE_ORBITER_MAC_H
22 #define SATELLITE_ORBITER_MAC_H
23 
26 #include "satellite-mac.h"
28 #include "satellite-phy.h"
30 
31 #include <ns3/address.h>
32 #include <ns3/nstime.h>
33 #include <ns3/object.h>
34 #include <ns3/packet.h>
35 #include <ns3/ptr.h>
36 
37 #include <stdint.h>
38 
39 namespace ns3
40 {
41 
47 class SatOrbiterMac : public SatMac
48 {
49  public:
53  SatOrbiterMac(void);
54 
63  SatOrbiterMac(uint32_t satId, uint32_t beamId);
64 
68  virtual ~SatOrbiterMac();
69 
73  static TypeId GetTypeId(void);
74  TypeId GetInstanceTypeId(void) const;
75  virtual void DoInitialize(void);
76 
80  virtual void DoDispose(void);
81 
86 
91  virtual void EnquePacket(Ptr<Packet> packet) = 0;
92 
97  void SetFwdScheduler(Ptr<SatFwdLinkScheduler> fwdScheduler);
98 
102  void SetLlc(Ptr<SatOrbiterLlc> llc);
103 
104  virtual Time GetGuardTime() const;
105  virtual void SetGuardTime(Time guardTime);
106 
107  typedef Callback<void, Ptr<SatSignalParameters>> TransmitCallback;
108 
110 
111  typedef Callback<void, SatPhy::PacketContainer_t, Ptr<SatSignalParameters>>
113 
115 
119  typedef Callback<Ptr<SatBeamScheduler>, uint32_t, uint32_t> BeamSchedulerCallback;
120 
126 
130  virtual void StopPeriodicTransmissions();
131 
138  virtual bool AddPeer(Mac48Address address) = 0;
139 
146  virtual bool RemovePeer(Mac48Address address) = 0;
147 
148  protected:
158  void StartTransmission(uint32_t carrierId);
159 
167  virtual void SendPacket(SatPhy::PacketContainer_t packets,
168  uint32_t carrierId,
169  Time duration,
171 
176  virtual void RxTraces(SatPhy::PacketContainer_t packets);
177 
183 
189 
196  virtual Address GetRxUtAddress(Ptr<Packet> packet) = 0;
197 
203  virtual bool HasPeer() = 0;
204 
210 
214  Ptr<SatFwdLinkScheduler> m_fwdScheduler;
215 
221 
225  uint32_t m_satId;
226 
230  uint32_t m_beamId;
231 
235  Ptr<SatOrbiterLlc> m_llc;
236 
240  TracedCallback<Ptr<SatBbFrame>> m_bbFrameTxTrace;
241 
244 
249 };
250 
251 } // namespace ns3
252 
253 #endif /* SATELLITE_ORBITER_MAC_H */
SatLinkDir_t
Link direction used for packet tracing.
Base MAC class for SatNetDevices.
Definition: satellite-mac.h:57
Callback< void, SatPhy::PacketContainer_t, uint32_t, Time, SatSignalParameters::txInfo_s > TransmitCallback
Callback to send packet to lower layer.
The SatOrbiterMac models the global link MAC layer of the satellite node.
bool m_disableSchedulingIfNoDeviceConnected
If true, the periodic calls of StartTransmission are not called when no devices are connected to this...
void SetBeamSchedulerCallback(SatOrbiterMac::BeamSchedulerCallback cb)
Set the beam scheduler callback.
virtual bool AddPeer(Mac48Address address)=0
Add a remote peer to this MAC.
uint32_t m_satId
ID of sat for UT.
SatOrbiterMac(void)
Default constructor.
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.
Ptr< SatOrbiterLlc > m_llc
LLC layer linked to this MAC.
Callback< void, SatPhy::PacketContainer_t, Ptr< SatSignalParameters > > ReceiveNetDeviceCallback
virtual Address GetRxUtAddress(Ptr< Packet > packet)=0
Get the UT address associated to this RX packet.
uint32_t m_beamId
ID of beam for UT.
virtual Time GetGuardTime() const
void SetTransmitCallback(SatOrbiterMac::TransmitCallback cb)
Time m_guardTime
Guard time for BB frames.
TransmitCallback m_txCallback
virtual ~SatOrbiterMac()
Destructor for SatOrbiterMac.
virtual void DoInitialize(void)
virtual void EnquePacket(Ptr< Packet > packet)=0
Add new packet to the LLC queue.
void StartTransmission(uint32_t carrierId)
Start sending a Packet Down the Wire.
void SetLlc(Ptr< SatOrbiterLlc > llc)
Set the orbiter LLC associated to this orbiter MAC layer.
virtual bool RemovePeer(Mac48Address address)=0
Remove a remote peer from this MAC.
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()=0
Get the link TX direction.
bool m_periodicTransmissionEnabled
Indicated if periodic transmission is enabled.
virtual void SetGuardTime(Time guardTime)
virtual void DoDispose(void)
Dispose of this class instance.
virtual SatEnums::SatLinkDir_t GetSatLinkRxDir()=0
Get the link RX direction.
virtual void StopPeriodicTransmissions()
Stop periodic transmission, until a pacquet in enqued.
ReceiveNetDeviceCallback m_rxNetDeviceCallback
void StartPeriodicTransmissions()
Starts periodical transmissions.
static TypeId GetTypeId(void)
inherited from Object
void SetFwdScheduler(Ptr< SatFwdLinkScheduler > fwdScheduler)
Method to set link scheduler (forward or SCPC)
Callback< Ptr< SatBeamScheduler >, uint32_t, uint32_t > BeamSchedulerCallback
Callback to get the SatBeamScheduler from the beam ID for handover.
Callback< void, Ptr< SatSignalParameters > > TransmitCallback
TracedCallback< Ptr< SatBbFrame > > m_bbFrameTxTrace
Trace for transmitted BB frames.
TypeId GetInstanceTypeId(void) const
Ptr< SatFwdLinkScheduler > m_fwdScheduler
Scheduler for the forward link.
void SetReceiveNetDeviceCallback(SatOrbiterMac::ReceiveNetDeviceCallback cb)
virtual void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
virtual bool HasPeer()=0
Indicates if at least one device is connected in this beam.
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
Definition: satellite-phy.h:79
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Struct for storing the packet specific Tx information.