A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
udp-trace-client.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007,2008, 2009 INRIA, UDcast
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: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
18
* <amine.ismail@udcast.com>
19
*/
20
21
#ifndef UDP_TRACE_CLIENT_H
22
#define UDP_TRACE_CLIENT_H
23
24
#include "ns3/application.h"
25
#include "ns3/event-id.h"
26
#include "ns3/ipv4-address.h"
27
#include "ns3/ptr.h"
28
29
#include <vector>
30
31
namespace
ns3
32
{
33
34
class
Socket;
35
class
Packet;
36
63
class
UdpTraceClient
:
public
Application
64
{
65
public
:
70
static
TypeId
GetTypeId
();
71
72
UdpTraceClient
();
73
85
UdpTraceClient
(
Ipv4Address
ip, uint16_t
port
,
char
* traceFile);
86
~UdpTraceClient
()
override
;
87
93
void
SetRemote
(
Address
ip, uint16_t
port
);
98
void
SetRemote
(
Address
addr);
99
107
void
SetTraceFile
(std::string filename);
108
113
uint16_t
GetMaxPacketSize
();
114
119
void
SetMaxPacketSize
(uint16_t maxPacketSize);
120
125
void
SetTraceLoop
(
bool
traceLoop);
126
127
protected
:
128
void
DoDispose
()
override
;
129
130
private
:
135
void
LoadTrace
(std::string filename);
139
void
LoadDefaultTrace
();
140
void
StartApplication
()
override
;
141
void
StopApplication
()
override
;
142
146
void
Send
();
151
void
SendPacket
(uint32_t size);
152
158
struct
TraceEntry
159
{
160
uint32_t
timeToSend
;
161
uint32_t
packetSize
;
162
char
frameType
;
163
};
164
165
uint32_t
m_sent
;
166
Ptr<Socket>
m_socket
;
167
Address
m_peerAddress
;
168
uint16_t
m_peerPort
;
169
EventId
m_sendEvent
;
170
171
std::vector<TraceEntry>
m_entries
;
172
uint32_t
m_currentEntry
;
173
static
TraceEntry
g_defaultEntries
[];
174
uint16_t
m_maxPacketSize
;
175
bool
m_traceLoop
;
176
};
177
178
}
// namespace ns3
179
180
#endif
/* UDP_TRACE_CLIENT_H */
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:62
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:55
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:42
ns3::Ptr< Socket >
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::UdpTraceClient
A trace based streamer.
Definition:
udp-trace-client.h:64
ns3::UdpTraceClient::m_sendEvent
EventId m_sendEvent
Event to send the next packet.
Definition:
udp-trace-client.h:169
ns3::UdpTraceClient::StopApplication
void StopApplication() override
Application specific shutdown code.
Definition:
udp-trace-client.cc:306
ns3::UdpTraceClient::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
udp-trace-client.cc:65
ns3::UdpTraceClient::Send
void Send()
Send a packet.
Definition:
udp-trace-client.cc:357
ns3::UdpTraceClient::m_peerPort
uint16_t m_peerPort
Remote peer port.
Definition:
udp-trace-client.h:168
ns3::UdpTraceClient::SetTraceLoop
void SetTraceLoop(bool traceLoop)
Set the trace loop flag.
Definition:
udp-trace-client.cc:393
ns3::UdpTraceClient::m_sent
uint32_t m_sent
Counter for sent packets.
Definition:
udp-trace-client.h:165
ns3::UdpTraceClient::SetRemote
void SetRemote(Address ip, uint16_t port)
set the remote address and port
Definition:
udp-trace-client.cc:134
ns3::UdpTraceClient::m_peerAddress
Address m_peerAddress
Remote peer address.
Definition:
udp-trace-client.h:167
ns3::UdpTraceClient::m_entries
std::vector< TraceEntry > m_entries
Entries in the trace to send.
Definition:
udp-trace-client.h:171
ns3::UdpTraceClient::m_currentEntry
uint32_t m_currentEntry
Current entry index.
Definition:
udp-trace-client.h:172
ns3::UdpTraceClient::SetTraceFile
void SetTraceFile(std::string filename)
Set the trace file to be used by the application.
Definition:
udp-trace-client.cc:151
ns3::UdpTraceClient::LoadTrace
void LoadTrace(std::string filename)
Load a trace file.
Definition:
udp-trace-client.cc:186
ns3::UdpTraceClient::SetMaxPacketSize
void SetMaxPacketSize(uint16_t maxPacketSize)
Set the maximum packet size.
Definition:
udp-trace-client.cc:165
ns3::UdpTraceClient::StartApplication
void StartApplication() override
Application specific startup code.
Definition:
udp-trace-client.cc:253
ns3::UdpTraceClient::UdpTraceClient
UdpTraceClient()
Definition:
udp-trace-client.cc:102
ns3::UdpTraceClient::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
udp-trace-client.cc:179
ns3::UdpTraceClient::SendPacket
void SendPacket(uint32_t size)
Send a packet of a given size.
Definition:
udp-trace-client.cc:313
ns3::UdpTraceClient::m_traceLoop
bool m_traceLoop
Loop through the trace file.
Definition:
udp-trace-client.h:175
ns3::UdpTraceClient::m_maxPacketSize
uint16_t m_maxPacketSize
Maximum packet size to send (including the SeqTsHeader)
Definition:
udp-trace-client.h:174
ns3::UdpTraceClient::~UdpTraceClient
~UdpTraceClient() override
Definition:
udp-trace-client.cc:127
ns3::UdpTraceClient::g_defaultEntries
static TraceEntry g_defaultEntries[]
Default trace to send.
Definition:
udp-trace-client.h:173
ns3::UdpTraceClient::GetMaxPacketSize
uint16_t GetMaxPacketSize()
Return the maximum packet size.
Definition:
udp-trace-client.cc:172
ns3::UdpTraceClient::LoadDefaultTrace
void LoadDefaultTrace()
Load the default trace.
Definition:
udp-trace-client.cc:230
ns3::UdpTraceClient::m_socket
Ptr< Socket > m_socket
Socket.
Definition:
udp-trace-client.h:166
port
uint16_t port
Definition:
dsdv-manet.cc:44
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::UdpTraceClient::TraceEntry
Entry to send.
Definition:
udp-trace-client.h:159
ns3::UdpTraceClient::TraceEntry::timeToSend
uint32_t timeToSend
Time to send the frame.
Definition:
udp-trace-client.h:160
ns3::UdpTraceClient::TraceEntry::packetSize
uint32_t packetSize
Size of the frame.
Definition:
udp-trace-client.h:161
ns3::UdpTraceClient::TraceEntry::frameType
char frameType
Frame type (I, P or B)
Definition:
udp-trace-client.h:162
src
applications
model
udp-trace-client.h
Generated on Sun Mar 3 2024 17:10:54 for ns-3 by
1.9.1