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 "ns3/address.h"
11
#include "ns3/application.h"
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
Application
34
{
35
public
:
36
/**
37
* \brief Get the type ID.
38
* \return the object TypeId
39
*/
40
static
TypeId
GetTypeId
();
41
UdpEchoServer
();
42
~UdpEchoServer
()
override
;
43
44
private
:
45
void
StartApplication
()
override
;
46
void
StopApplication
()
override
;
47
48
/**
49
* \brief Handle a packet reception.
50
*
51
* This function is called by lower layers.
52
*
53
* \param socket the socket the packet was received to.
54
*/
55
void
HandleRead
(
Ptr<Socket>
socket);
56
57
uint16_t
m_port
;
//!< Port on which we listen for incoming packets.
58
uint8_t
m_tos
;
//!< The packets Type of Service
59
Ptr<Socket>
m_socket
;
//!< IPv4 Socket
60
Ptr<Socket>
m_socket6
;
//!< IPv6 Socket
61
Address
m_local
;
//!< local multicast address
62
63
/// Callbacks for tracing the packet Rx events
64
TracedCallback<Ptr<const Packet>
>
m_rxTrace
;
65
66
/// Callbacks for tracing the packet Rx events, includes source and destination addresses
67
TracedCallback<Ptr<const Packet>
,
const
Address
&,
const
Address
&>
m_rxTraceWithAddresses
;
68
};
69
70
}
// namespace ns3
71
72
#endif
/* UDP_ECHO_SERVER_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
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:73
ns3::UdpEchoServer::m_port
uint16_t m_port
Port on which we listen for incoming packets.
Definition
udp-echo-server.h:57
ns3::UdpEchoServer::m_local
Address m_local
local multicast address
Definition
udp-echo-server.h:61
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:67
ns3::UdpEchoServer::m_socket6
Ptr< Socket > m_socket6
IPv6 Socket.
Definition
udp-echo-server.h:60
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::StopApplication
void StopApplication() override
Application specific shutdown code.
Definition
udp-echo-server.cc:131
ns3::UdpEchoServer::m_rxTrace
TracedCallback< Ptr< const Packet > > m_rxTrace
Callbacks for tracing the packet Rx events.
Definition
udp-echo-server.h:64
ns3::UdpEchoServer::~UdpEchoServer
~UdpEchoServer() override
Definition
udp-echo-server.cc:65
ns3::UdpEchoServer::m_socket
Ptr< Socket > m_socket
IPv4 Socket.
Definition
udp-echo-server.h:59
ns3::UdpEchoServer::UdpEchoServer
UdpEchoServer()
Definition
udp-echo-server.cc:60
ns3::UdpEchoServer::HandleRead
void HandleRead(Ptr< Socket > socket)
Handle a packet reception.
Definition
udp-echo-server.cc:148
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
applications
model
udp-echo-server.h
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0