A Discrete-Event Network Simulator
API
packet-socket-client.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_CLIENT_H
22 #define PACKET_SOCKET_CLIENT_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 
53 {
54 public:
59  static TypeId GetTypeId (void);
60 
62 
63  virtual ~PacketSocketClient ();
64 
69  void SetRemote (PacketSocketAddress addr);
70 
75  uint8_t GetPriority (void) const;
76 
77 protected:
78  virtual void DoDispose (void);
79 
80 private:
81 
82  virtual void StartApplication (void);
83  virtual void StopApplication (void);
84 
89  void SetPriority (uint8_t priority);
90 
94  void Send (void);
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:91
The base class for all ns3 applications.
Definition: application.h:61
An identifier for simulation events.
Definition: event-id.h:54
an address for a packet socket
static TypeId GetTypeId(void)
Get the type ID.
uint32_t m_sent
Counter for sent packets.
virtual void DoDispose(void)
Destructor implementation.
uint8_t GetPriority(void) const
Query the priority value of this socket.
Ptr< Socket > m_socket
Socket.
virtual void StartApplication(void)
Application specific startup code.
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.
virtual void StopApplication(void)
Application specific shutdown code.
void Send(void)
Send a packet.
bool m_peerAddressSet
Sanity check.
TracedCallback< Ptr< const Packet >, const Address & > m_txTrace
Traced Callback: sent packets, source address.
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.
PacketSocketAddress m_peerAddress
Remote peer address.
Time m_interval
Packet inter-send time.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.