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
13#include "ns3/application.h"
14#include "ns3/node-container.h"
15#include "ns3/point-to-point-net-device.h"
16
17namespace ns3
18{
19namespace lorawan
20{
21
25class NetworkStatus;
26
27/**
28 * @ingroup lorawan
29 *
30 * The NetworkServer is an application standing on top of a node equipped with
31 * links that connect it with the gateways.
32 *
33 * This version of the NetworkServer application attempts to closely mimic an actual
34 * network server, by providing as much functionality as possible.
35 */
37{
38 public:
39 /**
40 * Register this type.
41 * @return The object TypeId.
42 */
43 static TypeId GetTypeId();
44
45 NetworkServer(); //!< Default constructor
46 ~NetworkServer() override; //!< Destructor
47
48 /**
49 * Start the network server application.
50 */
51 void StartApplication() override;
52
53 /**
54 * Stop the network server application.
55 */
56 void StopApplication() override;
57
58 /**
59 * Inform the NetworkServer application that these nodes are connected to the network.
60 *
61 * This method will create a DeviceStatus object for each new node, and add
62 * it to the list.
63 *
64 * @param nodes The end device NodeContainer.
65 */
67
68 /**
69 * Inform the NetworkServer application that this node is connected to the network.
70 *
71 * This method will create a DeviceStatus object for the new node (if it
72 * doesn't already exist).
73 *
74 * @param node The end device Node.
75 */
76 void AddNode(Ptr<Node> node);
77
78 /**
79 * Add the gateway to the list of gateways connected to this network server.
80 *
81 * Each gateway is identified by its Address in the network connecting it to the network
82 * server.
83 *
84 * @param gateway A pointer to the gateway Node.
85 * @param netDevice A pointer to the network server's NetDevice connected to the gateway.
86 */
87 void AddGateway(Ptr<Node> gateway, Ptr<NetDevice> netDevice);
88
89 /**
90 * Add a NetworkControllerComponent to this NetworkServer application.
91 *
92 * @param component A pointer to the NetworkControllerComponent object.
93 */
95
96 /**
97 * Receive a packet from a gateway.
98 *
99 * This function is meant to be provided to NetDevice objects as a ReceiveCallback.
100 *
101 * @copydoc ns3::NetDevice::ReceiveCallback
102 */
103 bool Receive(Ptr<NetDevice> device,
104 Ptr<const Packet> packet,
105 uint16_t protocol,
106 const Address& sender);
107
108 /**
109 * Get the NetworkStatus object of this NetworkServer application.
110 *
111 * @return A pointer to the NetworkStatus object.
112 */
114
115 protected:
116 Ptr<NetworkStatus> m_status; //!< Ptr to the NetworkStatus object.
117 Ptr<NetworkController> m_controller; //!< Ptr to the NetworkController object.
118 Ptr<NetworkScheduler> m_scheduler; //!< Ptr to the NetworkScheduler object.
119
120 TracedCallback<Ptr<const Packet>> m_receivedPacket; //!< The `ReceivedPacket` trace source.
121};
122
123} // namespace lorawan
124} // namespace ns3
125
126#endif /* NETWORK_SERVER_H */
a polymophic address class
Definition address.h:114
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:50
Generic class describing a component of the NetworkController.
This class collects a series of components that deal with various aspects of managing the network,...
Network server component in charge of scheduling downling packets onto devices' reception windows.
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.
This class represents the knowledge about the state of the network that is available at the network s...
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.