Loading...
Searching...
No Matches
satellite-user-helper.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 * 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 * Author: Sami Rantanen <sami.rantanen@magister.fi>
20 * Author: Mathias Ettinger <mettinger@toulouse.viveris.com>
21 */
22
23#ifndef SAT_USER_HELPER_H
24#define SAT_USER_HELPER_H
25
26#include "ns3/csma-helper.h"
27#include "ns3/ipv4-address-helper.h"
28#include "ns3/node-container.h"
29#include "ns3/satellite-enums.h"
30#include "ns3/traced-callback.h"
31
32#include <map>
33#include <set>
34#include <stdint.h>
35#include <string>
36
37namespace ns3
38{
39
40class PropagationDelayModel;
41class SatArpCache;
42class NetDevice;
43class Node;
44
49class SatUserHelper : public Object
50{
51 public:
60
64 typedef std::map<Ptr<Node>, NodeContainer> UtUsersContainer_t;
65
69 static TypeId GetTypeId(void);
70
76 virtual ~SatUserHelper();
77
95 void SetCsmaQueue(std::string type,
96 std::string name1 = "",
97 const AttributeValue& value1 = EmptyAttributeValue(),
98 std::string name2 = "",
99 const AttributeValue& value2 = EmptyAttributeValue(),
100 std::string name3 = "",
101 const AttributeValue& value3 = EmptyAttributeValue(),
102 std::string name4 = "",
103 const AttributeValue& value4 = EmptyAttributeValue());
104
115 void SetCsmaDeviceAttribute(std::string name, const AttributeValue& value);
116
127 void SetCsmaChannelAttribute(std::string name, const AttributeValue& value);
128
140 void SetUtBaseAddress(const Ipv4Address& network,
141 const Ipv4Mask& mask,
142 Ipv4Address base = "0.0.0.1");
143
155 void SetGwBaseAddress(const Ipv4Address& network,
156 const Ipv4Mask& mask,
157 Ipv4Address base = "0.0.0.1");
158
170 void SetBeamBaseAddress(const Ipv4Address& network,
171 const Ipv4Mask& mask,
172 Ipv4Address base = "0.0.0.1");
173
185 NodeContainer InstallUt(NodeContainer ut, uint32_t users);
186
198 NodeContainer InstallUt(Ptr<Node> ut, uint32_t users);
199
210 void InstallGw(uint32_t users);
211
218 bool IsGwUser(Ptr<Node> node) const;
219
226 void EnableCreationTraces(Ptr<OutputStreamWrapper> stream, CallbackBase& cb);
227
233 std::string GetRouterInfo() const;
234
238 Ptr<Node> GetRouter() const;
239
247 void PopulateBeamRoutings(NodeContainer ut,
248 NetDeviceContainer utNd,
249 Ptr<Node> gw,
250 Ptr<NetDevice> gwNd);
251
260 void UpdateUtRoutes(Address ut, Address newGateway);
261
269 void UpdateGwRoutes(Address ut, Address oldGateway, Address newGateway);
270
271 typedef Callback<Ptr<PropagationDelayModel>, uint32_t, uint32_t, SatEnums::ChannelType_t>
273
274 private:
281 NetDeviceContainer InstallSubscriberNetwork(const NodeContainer& c) const;
282
289 NetDeviceContainer InstallBackboneNetwork(const NodeContainer& c) const;
290
297 NetDeviceContainer InstallSatSimpleNetwork(const NodeContainer& c) const;
298
304 void InstallRouter(Ptr<Node> router);
305
306 CsmaHelper m_csma;
307 Ipv4AddressHelper m_ipv4Ut;
308 Ipv4AddressHelper m_ipv4Gw;
309 Ipv4AddressHelper m_ipv4Beam;
310
313
314 Ptr<Node> m_router;
315
328 std::map<Ptr<Node>, Ptr<Node>> m_utMap;
329
333 TracedCallback<std::string> m_creationTrace;
334
340 std::map<Address, Ptr<NetDevice>> m_utDevices;
341
347 std::map<Address, Ptr<NetDevice>> m_gwDevices;
348
354 std::map<Address, Ptr<SatArpCache>> m_arpCachesToGateway;
355
357};
358
359} // namespace ns3
360
361#endif /* SAT_USER_HELPER_H */
An ARP cache interface for satellite module.
ChannelType_t
Types of channel.
std::map< Ptr< Node >, NodeContainer > UtUsersContainer_t
Define UT user container.
Callback< Ptr< PropagationDelayModel >, uint32_t, uint32_t, SatEnums::ChannelType_t > PropagationDelayCallback
Ipv4AddressHelper m_ipv4Gw
void InstallGw(uint32_t users)
void SetCsmaDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each CsmaNetDevice object created by the helper.
std::map< Address, Ptr< NetDevice > > m_utDevices
Container of UT SatNetDevice accessible by MAC address.
void UpdateGwRoutes(Address ut, Address oldGateway, Address newGateway)
Update ARP cache and default route on the terrestrial network so packets are properly routed to the U...
void SetBeamBaseAddress(const Ipv4Address &network, const Ipv4Mask &mask, Ipv4Address base="0.0.0.1")
NetDeviceContainer InstallSatSimpleNetwork(const NodeContainer &c) const
Install satellite simple network.
static TypeId GetTypeId(void)
Derived from Object.
void InstallRouter(Ptr< Node > router)
Install IP router to to Gateways.
TracedCallback< std::string > m_creationTrace
Trace callback for creation traces.
std::map< Ptr< Node >, Ptr< Node > > m_utMap
Container of UT users and their corresponding UT.
void SetCsmaQueue(std::string type, std::string name1="", const AttributeValue &value1=EmptyAttributeValue(), std::string name2="", const AttributeValue &value2=EmptyAttributeValue(), std::string name3="", const AttributeValue &value3=EmptyAttributeValue(), std::string name4="", const AttributeValue &value4=EmptyAttributeValue())
Set the type and the attribute values to be associated with each Queue object in each CsmaNetDevice c...
std::map< Address, Ptr< SatArpCache > > m_arpCachesToGateway
Container of ARP tables to reach a gateway accessible by MAC address.
void SetCsmaChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each CsmaChannel object created by the helper.
std::string GetRouterInfo() const
Get router information.
void EnableCreationTraces(Ptr< OutputStreamWrapper > stream, CallbackBase &cb)
Enables creation traces to be written in given file.
NetDeviceContainer InstallBackboneNetwork(const NodeContainer &c) const
Install network between GW and Router (or users) or Router and its users.
void SetGwBaseAddress(const Ipv4Address &network, const Ipv4Mask &mask, Ipv4Address base="0.0.0.1")
Ipv4AddressHelper m_ipv4Beam
std::map< Address, Ptr< NetDevice > > m_gwDevices
Container of GW SatNetDevice accessible by MAC address.
Ptr< Node > GetRouter() const
NetworkType
Network types in user networks (subscriber or backbone).
void PopulateBeamRoutings(NodeContainer ut, NetDeviceContainer utNd, Ptr< Node > gw, Ptr< NetDevice > gwNd)
Set needed routings of satellite network and fill ARP cache for the network.
SatUserHelper::PropagationDelayCallback m_propagationDelayCallback
bool IsGwUser(Ptr< Node > node) const
Check if node is GW user or not.
NodeContainer InstallUt(NodeContainer ut, uint32_t users)
void UpdateUtRoutes(Address ut, Address newGateway)
Update ARP cache and default route on an UT so packets are properly routed to the new GW as their nex...
SatUserHelper()
Create a SatUserHelper to make life easier when creating Users and their connections to satellite net...
Ipv4AddressHelper m_ipv4Ut
NetDeviceContainer InstallSubscriberNetwork(const NodeContainer &c) const
Install network between UT and its users.
void SetUtBaseAddress(const Ipv4Address &network, const Ipv4Mask &mask, Ipv4Address base="0.0.0.1")
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.