A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
network-server.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 University of Padova
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Davide Magrin <magrinda@dei.unipd.it>
7 * Martina Capuzzo <capuzzom@dei.unipd.it>
8 */
9
10#ifndef NETWORK_SERVER_H
11#define NETWORK_SERVER_H
12
14#include "gateway-status.h"
15#include "lora-device-address.h"
16#include "network-controller.h"
17#include "network-scheduler.h"
18#include "network-status.h"
19
20#include "ns3/application.h"
21#include "ns3/log.h"
22#include "ns3/net-device.h"
23#include "ns3/node-container.h"
24#include "ns3/object.h"
25#include "ns3/packet.h"
26#include "ns3/point-to-point-net-device.h"
27
28namespace ns3
29{
30namespace lorawan
31{
32
33/**
34 * \ingroup lorawan
35 *
36 * The NetworkServer is an application standing on top of a node equipped with
37 * links that connect it with the gateways.
38 *
39 * This version of the NetworkServer application attempts to closely mimic an actual
40 * network server, by providing as much functionality as possible.
41 */
43{
44 public:
45 /**
46 * Register this type.
47 * \return The object TypeId.
48 */
49 static TypeId GetTypeId();
50
51 NetworkServer(); //!< Default constructor
52 ~NetworkServer() override; //!< Destructor
53
54 /**
55 * Start the network server application.
56 */
57 void StartApplication() override;
58
59 /**
60 * Stop the network server application.
61 */
62 void StopApplication() override;
63
64 /**
65 * Inform the NetworkServer application that these nodes are connected to the network.
66 *
67 * This method will create a DeviceStatus object for each new node, and add
68 * it to the list.
69 *
70 * \param nodes The end device NodeContainer.
71 */
73
74 /**
75 * Inform the NetworkServer application that this node is connected to the network.
76 *
77 * This method will create a DeviceStatus object for the new node (if it
78 * doesn't already exist).
79 *
80 * \param node The end device Node.
81 */
82 void AddNode(Ptr<Node> node);
83
84 /**
85 * Add the gateway to the list of gateways connected to this network server.
86 *
87 * Each gateway is identified by its Address in the network connecting it to the network
88 * server.
89 *
90 * \param gateway A pointer to the gateway Node.
91 * \param netDevice A pointer to the network server's NetDevice connected to the gateway.
92 */
93 void AddGateway(Ptr<Node> gateway, Ptr<NetDevice> netDevice);
94
95 /**
96 * Add a NetworkControllerComponent to this NetworkServer application.
97 *
98 * \param component A pointer to the NetworkControllerComponent object.
99 */
101
102 /**
103 * Receive a packet from a gateway.
104 *
105 * This function is meant to be provided to NetDevice objects as a ReceiveCallback.
106 *
107 * \copydoc ns3::NetDevice::ReceiveCallback
108 */
109 bool Receive(Ptr<NetDevice> device,
110 Ptr<const Packet> packet,
111 uint16_t protocol,
112 const Address& sender);
113
114 /**
115 * Get the NetworkStatus object of this NetworkServer application.
116 *
117 * \return A pointer to the NetworkStatus object.
118 */
120
121 protected:
122 Ptr<NetworkStatus> m_status; //!< Ptr to the NetworkStatus object.
123 Ptr<NetworkController> m_controller; //!< Ptr to the NetworkController object.
124 Ptr<NetworkScheduler> m_scheduler; //!< Ptr to the NetworkScheduler object.
125
126 TracedCallback<Ptr<const Packet>> m_receivedPacket; //!< The `ReceivedPacket` trace source.
127};
128
129} // namespace lorawan
130
131} // namespace ns3
132#endif /* NETWORK_SERVER_H */
a polymophic address class
Definition address.h:90
The base class for all ns3 applications.
Definition application.h:51
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:48
The NetworkServer is an application standing on top of a node equipped with links that connect it wit...
void AddNode(Ptr< Node > node)
Inform the NetworkServer application that this node is connected to the network.
NetworkServer()
Default constructor.
Ptr< NetworkStatus > GetNetworkStatus()
Get the NetworkStatus object of this NetworkServer application.
void AddGateway(Ptr< Node > gateway, Ptr< NetDevice > netDevice)
Add the gateway to the list of gateways connected to this network server.
TracedCallback< Ptr< const Packet > > m_receivedPacket
The ReceivedPacket trace source.
bool Receive(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &sender)
Receive a packet from a gateway.
void StopApplication() override
Stop the network server application.
static TypeId GetTypeId()
Register this type.
Ptr< NetworkScheduler > m_scheduler
Ptr to the NetworkScheduler object.
Ptr< NetworkStatus > m_status
Ptr to the NetworkStatus object.
void AddNodes(NodeContainer nodes)
Inform the NetworkServer application that these nodes are connected to the network.
~NetworkServer() override
Destructor.
void AddComponent(Ptr< NetworkControllerComponent > component)
Add a NetworkControllerComponent to this NetworkServer application.
void StartApplication() override
Start the network server application.
Ptr< NetworkController > m_controller
Ptr to the NetworkController object.
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.