A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
9
#include "
source-application.h
"
10
11
#include "ns3/log.h"
12
#include "ns3/uinteger.h"
13
14
namespace
ns3
15
{
16
17
NS_LOG_COMPONENT_DEFINE
(
"SourceApplication"
);
18
19
NS_OBJECT_ENSURE_REGISTERED
(SourceApplication);
20
21
TypeId
22
SourceApplication::GetTypeId
()
23
{
24
static
TypeId
tid =
25
TypeId
(
"ns3::SourceApplication"
)
26
.
SetParent
<
Application
>()
27
.SetGroupName(
"Applications"
)
28
.AddAttribute(
29
"Remote"
,
30
"The address of the destination, made of the remote IP address and the "
31
"destination port"
,
32
AddressValue
(),
33
MakeAddressAccessor
(&
SourceApplication::SetRemote
, &
SourceApplication::GetRemote
),
34
MakeAddressChecker
())
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."
,
38
AddressValue
(),
39
MakeAddressAccessor
(&
SourceApplication::m_local
),
40
MakeAddressChecker
())
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)."
,
44
UintegerValue
(0),
45
MakeUintegerAccessor
(&
SourceApplication::m_tos
),
46
MakeUintegerChecker<uint8_t>
());
47
return
tid;
48
}
49
50
SourceApplication::SourceApplication
()
51
: m_peer{}
52
{
53
NS_LOG_FUNCTION
(
this
);
54
}
55
56
SourceApplication::~SourceApplication
()
57
{
58
NS_LOG_FUNCTION
(
this
);
59
}
60
61
void
62
SourceApplication::SetRemote
(
const
Address
& addr)
63
{
64
NS_LOG_FUNCTION
(
this
<< addr);
65
if
(!addr.
IsInvalid
())
66
{
67
m_peer
= addr;
68
}
69
}
70
71
Address
72
SourceApplication::GetRemote
()
const
73
{
74
return
m_peer
;
75
}
76
77
}
// Namespace ns3
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Address::IsInvalid
bool IsInvalid() const
Definition
address.cc:60
ns3::AddressValue
AttributeValue implementation for Address.
Definition
address.h:275
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::SourceApplication::~SourceApplication
~SourceApplication() override
Definition
source-application.cc:56
ns3::SourceApplication::m_local
Address m_local
Local address to bind to.
Definition
source-application.h:60
ns3::SourceApplication::GetRemote
Address GetRemote() const
get the remote address
Definition
source-application.cc:72
ns3::SourceApplication::SetRemote
virtual void SetRemote(const Address &addr)
set the remote address
Definition
source-application.cc:62
ns3::SourceApplication::m_tos
uint8_t m_tos
The packets Type of Service.
Definition
source-application.h:61
ns3::SourceApplication::SourceApplication
SourceApplication()
Definition
source-application.cc:50
ns3::SourceApplication::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
source-application.cc:22
ns3::SourceApplication::m_peer
Address m_peer
Peer address.
Definition
source-application.h:59
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
ns3::UintegerValue
Hold an unsigned integer type.
Definition
uinteger.h:34
ns3::MakeAddressChecker
Ptr< const AttributeChecker > MakeAddressChecker()
Definition
address.cc:169
ns3::MakeAddressAccessor
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
ns3::MakeUintegerChecker
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition
uinteger.h:85
ns3::MakeUintegerAccessor
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
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
source-application.h
src
applications
model
source-application.cc
Generated on Thu Dec 12 2024 18:40:35 for ns-3 by
1.11.0