A Discrete-Event Network Simulator
API
packet-socket-server.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Universita' di Firenze
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: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19  */
20 
21 #ifndef PACKET_SOCKET_SERVER_H
22 #define PACKET_SOCKET_SERVER_H
23 
24 #include "ns3/application.h"
25 #include "ns3/event-id.h"
26 #include "ns3/ptr.h"
27 #include "ns3/packet-socket-address.h"
28 
29 namespace ns3 {
30 
31 class Socket;
32 class Packet;
33 
47 {
48 public:
53  static TypeId GetTypeId (void);
54 
56 
57  virtual ~PacketSocketServer ();
58 
63  void SetLocal (PacketSocketAddress addr);
64 
65 protected:
66  virtual void DoDispose (void);
67 
68 private:
69 
70  virtual void StartApplication (void);
71  virtual void StopApplication (void);
72 
77  void HandleRead (Ptr<Socket> socket);
78 
79  uint32_t m_pktRx;
80  uint32_t m_bytesRx;
81 
85 
88 };
89 
90 } // namespace ns3
91 
92 #endif /* PACKET_SOCKET_SERVER_H */
bool m_localAddressSet
Sanity check.
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
PacketSocketAddress m_localAddress
Local address.
Forward calls to a chain of Callback.
uint32_t m_bytesRx
Total bytes received.
uint32_t m_pktRx
The number of received packets.
an address for a packet socket
virtual void StartApplication(void)
Application specific startup code.
void HandleRead(Ptr< Socket > socket)
Handle a packet received by the application.
a polymophic address class
Definition: address.h:90
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced Callback: received packets, source address.
The base class for all ns3 applications.
Definition: application.h:60
Ptr< Socket > m_socket
Socket.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Get the type ID.
virtual void StopApplication(void)
Application specific shutdown code.
A server using PacketSocket.
a unique identifier for an interface.
Definition: type-id.h:58