satellite-isl-arbiter.cc
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  * Copyright (c) 2018 CNES
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Inspired and adapted from Hypatia: https://github.com/snkas/hypatia
20  *
21  * Author: Bastien Tauran <bastien.tauran@viveris.fr>
22  */
23 
24 #include "ns3/satellite-isl-arbiter.h"
25 
26 #include <ns3/satellite-id-mapper.h>
27 #include <ns3/singleton.h>
28 
29 NS_LOG_COMPONENT_DEFINE("SatIslArbiter");
30 
31 namespace ns3
32 {
33 
34 NS_OBJECT_ENSURE_REGISTERED(SatIslArbiter);
35 
36 TypeId
38 {
39  static TypeId tid = TypeId("ns3::SatIslArbiter").SetParent<Object>();
40  return tid;
41 }
42 
44 {
45  NS_LOG_FUNCTION(this);
46 
47  NS_FATAL_ERROR("Default constructor not in use");
48 }
49 
51 {
52  NS_LOG_FUNCTION(this << node);
53 
54  m_nodeId = node->GetId();
55 }
56 
57 int32_t
58 SatIslArbiter::BaseDecide(Ptr<Packet> pkt, Mac48Address destination)
59 {
60  NS_LOG_FUNCTION(this << pkt << destination);
61 
62  int32_t targetId = Singleton<SatIdMapper>::Get()->GetSatIdWithMacIsl(destination);
63 
64  if (targetId == -1)
65  {
66  NS_FATAL_ERROR("Cannot resolve target node ID");
67  }
68 
69  return Decide(m_nodeId, targetId, pkt);
70 }
71 
72 } // namespace ns3
virtual int32_t Decide(int32_t sourceSatId, int32_t targetSatId, Ptr< Packet > pkt)=0
Decide how to forward.
static TypeId GetTypeId(void)
int32_t BaseDecide(Ptr< Packet > pkt, Mac48Address destination)
Base decide how to forward.
SatIslArbiter()
Default constructor.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.