src/applications/onoff/onoff-application.h
author Tom Henderson <tomh@tomh.org>
Thu, 12 Mar 2009 15:55:40 -0400
changeset 4262 170eff4aba90
parent 3535 016c70fa60d8
child 6447 21219d90245e
permissions -rw-r--r--
set OnOffApplication::m_lastStartTime correctly (bug #490)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
//
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
// Copyright (c) 2006 Georgia Tech Research Corporation
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
//
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
// This program is free software; you can redistribute it and/or modify
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
// it under the terms of the GNU General Public License version 2 as
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
// published by the Free Software Foundation;
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
//
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
// This program is distributed in the hope that it will be useful,
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
// GNU General Public License for more details.
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
//
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
// You should have received a copy of the GNU General Public License
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
// along with this program; if not, write to the Free Software
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
//
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
// Author: George F. Riley<riley@ece.gatech.edu>
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
//
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
// ns3 - On/Off Data Source Application class
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    22
// George F. Riley, Georgia Tech, Spring 2007
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    23
// Adapted from ApplicationOnOff in GTNetS.
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    24
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
#ifndef __onoff_application_h__
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
#define __onoff_application_h__
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    27
2525
50e66705ed7b add missing include
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2503
diff changeset
    28
#include "ns3/address.h"
585
a009b03b720a remove ApplicationList. Move functionality to Node class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 568
diff changeset
    29
#include "ns3/application.h"
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    30
#include "ns3/event-id.h"
543
a730800a31d5 Node* -> Ptr<Node>
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    31
#include "ns3/ptr.h"
1291
c142db083c11 add missing include
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1162
diff changeset
    32
#include "ns3/data-rate.h"
2383
a0e0ec096169 bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2253
diff changeset
    33
#include "ns3/random-variable.h"
2494
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2402
diff changeset
    34
#include "ns3/traced-callback.h"
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    35
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    36
namespace ns3 {
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    37
1162
10f9613bd9be convert Socket to use Address class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 728
diff changeset
    38
class Address;
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
class RandomVariable;
453
ddbb935800d8 remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 384
diff changeset
    40
class Socket;
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    41
613
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    42
/**
3264
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    43
 * \ingroup applications 
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    44
 * \defgroup onoff OnOffApplication
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    45
 *
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    46
 * This traffic generator follows an On/Off pattern: after 
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    47
 * Application::StartApplication
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    48
 * is called, "On" and "Off" states alternate. The duration of each of
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    49
 * these states is determined with the onTime and the offTime random
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    50
 * variables. During the "Off" state, no traffic is generated.
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    51
 * During the "On" state, cbr traffic is generated. This cbr traffic is
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    52
 * characterized by the specified "data rate" and "packet size".
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    53
 */
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    54
 /**
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    55
 * \ingroup onoff
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    56
 *
613
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    57
 * \brief Generate traffic to a single destination according to an
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    58
 *        OnOff pattern.
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    59
 *
3264
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    60
 * This traffic generator follows an On/Off pattern: after 
7824a11c07fa doxygen for applications
Tom Henderson <tomh@tomh.org>
parents: 2525
diff changeset
    61
 * Application::StartApplication
617
b6a5451dc26b more dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 616
diff changeset
    62
 * is called, "On" and "Off" states alternate. The duration of each of
b6a5451dc26b more dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 616
diff changeset
    63
 * these states is determined with the onTime and the offTime random
b6a5451dc26b more dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 616
diff changeset
    64
 * variables. During the "Off" state, no traffic is generated.
b6a5451dc26b more dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 616
diff changeset
    65
 * During the "On" state, cbr traffic is generated. This cbr traffic is
b6a5451dc26b more dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 616
diff changeset
    66
 * characterized by the specified "data rate" and "packet size".
4262
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    67
 *
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    68
 * Note:  When an application is started, the first packet transmission
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    69
 * occurs _after_ a delay equal to (packet size/bit rate).  Note also,
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    70
 * when an application transitions into an off state in between packet
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    71
 * transmissions, the remaining time until when the next transmission
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    72
 * would have occurred is cached and is used when the application starts
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    73
 * up again.  Example:  packet size = 1000 bits, bit rate = 500 bits/sec.
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    74
 * If the application is started at time 3 seconds, the first packet
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    75
 * transmission will be scheduled for time 5 seconds (3 + 1000/500)
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    76
 * and subsequent transmissions at 2 second intervals.  If the above
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    77
 * application were instead stopped at time 4 seconds, and restarted at
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    78
 * time 5.5 seconds, then the first packet would be sent at time 6.5 seconds,
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    79
 * because when it was stopped at 4 seconds, there was only 1 second remaining
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    80
 * until the originally scheduled transmission, and this time remaining
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    81
 * information is cached and used to schedule the next transmission
170eff4aba90 set OnOffApplication::m_lastStartTime correctly (bug #490)
Tom Henderson <tomh@tomh.org>
parents: 3535
diff changeset
    82
 * upon restarting.
613
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    83
 */
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    84
class OnOffApplication : public Application 
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    85
{
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    86
public:
2494
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2402
diff changeset
    87
  static TypeId GetTypeId (void);
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    88
2494
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2402
diff changeset
    89
  OnOffApplication ();
613
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    90
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
    91
  virtual ~OnOffApplication();
609
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    92
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    93
  void SetMaxBytes(uint32_t maxBytes);
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    94
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    95
protected:
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    96
  virtual void DoDispose (void);
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    97
private:
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    98
  // inherited from Application base class.
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    99
  virtual void StartApplication (void);    // Called at time specified by Start
9baaee630644 remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   100
  virtual void StopApplication (void);     // Called at time specified by Stop
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   101
3535
016c70fa60d8 Refactor OnOff so Start doesn't immediate close the socket (bug 259)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3264
diff changeset
   102
  //helpers
016c70fa60d8 Refactor OnOff so Start doesn't immediate close the socket (bug 259)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3264
diff changeset
   103
  void CancelEvents ();
016c70fa60d8 Refactor OnOff so Start doesn't immediate close the socket (bug 259)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3264
diff changeset
   104
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   105
  void Construct (Ptr<Node> n,
1162
10f9613bd9be convert Socket to use Address class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 728
diff changeset
   106
                  const Address &remote,
2252
80595448707a iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2182
diff changeset
   107
                  std::string tid,
613
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
   108
                  const RandomVariable& ontime,
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
   109
                  const RandomVariable& offtime,
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
   110
                  uint32_t size);
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
   111
9679a238439d add dox doc and DefaultValue support to OnOffApplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 611
diff changeset
   112
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   113
  // Event handlers
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   114
  void StartSending();
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   115
  void StopSending();
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   116
  void SendPacket();
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   117
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 543
diff changeset
   118
  Ptr<Socket>     m_socket;       // Associated socket
1162
10f9613bd9be convert Socket to use Address class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 728
diff changeset
   119
  Address         m_peer;         // Peer address
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   120
  bool            m_connected;    // True if connected
2494
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2402
diff changeset
   121
  RandomVariable  m_onTime;       // rng for On Time
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2402
diff changeset
   122
  RandomVariable  m_offTime;      // rng for Off Time
382
26528ff50d38 Switch over simple-p2p.cc to use OnOffApplication
Tom Henderson <tomh@tomh.org>
parents: 359
diff changeset
   123
  DataRate        m_cbrRate;      // Rate that data is generated
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   124
  uint32_t        m_pktSize;      // Size of packets
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   125
  uint32_t        m_residualBits; // Number of generated, but not sent, bits
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   126
  Time            m_lastStartTime;// Time last packet sent
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   127
  uint32_t        m_maxBytes;     // Limit total number of bytes sent
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   128
  uint32_t        m_totBytes;     // Total bytes sent so far
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   129
  EventId         m_startStopEvent;     // Event id for next start or stop event
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   130
  EventId         m_sendEvent;    // Eventid of pending "send packet" event
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   131
  bool            m_sending;      // True if currently in sending state
2494
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2402
diff changeset
   132
  TypeId          m_tid;
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2402
diff changeset
   133
  TracedCallback<Ptr<const Packet> > m_txTrace;
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   134
  
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   135
private:
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   136
  void ScheduleNextTx();
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   137
  void ScheduleStartEvent();
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   138
  void ScheduleStopEvent();
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 543
diff changeset
   139
  void ConnectionSucceeded(Ptr<Socket>);
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 543
diff changeset
   140
  void ConnectionFailed(Ptr<Socket>);
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 543
diff changeset
   141
  void Ignore(Ptr<Socket>);
349
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   142
};
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   143
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   144
} // namespace ns3
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   145
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   146
#endif
3c91100689d7 Add base class IPAddr; L4Protocol; Protocol; OnOff Application, and base class Socket
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   147