A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bulk-send-application.h
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 
51 {
52 public:
53  static TypeId GetTypeId (void);
54 
56 
57  virtual ~BulkSendApplication ();
58 
71  void SetMaxBytes (uint32_t maxBytes);
72 
76  Ptr<Socket> GetSocket (void) const;
77 
78 protected:
79  virtual void DoDispose (void);
80 private:
81  // inherited from Application base class.
82  virtual void StartApplication (void); // Called at time specified by Start
83  virtual void StopApplication (void); // Called at time specified by Stop
84 
85  void SendData ();
86 
87  Ptr<Socket> m_socket; // Associated socket
88  Address m_peer; // Peer address
89  bool m_connected; // True if connected
90  uint32_t m_sendSize; // Size of data to send each time
91  uint32_t m_maxBytes; // Limit total number of bytes sent
92  uint32_t m_totBytes; // Total bytes sent so far
93  TypeId m_tid;
95 
96 private:
97  void ConnectionSucceeded (Ptr<Socket> socket);
98  void ConnectionFailed (Ptr<Socket> socket);
99  void DataSend (Ptr<Socket>, uint32_t); // for socket's SetSendCallback
100  void Ignore (Ptr<Socket> socket);
101 };
102 
103 } // namespace ns3
104 
105 #endif /* BULK_SEND_APPLICATION_H */
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
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
virtual void StartApplication(void)
Application specific startup code.
void SetMaxBytes(uint32_t maxBytes)
Ptr< Socket > GetSocket(void) const
a unique identifier for an interface.
Definition: type-id.h:44