A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bulk-send-application.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 Georgia Institute of Technology
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: George F. Riley <riley@ece.gatech.edu>
19  */
20 
21 #ifndef BULK_SEND_APPLICATION_H
22 #define BULK_SEND_APPLICATION_H
23 
24 #include "ns3/address.h"
25 #include "ns3/application.h"
26 #include "ns3/event-id.h"
27 #include "ns3/ptr.h"
28 #include "ns3/traced-callback.h"
29 
30 namespace ns3 {
31 
32 class Address;
33 class Socket;
34 
69 {
70 public:
75  static TypeId GetTypeId (void);
76 
78 
79  virtual ~BulkSendApplication ();
80 
94  void SetMaxBytes (uint32_t maxBytes);
95 
100  Ptr<Socket> GetSocket (void) const;
101 
102 protected:
103  virtual void DoDispose (void);
104 private:
105  // inherited from Application base class.
106  virtual void StartApplication (void); // Called at time specified by Start
107  virtual void StopApplication (void); // Called at time specified by Stop
108 
112  void SendData ();
113 
116  bool m_connected;
117  uint32_t m_sendSize;
118  uint32_t m_maxBytes;
119  uint32_t m_totBytes;
121 
124 
125 private:
130  void ConnectionSucceeded (Ptr<Socket> socket);
135  void ConnectionFailed (Ptr<Socket> socket);
139  void DataSend (Ptr<Socket>, uint32_t); // for socket's SetSendCallback
140 };
141 
142 } // namespace ns3
143 
144 #endif /* BULK_SEND_APPLICATION_H */
void SendData()
Send data until the L4 transmission buffer is full.
uint32_t m_totBytes
Total bytes sent so far.
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
void ConnectionFailed(Ptr< Socket > socket)
Connection Failed (called by Socket through a callback)
uint32_t m_maxBytes
Limit total number of bytes sent.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
a polymophic address class
Definition: address.h:86
virtual void StopApplication(void)
Application specific shutdown code.
The base class for all ns3 applications.
Definition: application.h:61
Send as much traffic as possible, trying to fill the bandwidth.
virtual void StartApplication(void)
Application specific startup code.
void SetMaxBytes(uint32_t maxBytes)
Set the upper bound for the total number of bytes to send.
void DataSend(Ptr< Socket >, uint32_t)
Send more data as soon as some has been transmitted.
TypeId m_tid
The type of protocol to use.
Ptr< Socket > m_socket
Associated socket.
void ConnectionSucceeded(Ptr< Socket > socket)
Connection Succeeded (called by Socket through a callback)
bool m_connected
True if connected.
Address m_peer
Peer address.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t m_sendSize
Size of data to send each time.
Ptr< Socket > GetSocket(void) const
Get the socket this application is attached to.
TracedCallback< Ptr< const Packet > > m_txTrace
Traced Callback: sent packets.
a unique identifier for an interface.
Definition: type-id.h:49