A Discrete-Event Network Simulator
API
udp-echo-server.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007 University of Washington
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17 
18 #ifndef UDP_ECHO_SERVER_H
19 #define UDP_ECHO_SERVER_H
20 
21 #include "ns3/address.h"
22 #include "ns3/application.h"
23 #include "ns3/event-id.h"
24 #include "ns3/ptr.h"
25 #include "ns3/traced-callback.h"
26 
27 namespace ns3
28 {
29 
30 class Socket;
31 class Packet;
32 
44 class UdpEchoServer : public Application
45 {
46  public:
51  static TypeId GetTypeId();
52  UdpEchoServer();
53  ~UdpEchoServer() override;
54 
55  protected:
56  void DoDispose() override;
57 
58  private:
59  void StartApplication() override;
60  void StopApplication() override;
61 
69  void HandleRead(Ptr<Socket> socket);
70 
71  uint16_t m_port;
75 
78 
81 };
82 
83 } // namespace ns3
84 
85 #endif /* UDP_ECHO_SERVER_H */
a polymophic address class
Definition: address.h:101
The base class for all ns3 applications.
Definition: application.h:62
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
A Udp Echo server.
void StartApplication() override
Application specific startup code.
uint16_t m_port
Port on which we listen for incoming packets.
Address m_local
local multicast address
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_rxTraceWithAddresses
Callbacks for tracing the packet Rx events, includes source and destination addresses.
void DoDispose() override
Destructor implementation.
Ptr< Socket > m_socket6
IPv6 Socket.
static TypeId GetTypeId()
Get the type ID.
void StopApplication() override
Application specific shutdown code.
TracedCallback< Ptr< const Packet > > m_rxTrace
Callbacks for tracing the packet Rx events.
~UdpEchoServer() override
Ptr< Socket > m_socket
IPv4 Socket.
void HandleRead(Ptr< Socket > socket)
Handle a packet reception.
Every class exported by the ns3 library is enclosed in the ns3 namespace.