A Discrete-Event Network Simulator
API
bulk-send-application.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 Georgia Institute of Technology
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: George F. Riley <riley@ece.gatech.edu>
18 */
19
20#ifndef BULK_SEND_APPLICATION_H
21#define BULK_SEND_APPLICATION_H
22
23#include "ns3/address.h"
24#include "ns3/application.h"
25#include "ns3/event-id.h"
26#include "ns3/ptr.h"
27#include "ns3/seq-ts-size-header.h"
28#include "ns3/traced-callback.h"
29
30namespace ns3
31{
32
33class Address;
34class Socket;
35
76{
77 public:
82 static TypeId GetTypeId();
83
85
86 ~BulkSendApplication() override;
87
101 void SetMaxBytes(uint64_t maxBytes);
102
107 Ptr<Socket> GetSocket() const;
108
109 protected:
110 void DoDispose() override;
111
112 private:
113 // inherited from Application base class.
114 void StartApplication() override; // Called at time specified by Start
115 void StopApplication() override; // Called at time specified by Stop
116
122 void SendData(const Address& from, const Address& to);
123
129 uint64_t m_maxBytes;
130 uint64_t m_totBytes;
135
138
143
144 private:
149 void ConnectionSucceeded(Ptr<Socket> socket);
154 void ConnectionFailed(Ptr<Socket> socket);
163 void DataSend(Ptr<Socket> socket, uint32_t unused);
164};
165
166} // namespace ns3
167
168#endif /* BULK_SEND_APPLICATION_H */
a polymophic address class
Definition: address.h:100
The base class for all ns3 applications.
Definition: application.h:61
Send as much traffic as possible, trying to fill the bandwidth.
bool m_enableSeqTsSizeHeader
Enable or disable the SeqTsSizeHeader.
void SendData(const Address &from, const Address &to)
Send data until the L4 transmission buffer is full.
Ptr< Packet > m_unsentPacket
Variable to cache unsent packet.
void DoDispose() override
Destructor implementation.
void ConnectionSucceeded(Ptr< Socket > socket)
Connection Succeeded (called by Socket through a callback)
static TypeId GetTypeId()
Get the type ID.
bool m_connected
True if connected.
uint32_t m_sendSize
Size of data to send each time.
TracedCallback< Ptr< const Packet > > m_txTrace
Traced Callback: sent packets.
Ptr< Socket > GetSocket() const
Get the socket this application is attached to.
void ConnectionFailed(Ptr< Socket > socket)
Connection Failed (called by Socket through a callback)
uint64_t m_maxBytes
Limit total number of bytes sent.
TypeId m_tid
The type of protocol to use.
void StartApplication() override
Application specific startup code.
uint64_t m_totBytes
Total bytes sent so far.
Ptr< Socket > m_socket
Associated socket.
Address m_local
Local address to bind to.
void DataSend(Ptr< Socket > socket, uint32_t unused)
Send more data as soon as some has been transmitted.
void StopApplication() override
Application specific shutdown code.
void SetMaxBytes(uint64_t maxBytes)
Set the upper bound for the total number of bytes to send.
TracedCallback< Ptr< const Packet >, const Address &, const Address &, const SeqTsSizeHeader & > m_txTraceWithSeqTsSize
Callback for tracing the packet Tx events, includes source, destination, the packet sent,...
Header with a sequence, a timestamp, and a "size" attribute.
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.