A Discrete-Event Network Simulator
API
packet-socket-client.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Universita' di Firenze
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  * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
18  */
19 
20 #ifndef PACKET_SOCKET_CLIENT_H
21 #define PACKET_SOCKET_CLIENT_H
22 
23 #include "ns3/application.h"
24 #include "ns3/event-id.h"
25 #include "ns3/packet-socket-address.h"
26 #include "ns3/ptr.h"
27 #include "ns3/traced-callback.h"
28 
29 namespace ns3
30 {
31 
32 class Socket;
33 class Packet;
34 
54 {
55  public:
60  static TypeId GetTypeId();
61 
63 
64  ~PacketSocketClient() override;
65 
70  void SetRemote(PacketSocketAddress addr);
71 
76  uint8_t GetPriority() const;
77 
78  protected:
79  void DoDispose() override;
80 
81  private:
82  void StartApplication() override;
83  void StopApplication() override;
84 
89  void SetPriority(uint8_t priority);
90 
94  void Send();
95 
96  uint32_t m_maxPackets;
98  uint32_t m_size;
99  uint8_t m_priority;
100 
101  uint32_t m_sent;
106 
109 };
110 
111 } // namespace ns3
112 
113 #endif /* PACKET_SOCKET_CLIENT_H */
a polymophic address class
Definition: address.h:100
The base class for all ns3 applications.
Definition: application.h:61
An identifier for simulation events.
Definition: event-id.h:55
an address for a packet socket
uint32_t m_sent
Counter for sent packets.
void StopApplication() override
Application specific shutdown code.
TracedCallback< Ptr< const Packet >, const Address & > m_txTrace
Traced Callback: sent packets, source address.
Ptr< Socket > m_socket
Socket.
void DoDispose() override
Destructor implementation.
uint8_t GetPriority() const
Query the priority value of this socket.
EventId m_sendEvent
Event to send the next packet.
uint32_t m_maxPackets
Maximum number of packets the application will send.
void SetPriority(uint8_t priority)
Manually set the socket priority.
static TypeId GetTypeId()
Get the type ID.
bool m_peerAddressSet
Sanity check.
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
uint32_t m_size
Size of the sent packet.
uint8_t m_priority
Priority of the sent packets.
void StartApplication() override
Application specific startup code.
PacketSocketAddress m_peerAddress
Remote peer address.
Time m_interval
Packet inter-send time.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.