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
udp-echo-server.h
Go to the documentation of this file.
1
/*
2
* Copyright 2007 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*/
6
7
#ifndef UDP_ECHO_SERVER_H
8
#define UDP_ECHO_SERVER_H
9
10
#include "
sink-application.h
"
11
12
#include "ns3/event-id.h"
13
#include "ns3/ptr.h"
14
#include "ns3/traced-callback.h"
15
16
namespace
ns3
17
{
18
19
class
Socket;
20
class
Packet;
21
22
/**
23
* @ingroup applications
24
* @defgroup udpecho UdpEcho
25
*/
26
27
/**
28
* @ingroup udpecho
29
* @brief A Udp Echo server
30
*
31
* Every packet received is sent back.
32
*/
33
class
UdpEchoServer
:
public
SinkApplication
34
{
35
public
:
36
static
constexpr
uint16_t
DEFAULT_PORT
{9};
//!< default port
37
38
/**
39
* @brief Get the type ID.
40
* @return the object TypeId
41
*/
42
static
TypeId
GetTypeId
();
43
44
UdpEchoServer
();
45
~UdpEchoServer
()
override
;
46
47
private
:
48
void
StartApplication
()
override
;
49
void
StopApplication
()
override
;
50
51
/**
52
* @brief Handle a packet reception.
53
*
54
* This function is called by lower layers.
55
*
56
* @param socket the socket the packet was received to.
57
*/
58
void
HandleRead
(
Ptr<Socket>
socket);
59
60
uint8_t
m_tos
;
//!< The packets Type of Service
61
Ptr<Socket>
m_socket
;
//!< Socket
62
Ptr<Socket>
m_socket6
;
//!< IPv6 Socket (used if only port is specified)
63
64
/// Callbacks for tracing the packet Rx events
65
TracedCallback<Ptr<const Packet>
>
m_rxTrace
;
66
67
/// Callbacks for tracing the packet Rx events, includes source and destination addresses
68
TracedCallback<Ptr<const Packet>
,
const
Address
&,
const
Address
&>
m_rxTraceWithAddresses
;
69
};
70
71
}
// namespace ns3
72
73
#endif
/* UDP_ECHO_SERVER_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SinkApplication
Base class for sink applications.
Definition
sink-application.h:39
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition
traced-callback.h:43
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::UdpEchoServer
A Udp Echo server.
Definition
udp-echo-server.h:34
ns3::UdpEchoServer::StartApplication
void StartApplication() override
Application specific startup code.
Definition
udp-echo-server.cc:71
ns3::UdpEchoServer::m_rxTraceWithAddresses
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_rxTraceWithAddresses
Callbacks for tracing the packet Rx events, includes source and destination addresses.
Definition
udp-echo-server.h:68
ns3::UdpEchoServer::DEFAULT_PORT
static constexpr uint16_t DEFAULT_PORT
default port
Definition
udp-echo-server.h:36
ns3::UdpEchoServer::m_socket6
Ptr< Socket > m_socket6
IPv6 Socket (used if only port is specified)
Definition
udp-echo-server.h:62
ns3::UdpEchoServer::m_tos
uint8_t m_tos
The packets Type of Service.
Definition
udp-echo-server.h:60
ns3::UdpEchoServer::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
udp-echo-server.cc:31
ns3::UdpEchoServer::StopApplication
void StopApplication() override
Application specific shutdown code.
Definition
udp-echo-server.cc:134
ns3::UdpEchoServer::m_rxTrace
TracedCallback< Ptr< const Packet > > m_rxTrace
Callbacks for tracing the packet Rx events.
Definition
udp-echo-server.h:65
ns3::UdpEchoServer::~UdpEchoServer
~UdpEchoServer() override
Definition
udp-echo-server.cc:63
ns3::UdpEchoServer::m_socket
Ptr< Socket > m_socket
Socket.
Definition
udp-echo-server.h:61
ns3::UdpEchoServer::UdpEchoServer
UdpEchoServer()
Definition
udp-echo-server.cc:55
ns3::UdpEchoServer::HandleRead
void HandleRead(Ptr< Socket > socket)
Handle a packet reception.
Definition
udp-echo-server.cc:151
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
sink-application.h
src
applications
model
udp-echo-server.h
Generated on Wed Dec 11 2024 09:20:46 for ns-3 by
1.11.0