A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
source-application.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 DERONNE SOFTWARE ENGINEERING
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
7 */
8
9#ifndef SOURCE_APPLICATION_H
10#define SOURCE_APPLICATION_H
11
12#include "ns3/address.h"
13#include "ns3/application.h"
14
15namespace ns3
16{
17
18/**
19 * @ingroup applications
20 * @brief Base class for source applications.
21 *
22 * This class can be used as a base class for source applications.
23 * A source application is one that primarily sources new data towards a single remote client
24 * address and port, and may also receive data (such as an HTTP server).
25 *
26 * The main purpose of this base class application public API is to provide a uniform way to
27 * configure remote and local addresses.
28 *
29 * Unlike the SinkApplication, the SourceApplication does not expose an individual Port attribute.
30 * Instead, the port values are embedded in the Local and Remote address attributes, which should be
31 * configured to an InetSocketAddress or Inet6SocketAddress value that contains the desired port
32 * number.
33 */
35{
36 public:
37 /**
38 * @brief Get the type ID.
39 * @return the object TypeId
40 */
41 static TypeId GetTypeId();
42
44 ~SourceApplication() override;
45
46 /**
47 * @brief set the remote address
48 * @param addr remote address
49 */
50 virtual void SetRemote(const Address& addr);
51
52 /**
53 * @brief get the remote address
54 * @return the remote address
55 */
56 Address GetRemote() const;
57
58 protected:
59 Address m_peer; //!< Peer address
60 Address m_local; //!< Local address to bind to
61 uint8_t m_tos; //!< The packets Type of Service
62};
63
64} // namespace ns3
65
66#endif /* SOURCE_APPLICATION_H */
a polymophic address class
Definition address.h:90
The base class for all ns3 applications.
Definition application.h:51
Base class for source applications.
Address m_local
Local address to bind to.
Address GetRemote() const
get the remote address
virtual void SetRemote(const Address &addr)
set the remote address
uint8_t m_tos
The packets Type of Service.
static TypeId GetTypeId()
Get the type ID.
Address m_peer
Peer address.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.