7#include "traffic-generator-ftp-single.h"
9#include "ns3/address.h"
12#include "ns3/nstime.h"
13#include "ns3/packet.h"
14#include "ns3/simulator.h"
15#include "ns3/socket-factory.h"
16#include "ns3/socket.h"
17#include "ns3/tcp-socket-factory.h"
18#include "ns3/trace-source-accessor.h"
19#include "ns3/udp-socket-factory.h"
20#include "ns3/uinteger.h"
25NS_LOG_COMPONENT_DEFINE(
"TrafficGeneratorFtpSingle");
26NS_OBJECT_ENSURE_REGISTERED(TrafficGeneratorFtpSingle);
32 TypeId(
"ns3::TrafficGeneratorFtpSingle")
34 .SetGroupName(
"Applications")
36 .AddAttribute(
"FileSize",
37 "The total number of bytes to send. The value zero means "
38 "that there is no limit.",
41 MakeUintegerChecker<uint32_t>())
42 .AddAttribute(
"PacketSize",
43 "The number of bytes to write per socket send",
46 MakeUintegerChecker<uint32_t>(1))
47 .AddAttribute(
"Remote",
48 "The address of the destination",
52 .AddAttribute(
"Protocol",
53 "The type of protocol to use.",
54 TypeIdValue(TcpSocketFactory::GetTypeId()),
58 "A new packet is created and is sent",
59 MakeTraceSourceAccessor(&TrafficGenerator::m_txTrace),
60 "ns3::TrafficGenerator::TxTracedCallback");
64TrafficGeneratorFtpSingle::TrafficGeneratorFtpSingle()
67 NS_LOG_FUNCTION(
this);
70TrafficGeneratorFtpSingle::~TrafficGeneratorFtpSingle()
72 NS_LOG_FUNCTION(
this);
78 m_packetSize = sendSize;
84 NS_LOG_FUNCTION(
this << fileSize);
85 m_fileSize = fileSize;
89TrafficGeneratorFtpSingle::GenerateNextPacketBurstSize()
91 NS_LOG_FUNCTION(
this);
92 SetPacketBurstSizeInBytes(m_fileSize);
96TrafficGeneratorFtpSingle::GetNextPacketSize()
const
98 NS_LOG_FUNCTION(
this);
103TrafficGeneratorFtpSingle::DoDispose()
105 NS_LOG_FUNCTION(
this);
107 TrafficGenerator::DoDispose();
111TrafficGeneratorFtpSingle::DoInitialize()
113 NS_LOG_FUNCTION(
this);
115 TrafficGenerator::DoInitialize();
void SetFileSize(uint32_t fileSize)
Set the file size to try to transfer.
int64_t AssignStreams(int64_t stream) override
void SetPacketSize(uint32_t packetSize)
Sets the packet size.
static TypeId GetTypeId()
Get the type ID.
void SetRemote(Address remote)
Sets the remote address.
void SetProtocol(TypeId protocol)
Sets the protocol.