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
Packet
;
20
21
/**
22
* @ingroup applications
23
* @defgroup udpecho UdpEcho
24
*/
25
26
/**
27
* @ingroup udpecho
28
* @brief A Udp Echo server
29
*
30
* Every packet received is sent back.
31
*/
32
class
UdpEchoServer
:
public
SinkApplication
33
{
34
public
:
35
static
constexpr
uint16_t
DEFAULT_PORT
{9};
//!< default port
36
37
/**
38
* @brief Get the type ID.
39
* @return the object TypeId
40
*/
41
static
TypeId
GetTypeId
();
42
43
UdpEchoServer
();
44
~UdpEchoServer
()
override
;
45
46
private
:
47
void
DoStartApplication
()
override
;
48
49
/**
50
* @brief Handle a packet reception.
51
*
52
* This function is called by lower layers.
53
*
54
* @param socket the socket the packet was received to.
55
*/
56
void
HandleRead
(
Ptr<Socket>
socket);
57
58
uint8_t
m_tos
;
//!< The packets Type of Service
59
60
/// Callbacks for tracing the packet Rx events, includes source and destination addresses
61
TracedCallback<Ptr<const Packet>
,
const
Address
&,
const
Address
&>
m_rxTraceWithAddresses
;
62
};
63
64
}
// namespace ns3
65
66
#endif
/* UDP_ECHO_SERVER_H */
ns3::Address
a polymophic address class
Definition
address.h:111
ns3::Packet
network packets
Definition
packet.h:228
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:67
ns3::SinkApplication::SinkApplication
SinkApplication(uint16_t defaultPort=0)
Constructor.
Definition
sink-application.cc:53
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:49
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:61
ns3::UdpEchoServer::DEFAULT_PORT
static constexpr uint16_t DEFAULT_PORT
default port
Definition
udp-echo-server.h:35
ns3::UdpEchoServer::m_tos
uint8_t m_tos
The packets Type of Service.
Definition
udp-echo-server.h:58
ns3::UdpEchoServer::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
udp-echo-server.cc:31
ns3::UdpEchoServer::~UdpEchoServer
~UdpEchoServer() override
Definition
udp-echo-server.cc:58
ns3::UdpEchoServer::UdpEchoServer
UdpEchoServer()
Definition
udp-echo-server.cc:51
ns3::UdpEchoServer::DoStartApplication
void DoStartApplication() override
Application specific startup code for child subclasses.
Definition
udp-echo-server.cc:64
ns3::UdpEchoServer::HandleRead
void HandleRead(Ptr< Socket > socket)
Handle a packet reception.
Definition
udp-echo-server.cc:118
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
for ns-3 by
1.15.0