View | Details | Raw Unified | Return to bug 2443
Collapse All | Expand All

(-)a/src/applications/model/bulk-send-application.cc (-4 / +9 lines)
 Lines 59-65    Link Here 
59
                   "that there is no limit.",
59
                   "that there is no limit.",
60
                   UintegerValue (0),
60
                   UintegerValue (0),
61
                   MakeUintegerAccessor (&BulkSendApplication::m_maxBytes),
61
                   MakeUintegerAccessor (&BulkSendApplication::m_maxBytes),
62
                   MakeUintegerChecker<uint32_t> ())
62
                   MakeUintegerChecker<uint64_t> ())
63
    .AddAttribute ("Protocol", "The type of protocol to use.",
63
    .AddAttribute ("Protocol", "The type of protocol to use.",
64
                   TypeIdValue (TcpSocketFactory::GetTypeId ()),
64
                   TypeIdValue (TcpSocketFactory::GetTypeId ()),
65
                   MakeTypeIdAccessor (&BulkSendApplication::m_tid),
65
                   MakeTypeIdAccessor (&BulkSendApplication::m_tid),
 Lines 86-92    Link Here 
86
}
86
}
87
87
88
void
88
void
89
BulkSendApplication::SetMaxBytes (uint32_t maxBytes)
89
BulkSendApplication::SetMaxBytes (uint64_t maxBytes)
90
{
90
{
91
  NS_LOG_FUNCTION (this << maxBytes);
91
  NS_LOG_FUNCTION (this << maxBytes);
92
  m_maxBytes = maxBytes;
92
  m_maxBytes = maxBytes;
 Lines 175-186    Link Here 
175
175
176
  while (m_maxBytes == 0 || m_totBytes < m_maxBytes)
176
  while (m_maxBytes == 0 || m_totBytes < m_maxBytes)
177
    { // Time to send more
177
    { // Time to send more
178
      uint32_t toSend = m_sendSize;
178
179
      // uint64_t to allow the comparison later.
180
      // the result is in a uint32_t range anyway, because
181
      // m_sendSize is uint32_t.
182
      uint64_t toSend = m_sendSize;
179
      // Make sure we don't send too many
183
      // Make sure we don't send too many
180
      if (m_maxBytes > 0)
184
      if (m_maxBytes > 0)
181
        {
185
        {
182
          toSend = std::min (m_sendSize, m_maxBytes - m_totBytes);
186
          toSend = std::min (toSend, m_maxBytes - m_totBytes);
183
        }
187
        }
188
184
      NS_LOG_LOGIC ("sending packet at " << Simulator::Now ());
189
      NS_LOG_LOGIC ("sending packet at " << Simulator::Now ());
185
      Ptr<Packet> packet = Create<Packet> (toSend);
190
      Ptr<Packet> packet = Create<Packet> (toSend);
186
      m_txTrace (packet);
191
      m_txTrace (packet);
(-)a/src/applications/model/bulk-send-application.h (-3 / +3 lines)
 Lines 91-97    Link Here 
91
   *
91
   *
92
   * \param maxBytes the upper bound of bytes to send
92
   * \param maxBytes the upper bound of bytes to send
93
   */
93
   */
94
  void SetMaxBytes (uint32_t maxBytes);
94
  void SetMaxBytes (uint64_t maxBytes);
95
95
96
  /**
96
  /**
97
   * \brief Get the socket this application is attached to.
97
   * \brief Get the socket this application is attached to.
 Lines 115-122    Link Here 
115
  Address         m_peer;         //!< Peer address
115
  Address         m_peer;         //!< Peer address
116
  bool            m_connected;    //!< True if connected
116
  bool            m_connected;    //!< True if connected
117
  uint32_t        m_sendSize;     //!< Size of data to send each time
117
  uint32_t        m_sendSize;     //!< Size of data to send each time
118
  uint32_t        m_maxBytes;     //!< Limit total number of bytes sent
118
  uint64_t        m_maxBytes;     //!< Limit total number of bytes sent
119
  uint32_t        m_totBytes;     //!< Total bytes sent so far
119
  uint64_t        m_totBytes;     //!< Total bytes sent so far
120
  TypeId          m_tid;          //!< The type of protocol to use.
120
  TypeId          m_tid;          //!< The type of protocol to use.
121
121
122
  /// Traced Callback: sent packets
122
  /// Traced Callback: sent packets
(-)a/src/applications/model/onoff-application.cc (-2 / +2 lines)
 Lines 81-87    Link Here 
81
                   "that there is no limit.",
81
                   "that there is no limit.",
82
                   UintegerValue (0),
82
                   UintegerValue (0),
83
                   MakeUintegerAccessor (&OnOffApplication::m_maxBytes),
83
                   MakeUintegerAccessor (&OnOffApplication::m_maxBytes),
84
                   MakeUintegerChecker<uint32_t> ())
84
                   MakeUintegerChecker<uint64_t> ())
85
    .AddAttribute ("Protocol", "The type of protocol to use.",
85
    .AddAttribute ("Protocol", "The type of protocol to use.",
86
                   TypeIdValue (UdpSocketFactory::GetTypeId ()),
86
                   TypeIdValue (UdpSocketFactory::GetTypeId ()),
87
                   MakeTypeIdAccessor (&OnOffApplication::m_tid),
87
                   MakeTypeIdAccessor (&OnOffApplication::m_tid),
 Lines 110-116    Link Here 
110
}
110
}
111
111
112
void 
112
void 
113
OnOffApplication::SetMaxBytes (uint32_t maxBytes)
113
OnOffApplication::SetMaxBytes (uint64_t maxBytes)
114
{
114
{
115
  NS_LOG_FUNCTION (this << maxBytes);
115
  NS_LOG_FUNCTION (this << maxBytes);
116
  m_maxBytes = maxBytes;
116
  m_maxBytes = maxBytes;
(-)a/src/applications/model/onoff-application.h (-3 / +3 lines)
 Lines 104-110    Link Here 
104
   *
104
   *
105
   * \param maxBytes the total number of bytes to send
105
   * \param maxBytes the total number of bytes to send
106
   */
106
   */
107
  void SetMaxBytes (uint32_t maxBytes);
107
  void SetMaxBytes (uint64_t maxBytes);
108
108
109
  /**
109
  /**
110
   * \brief Return a pointer to associated socket.
110
   * \brief Return a pointer to associated socket.
 Lines 158-165    Link Here 
158
  uint32_t        m_pktSize;      //!< Size of packets
158
  uint32_t        m_pktSize;      //!< Size of packets
159
  uint32_t        m_residualBits; //!< Number of generated, but not sent, bits
159
  uint32_t        m_residualBits; //!< Number of generated, but not sent, bits
160
  Time            m_lastStartTime; //!< Time last packet sent
160
  Time            m_lastStartTime; //!< Time last packet sent
161
  uint32_t        m_maxBytes;     //!< Limit total number of bytes sent
161
  uint64_t        m_maxBytes;     //!< Limit total number of bytes sent
162
  uint32_t        m_totBytes;     //!< Total bytes sent so far
162
  uint64_t        m_totBytes;     //!< Total bytes sent so far
163
  EventId         m_startStopEvent;     //!< Event id for next start or stop event
163
  EventId         m_startStopEvent;     //!< Event id for next start or stop event
164
  EventId         m_sendEvent;    //!< Event id of pending "send packet" event
164
  EventId         m_sendEvent;    //!< Event id of pending "send packet" event
165
  TypeId          m_tid;          //!< Type of the socket used
165
  TypeId          m_tid;          //!< Type of the socket used
(-)a/src/applications/model/packet-sink.cc (-1 / +1 lines)
 Lines 75-81    Link Here 
75
  NS_LOG_FUNCTION (this);
75
  NS_LOG_FUNCTION (this);
76
}
76
}
77
77
78
uint32_t PacketSink::GetTotalRx () const
78
uint64_t PacketSink::GetTotalRx () const
79
{
79
{
80
  NS_LOG_FUNCTION (this);
80
  NS_LOG_FUNCTION (this);
81
  return m_totalRx;
81
  return m_totalRx;
(-)a/src/applications/model/packet-sink.h (-2 / +2 lines)
 Lines 80-86    Link Here 
80
  /**
80
  /**
81
   * \return the total bytes received in this sink app
81
   * \return the total bytes received in this sink app
82
   */
82
   */
83
  uint32_t GetTotalRx () const;
83
  uint64_t GetTotalRx () const;
84
84
85
  /**
85
  /**
86
   * \return pointer to listening socket
86
   * \return pointer to listening socket
 Lines 127-133    Link Here 
127
  std::list<Ptr<Socket> > m_socketList; //!< the accepted sockets
127
  std::list<Ptr<Socket> > m_socketList; //!< the accepted sockets
128
128
129
  Address         m_local;        //!< Local address to bind to
129
  Address         m_local;        //!< Local address to bind to
130
  uint32_t        m_totalRx;      //!< Total bytes received
130
  uint64_t        m_totalRx;      //!< Total bytes received
131
  TypeId          m_tid;          //!< Protocol TypeId
131
  TypeId          m_tid;          //!< Protocol TypeId
132
132
133
  /// Traced Callback: received packets, source address.
133
  /// Traced Callback: received packets, source address.
(-)a/src/applications/model/udp-server.cc (-1 / +1 lines)
 Lines 96-102    Link Here 
96
  return m_lossCounter.GetLost ();
96
  return m_lossCounter.GetLost ();
97
}
97
}
98
98
99
uint32_t
99
uint64_t
100
UdpServer::GetReceived (void) const
100
UdpServer::GetReceived (void) const
101
{
101
{
102
  NS_LOG_FUNCTION (this);
102
  NS_LOG_FUNCTION (this);
(-)a/src/applications/model/udp-server.h (-2 / +2 lines)
 Lines 63-69    Link Here 
63
   * \brief Returns the number of received packets
63
   * \brief Returns the number of received packets
64
   * \return the number of received packets
64
   * \return the number of received packets
65
   */
65
   */
66
  uint32_t GetReceived (void) const;
66
  uint64_t GetReceived (void) const;
67
67
68
  /**
68
  /**
69
   * \brief Returns the size of the window used for checking loss.
69
   * \brief Returns the size of the window used for checking loss.
 Lines 98-104    Link Here 
98
  uint16_t m_port; //!< Port on which we listen for incoming packets.
98
  uint16_t m_port; //!< Port on which we listen for incoming packets.
99
  Ptr<Socket> m_socket; //!< IPv4 Socket
99
  Ptr<Socket> m_socket; //!< IPv4 Socket
100
  Ptr<Socket> m_socket6; //!< IPv6 Socket
100
  Ptr<Socket> m_socket6; //!< IPv6 Socket
101
  uint32_t m_received; //!< Number of received packets
101
  uint64_t m_received; //!< Number of received packets
102
  PacketLossCounter m_lossCounter; //!< Lost packet counter
102
  PacketLossCounter m_lossCounter; //!< Lost packet counter
103
};
103
};
104
104

Return to bug 2443