satellite-orbiter-net-device.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 SATELLITE_ORBITER_NET_DEVICE_H
22 #define SATELLITE_ORBITER_NET_DEVICE_H
23 
24 #include "satellite-channel.h"
25 #include "satellite-isl-arbiter.h"
26 #include "satellite-mac.h"
27 #include "satellite-phy.h"
30 
31 #include <ns3/error-model.h>
32 #include <ns3/mac48-address.h>
33 #include <ns3/net-device.h>
34 #include <ns3/output-stream-wrapper.h>
35 #include <ns3/traced-callback.h>
36 
37 #include <map>
38 #include <set>
39 #include <stdint.h>
40 #include <string>
41 #include <vector>
42 
43 namespace ns3
44 {
45 
46 class PointToPointIslNetDevice;
47 class SatIslArbiter;
48 
57 class SatOrbiterNetDevice : public NetDevice
58 {
59  public:
64  static TypeId GetTypeId(void);
65 
70 
76  virtual void ReceivePacketUser(Ptr<Packet> packet, const Address& userAddress) = 0;
77 
83  virtual void ReceivePacketFeeder(Ptr<Packet> packet, const Address& feederAddress) = 0;
84 
90  void ReceiveUser(SatPhy::PacketContainer_t packets, Ptr<SatSignalParameters> rxParams);
91 
97  void ReceiveFeeder(SatPhy::PacketContainer_t packets, Ptr<SatSignalParameters> rxParams);
98 
106  virtual bool SendControlMsgToFeeder(Ptr<SatControlMessage> msg,
107  const Address& dest,
108  Ptr<SatSignalParameters> rxParams) = 0;
109 
115  void AddUserPhy(Ptr<SatPhy> phy, uint32_t beamId);
116 
122  void AddFeederPhy(Ptr<SatPhy> phy, uint32_t beamId);
123 
129  Ptr<SatPhy> GetUserPhy(uint32_t beamId);
130 
136  Ptr<SatPhy> GetFeederPhy(uint32_t beamId);
137 
142  std::map<uint32_t, Ptr<SatPhy>> GetUserPhy();
143 
148  std::map<uint32_t, Ptr<SatPhy>> GetFeederPhy();
149 
155  void AddUserMac(Ptr<SatMac> mac, uint32_t beamId);
156 
163  void AddFeederMac(Ptr<SatMac> mac, Ptr<SatMac> macUsed, uint32_t beamId);
164 
170  Ptr<SatMac> GetUserMac(uint32_t beamId);
171 
177  Ptr<SatMac> GetFeederMac(uint32_t beamId);
178 
183  std::map<uint32_t, Ptr<SatMac>> GetUserMac();
184 
189  std::map<uint32_t, Ptr<SatMac>> GetFeederMac();
190 
195  std::map<uint32_t, Ptr<SatMac>> GetAllFeederMac();
196 
202  void AddFeederPair(uint32_t beamId, Mac48Address satelliteFeederAddress);
203 
209  void AddUserPair(uint32_t beamId, Mac48Address satelliteUserAddress);
210 
216  Mac48Address GetSatelliteFeederAddress(uint32_t beamId);
217 
223  Mac48Address GetSatelliteUserAddress(uint32_t beamId);
224 
229  void SetReceiveErrorModel(Ptr<ErrorModel> em);
230 
235  void SetForwardLinkRegenerationMode(SatEnums::RegenerationMode_t forwardLinkRegenerationMode);
236 
241  void SetReturnLinkRegenerationMode(SatEnums::RegenerationMode_t returnLinkRegenerationMode);
242 
243  void SetNodeId(uint32_t nodeId);
244 
250  void ConnectGw(Mac48Address gwAddress, uint32_t beamId);
251 
257  void DisconnectGw(Mac48Address gwAddress, uint32_t beamId);
258 
264  std::set<Mac48Address> GetGwConnected();
265 
271  virtual void ConnectUt(Mac48Address utAddress, uint32_t beamId) = 0;
272 
278  virtual void DisconnectUt(Mac48Address utAddress, uint32_t beamId) = 0;
279 
285  std::set<Mac48Address> GetUtConnected();
286 
291  void AddIslsNetDevice(Ptr<PointToPointIslNetDevice> islNetDevices);
292 
297  std::vector<Ptr<PointToPointIslNetDevice>> GetIslsNetDevices();
298 
303  void SetArbiter(Ptr<SatIslArbiter> arbiter);
304 
309  Ptr<SatIslArbiter> GetArbiter();
310 
316  void SendToIsl(Ptr<Packet> packet, Mac48Address destination);
317 
323  virtual void ReceiveFromIsl(Ptr<Packet> packet, Mac48Address destination) = 0;
324 
325  // inherited from NetDevice base class.
326  virtual void SetIfIndex(const uint32_t index);
327  virtual uint32_t GetIfIndex(void) const;
328  virtual void SetAddress(Address address);
329  virtual Address GetAddress(void) const;
330  virtual bool SetMtu(const uint16_t mtu);
331  virtual uint16_t GetMtu(void) const;
332  virtual bool IsLinkUp(void) const;
333  virtual void AddLinkChangeCallback(Callback<void> callback);
334  virtual bool IsBroadcast(void) const;
335  virtual Address GetBroadcast(void) const;
336  virtual bool IsMulticast(void) const;
337  virtual Address GetMulticast(Ipv4Address multicastGroup) const;
338  virtual bool IsPointToPoint(void) const;
339  virtual bool IsBridge(void) const;
340  virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
341  virtual bool SendFrom(Ptr<Packet> packet,
342  const Address& source,
343  const Address& dest,
344  uint16_t protocolNumber);
345  virtual Ptr<Node> GetNode(void) const;
346  virtual void SetNode(Ptr<Node> node);
347  virtual bool NeedsArp(void) const;
348  virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb);
349  virtual Address GetMulticast(Ipv6Address addr) const;
350 
351  virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb);
352  virtual bool SupportsSendFrom(void) const;
353 
354  virtual Ptr<Channel> GetChannel(void) const;
355 
356  protected:
360  virtual void DoDispose(void);
361 
366  Address GetRxUtAddress(Ptr<Packet> packet, SatEnums::SatLinkDir_t ld);
367 
368  NetDevice::ReceiveCallback m_rxCallback;
369  NetDevice::PromiscReceiveCallback m_promiscCallback;
370  Ptr<Node> m_node;
371  uint16_t m_mtu;
372  uint32_t m_ifIndex;
373  Mac48Address m_address;
374  Ptr<ErrorModel> m_receiveErrorModel;
375  std::map<uint32_t, Ptr<SatPhy>> m_userPhy;
376  std::map<uint32_t, Ptr<SatPhy>> m_feederPhy;
377  std::map<uint32_t, Ptr<SatMac>> m_userMac;
378  std::map<uint32_t, Ptr<SatMac>> m_feederMac;
379 
380  std::map<uint32_t, Ptr<SatMac>> m_allFeederMac;
381 
382  std::map<uint32_t, Mac48Address> m_addressMapFeeder;
383 
384  std::map<uint32_t, Mac48Address> m_addressMapUser;
385 
388  uint32_t m_nodeId;
389 
391 
392  std::map<Mac48Address, Time> m_lastDelays;
393 
397  std::map<Mac48Address, uint32_t> m_gwConnected;
398 
402  std::map<Mac48Address, uint32_t> m_utConnected;
403 
407  std::vector<Ptr<PointToPointIslNetDevice>> m_islNetDevices;
408 
412  Ptr<SatIslArbiter> m_arbiter;
413 
417  std::set<uint32_t> m_broadcastReceived;
418 
419  TracedCallback<Time,
422  uint32_t,
423  Mac48Address,
426  std::string>
428 
432  TracedCallback<Ptr<const Packet>> m_txTrace;
433 
438  TracedCallback<Ptr<const Packet>, const Address&> m_signallingTxTrace;
439 
444  TracedCallback<Ptr<const Packet>, const Address&> m_rxFeederTrace;
445 
450  TracedCallback<Ptr<const Packet>, const Address&> m_rxUserTrace;
451 
456  TracedCallback<const Time&, const Address&> m_rxFeederLinkDelayTrace;
457 
462  TracedCallback<const Time&, const Address&> m_rxFeederLinkJitterTrace;
463 
468  TracedCallback<const Time&, const Address&> m_rxUserLinkDelayTrace;
469 
474  TracedCallback<const Time&, const Address&> m_rxUserLinkJitterTrace;
475 };
476 
477 } // namespace ns3
478 
479 #endif /* SATELLITE_ORBITER_NET_DEVICE_H */
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.
SatOrbiterNetDevice to be utilized in geostationary satellite.
Ptr< SatIslArbiter > m_arbiter
Arbiter used to route on ISLs.
void ReceiveFeeder(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters > rxParams)
Receive the packet from the lower layers.
std::map< uint32_t, Mac48Address > m_addressMapFeeder
virtual void ConnectUt(Mac48Address utAddress, uint32_t beamId)=0
Connect a UT to this satellite.
std::map< uint32_t, Mac48Address > m_addressMapUser
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the SatOrbiterNetDevice.
virtual bool IsPointToPoint(void) const
std::set< Mac48Address > GetGwConnected()
The the list of MAC GW connected to this satellite.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
void ConnectGw(Mac48Address gwAddress, uint32_t beamId)
Connect a GW to this satellite.
void DisconnectGw(Mac48Address gwAddress, uint32_t beamId)
Disconnect a GW to this satellite.
std::map< Mac48Address, uint32_t > m_gwConnected
Set containing all connected GWs.
SatEnums::RegenerationMode_t m_forwardLinkRegenerationMode
virtual uint32_t GetIfIndex(void) const
std::vector< Ptr< PointToPointIslNetDevice > > GetIslsNetDevices()
Get all the ISL Net devices.
std::map< uint32_t, Ptr< SatMac > > GetFeederMac()
Get all Feeder MAC objects attached to this satellite that are in use.
TracedCallback< Ptr< const Packet > > m_txTrace
Traced callback for all packets received to be transmitted.
virtual void AddLinkChangeCallback(Callback< void > callback)
void AddUserPair(uint32_t beamId, Mac48Address satelliteUserAddress)
Add an entry in the database to get satellite user address from beam ID.
virtual void DisconnectUt(Mac48Address utAddress, uint32_t beamId)=0
Disconnect a UT to this satellite.
virtual bool SendControlMsgToFeeder(Ptr< SatControlMessage > msg, const Address &dest, Ptr< SatSignalParameters > rxParams)=0
Send a control packet on the feeder link.
Mac48Address GetSatelliteUserAddress(uint32_t beamId)
Get satellite user entry from associated beam ID.
virtual Address GetMulticast(Ipv4Address multicastGroup) const
std::set< Mac48Address > GetUtConnected()
The the list of UT MAC connected to this satellite.
void SetArbiter(Ptr< SatIslArbiter > arbiter)
Set the arbiter for ISL routing.
std::set< uint32_t > m_broadcastReceived
Keep a count of all incoming broadcast data to avoid handling them several times.
Address GetRxUtAddress(Ptr< Packet > packet, SatEnums::SatLinkDir_t ld)
Get UT MAC address associated to this packet.
std::map< uint32_t, Ptr< SatPhy > > GetUserPhy()
Get all User Phy objects attached to this satellite.
std::vector< Ptr< PointToPointIslNetDevice > > m_islNetDevices
List of ISLs starting from this node.
void ReceiveUser(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters > rxParams)
Receive the packet from the lower layers.
virtual Ptr< Node > GetNode(void) const
void SetForwardLinkRegenerationMode(SatEnums::RegenerationMode_t forwardLinkRegenerationMode)
Set the forward link regeneration mode.
NetDevice::ReceiveCallback m_rxCallback
TracedCallback< const Time &, const Address & > m_rxUserLinkJitterTrace
Traced callback for all received packets, including user link jitter information and the address of t...
TracedCallback< Ptr< const Packet >, const Address & > m_rxUserTrace
Traced callback for all received packets on user, including the address of the senders.
TracedCallback< Ptr< const Packet >, const Address & > m_signallingTxTrace
Traced callback for all signalling (control message) packets sent, including the destination address.
TracedCallback< Ptr< const Packet >, const Address & > m_rxFeederTrace
Traced callback for all received packets on feeder, including the address of the senders.
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
TracedCallback< const Time &, const Address & > m_rxFeederLinkDelayTrace
Traced callback for all received packets, including feeder link delay information and the address of ...
std::map< uint32_t, Ptr< SatMac > > m_feederMac
virtual Address GetAddress(void) const
virtual void SetAddress(Address address)
void AddFeederPair(uint32_t beamId, Mac48Address satelliteFeederAddress)
Add an entry in the database to get satellite feeder address from beam ID.
std::map< Mac48Address, Time > m_lastDelays
std::map< uint32_t, Ptr< SatMac > > m_userMac
virtual bool SupportsSendFrom(void) const
std::map< uint32_t, Ptr< SatPhy > > m_userPhy
void AddUserMac(Ptr< SatMac > mac, uint32_t beamId)
Add the User MAC object for the beam.
SatEnums::RegenerationMode_t m_returnLinkRegenerationMode
void AddFeederPhy(Ptr< SatPhy > phy, uint32_t beamId)
Add the Feeder Phy object for the beam.
void SetReturnLinkRegenerationMode(SatEnums::RegenerationMode_t returnLinkRegenerationMode)
Set the return link regeneration mode.
void AddFeederMac(Ptr< SatMac > mac, Ptr< SatMac > macUsed, uint32_t beamId)
Add the Feeder MAC object for the beam.
Ptr< SatIslArbiter > GetArbiter()
Get the arbiter for ISL routing.
std::map< uint32_t, Ptr< SatPhy > > GetFeederPhy()
Get all Feeder Phy objects attached to this satellite.
std::map< uint32_t, Ptr< SatMac > > GetUserMac()
Get all User MAC objects attached to this satellite.
void SendToIsl(Ptr< Packet > packet, Mac48Address destination)
Send a packet to ISL.
NetDevice::PromiscReceiveCallback m_promiscCallback
TracedCallback< Time, SatEnums::SatPacketEvent_t, SatEnums::SatNodeType_t, uint32_t, Mac48Address, SatEnums::SatLogLevel_t, SatEnums::SatLinkDir_t, std::string > m_packetTrace
virtual bool SetMtu(const uint16_t mtu)
virtual void ReceivePacketFeeder(Ptr< Packet > packet, const Address &feederAddress)=0
Receive the packet from the lower layers, in network regeneration on forward link.
std::map< uint32_t, Ptr< SatMac > > GetAllFeederMac()
Get all Feeder MAC objects attached to this satellite.
std::map< uint32_t, Ptr< SatMac > > m_allFeederMac
TracedCallback< const Time &, const Address & > m_rxUserLinkDelayTrace
Traced callback for all received packets, including user link delay information and the address of th...
void AddUserPhy(Ptr< SatPhy > phy, uint32_t beamId)
Add the User Phy object for the beam.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
TracedCallback< const Time &, const Address & > m_rxFeederLinkJitterTrace
Traced callback for all received packets, including feeder link jitter information and the address of...
virtual bool IsMulticast(void) const
virtual Ptr< Channel > GetChannel(void) const
virtual bool IsBroadcast(void) const
static TypeId GetTypeId(void)
Get the type ID.
Mac48Address GetSatelliteFeederAddress(uint32_t beamId)
Get satellite feeder entry from associated beam ID.
virtual Address GetBroadcast(void) const
virtual void SetIfIndex(const uint32_t index)
std::map< uint32_t, Ptr< SatPhy > > m_feederPhy
void AddIslsNetDevice(Ptr< PointToPointIslNetDevice > islNetDevices)
Add a ISL Net Device to this satellite.
virtual uint16_t GetMtu(void) const
virtual void ReceiveFromIsl(Ptr< Packet > packet, Mac48Address destination)=0
Receive a packet from ISL.
virtual void ReceivePacketUser(Ptr< Packet > packet, const Address &userAddress)=0
Receive the packet from the lower layers, in network regeneration on return link.
std::map< Mac48Address, uint32_t > m_utConnected
Set containing all connected UTs.
virtual void DoDispose(void)
Dispose of this class instance.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void SetNode(Ptr< Node > node)
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
Definition: satellite-phy.h:79
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.