A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
udp-server.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007,2008,2009 INRIA, UDCAST
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Amine Ismail <amine.ismail@sophia.inria.fr>
19
* <amine.ismail@udcast.com>
20
*
21
*/
22
23
#ifndef UDP_SERVER_H
24
#define UDP_SERVER_H
25
26
#include "ns3/application.h"
27
#include "ns3/event-id.h"
28
#include "ns3/ptr.h"
29
#include "ns3/address.h"
30
#include "ns3/traced-callback.h"
31
#include "
packet-loss-counter.h
"
32
33
namespace
ns3
{
48
class
UdpServer
:
public
Application
49
{
50
public
:
55
static
TypeId
GetTypeId
(
void
);
56
UdpServer
();
57
virtual
~UdpServer
();
62
uint32_t
GetLost
(
void
)
const
;
63
68
uint64_t
GetReceived
(
void
)
const
;
69
74
uint16_t
GetPacketWindowSize
()
const
;
75
82
void
SetPacketWindowSize
(uint16_t size);
83
protected
:
84
virtual
void
DoDispose
(
void
);
85
86
private
:
87
88
virtual
void
StartApplication
(
void
);
89
virtual
void
StopApplication
(
void
);
90
98
void
HandleRead
(
Ptr<Socket>
socket);
99
100
uint16_t
m_port
;
101
Ptr<Socket>
m_socket
;
102
Ptr<Socket>
m_socket6
;
103
uint64_t
m_received
;
104
PacketLossCounter
m_lossCounter
;
105
107
TracedCallback<Ptr<const Packet>
>
m_rxTrace
;
108
110
TracedCallback<Ptr<const Packet>
,
const
Address
&,
const
Address
&>
m_rxTraceWithAddresses
;
111
112
};
113
114
}
// namespace ns3
115
116
#endif
/* UDP_SERVER_H */
ns3::Address
a polymophic address class
Definition:
address.h:91
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:61
ns3::PacketLossCounter
A class to count the number of lost packets.
Definition:
packet-loss-counter.h:46
ns3::Ptr< Socket >
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition:
traced-callback.h:53
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::UdpServer
A UDP server, receives UDP packets from a remote host.
Definition:
udp-server.h:49
ns3::UdpServer::m_socket6
Ptr< Socket > m_socket6
IPv6 Socket.
Definition:
udp-server.h:102
ns3::UdpServer::m_rxTrace
TracedCallback< Ptr< const Packet > > m_rxTrace
Callbacks for tracing the packet Rx events.
Definition:
udp-server.h:107
ns3::UdpServer::~UdpServer
virtual ~UdpServer()
Definition:
udp-server.cc:79
ns3::UdpServer::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-server.h:110
ns3::UdpServer::m_port
uint16_t m_port
Port on which we listen for incoming packets.
Definition:
udp-server.h:100
ns3::UdpServer::GetReceived
uint64_t GetReceived(void) const
Returns the number of received packets.
Definition:
udp-server.cc:106
ns3::UdpServer::m_socket
Ptr< Socket > m_socket
IPv4 Socket.
Definition:
udp-server.h:101
ns3::UdpServer::GetLost
uint32_t GetLost(void) const
Returns the number of lost packets.
Definition:
udp-server.cc:99
ns3::UdpServer::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
udp-server.cc:45
ns3::UdpServer::HandleRead
void HandleRead(Ptr< Socket > socket)
Handle a packet reception.
Definition:
udp-server.cc:166
ns3::UdpServer::StartApplication
virtual void StartApplication(void)
Application specific startup code.
Definition:
udp-server.cc:120
ns3::UdpServer::m_lossCounter
PacketLossCounter m_lossCounter
Lost packet counter.
Definition:
udp-server.h:104
ns3::UdpServer::SetPacketWindowSize
void SetPacketWindowSize(uint16_t size)
Set the size of the window used for checking loss.
Definition:
udp-server.cc:92
ns3::UdpServer::UdpServer
UdpServer()
Definition:
udp-server.cc:72
ns3::UdpServer::m_received
uint64_t m_received
Number of received packets.
Definition:
udp-server.h:103
ns3::UdpServer::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
udp-server.cc:113
ns3::UdpServer::StopApplication
virtual void StopApplication(void)
Application specific shutdown code.
Definition:
udp-server.cc:155
ns3::UdpServer::GetPacketWindowSize
uint16_t GetPacketWindowSize() const
Returns the size of the window used for checking loss.
Definition:
udp-server.cc:85
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
packet-loss-counter.h
src
applications
model
udp-server.h
Generated on Tue Feb 6 2024 19:21:15 for ns-3 by
1.9.1