A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
source-application.cc
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
10
11#include "ns3/log.h"
12#include "ns3/uinteger.h"
13
14namespace ns3
15{
16
17NS_LOG_COMPONENT_DEFINE("SourceApplication");
18
19NS_OBJECT_ENSURE_REGISTERED(SourceApplication);
20
21TypeId
23{
24 static TypeId tid =
25 TypeId("ns3::SourceApplication")
27 .SetGroupName("Applications")
28 .AddAttribute(
29 "Remote",
30 "The address of the destination, made of the remote IP address and the "
31 "destination port",
35 .AddAttribute("Local",
36 "The Address on which to bind the socket. If not set, it is generated "
37 "automatically when needed by the application.",
41 .AddAttribute("Tos",
42 "The Type of Service used to send IPv4 packets. "
43 "All 8 bits of the TOS byte are set (including ECN bits).",
47 return tid;
48}
49
51 : m_peer{}
52{
53 NS_LOG_FUNCTION(this);
54}
55
60
61void
63{
64 NS_LOG_FUNCTION(this << addr);
65 if (!addr.IsInvalid())
66 {
67 m_peer = addr;
68 }
69}
70
73{
74 return m_peer;
75}
76
77} // Namespace ns3
a polymophic address class
Definition address.h:90
bool IsInvalid() const
Definition address.cc:60
AttributeValue implementation for Address.
Definition address.h:275
The base class for all ns3 applications.
Definition application.h:51
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
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
Ptr< const AttributeChecker > MakeAddressChecker()
Definition address.cc:169
Ptr< const AttributeAccessor > MakeAddressAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition address.h:275
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition uinteger.h:35
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.