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

(-)a/src/internet-node/tcp-socket.cc (-5 / +7 lines)
 Lines 752-762   bool TcpSocket::SendPendingData (bool wi Link Here 
752
      m_tcp->SendPacket (p, header,
752
      m_tcp->SendPacket (p, header,
753
                         m_endPoint->GetLocalAddress (),
753
                         m_endPoint->GetLocalAddress (),
754
                         m_defaultAddress);
754
                         m_defaultAddress);
755
      m_rtt->SentSeq(m_nextTxSequence, sz);           // notify the RTT
755
      m_rtt->SentSeq(m_nextTxSequence, sz);       // notify the RTT
756
      NotifyDataSent (p->GetSize () );                // notify the application
756
      // Notify the application
757
      nPacketsSent++;                                 // Count sent this loop
757
      Simulator::ScheduleNow(&TcpSocket::NotifyDataSent, this, p->GetSize ());
758
      m_nextTxSequence += sz;                         // Advance next tx sequence
758
      nPacketsSent++;                             // Count sent this loop
759
      m_highTxMark = std::max (m_nextTxSequence, m_highTxMark);// Note the high water mark
759
      m_nextTxSequence += sz;                     // Advance next tx sequence
760
      // Note the high water mark
761
      m_highTxMark = std::max (m_nextTxSequence, m_highTxMark);
760
    }
762
    }
761
  NS_LOG_LOGIC ("Sent "<<nPacketsSent<<" packets");
763
  NS_LOG_LOGIC ("Sent "<<nPacketsSent<<" packets");
762
  NS_LOG_LOGIC("RETURN SendPendingData");
764
  NS_LOG_LOGIC("RETURN SendPendingData");
(-)a/src/node/socket.cc (-2 / +20 lines)
 Lines 64-74   Socket::SetAcceptCallback ( Link Here 
64
  m_closeRequested = closeRequested;
64
  m_closeRequested = closeRequested;
65
}
65
}
66
66
67
void 
67
bool
68
Socket::SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent)
68
Socket::SetDataSentCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent)
69
{
69
{
70
  NS_LOG_FUNCTION;
70
  NS_LOG_FUNCTION;
71
  m_dataSent = dataSent;
71
  m_dataSent = dataSent;
72
  return true;
73
}
74
75
void 
76
Socket::SetSendCallback (Callback<void, Ptr<Socket> > sendCb)
77
{
78
  NS_LOG_FUNCTION;
79
  m_sendCb = sendCb;
72
}
80
}
73
81
74
void 
82
void 
 Lines 200-205   Socket::NotifyDataSent (uint32_t size) Link Here 
200
}
208
}
201
209
202
void 
210
void 
211
Socket::NotifySend (void)
212
{
213
  NS_LOG_FUNCTION;
214
  if (!m_sendCb.IsNull ())
215
    {
216
      m_sendCb (this);
217
    }
218
}
219
220
void 
203
Socket::NotifyDataReceived (Ptr<Packet> p, const Address &from)
221
Socket::NotifyDataReceived (Ptr<Packet> p, const Address &from)
204
{
222
{
205
  NS_LOG_FUNCTION;
223
  NS_LOG_FUNCTION;
(-)a/src/node/socket.h (-1 / +23 lines)
 Lines 120-126   public: Link Here 
120
                          Callback<void, Ptr<Socket>, 
120
                          Callback<void, Ptr<Socket>, 
121
                            const Address&> newConnectionCreated,
121
                            const Address&> newConnectionCreated,
122
                          Callback<void, Ptr<Socket> > closeRequested);
122
                          Callback<void, Ptr<Socket> > closeRequested);
123
  void SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent);
123
  /**
124
   * \brief Notify application when a packet has been sent from transport 
125
   *        protocol (non-standard socket call)
126
   * \param dataSent Callback for the event that data is sent from the
127
   *        underlying transport protocol.  This callback is passed a
128
   *        pointer to the socket, and the number of bytes sent.
129
   *        
130
   * \returns whether or not this socket supports this callback.  Note 
131
   *        that this is a non-standard socket call.  Some socket 
132
   *        implementations in ns-3 may not support this call, so the
133
   *        user should check this return value to confirm that the
134
   *        callback is supported.
135
   */
136
  virtual bool SetDataSentCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent);
137
  /**
138
   * \brief Notify application when a previously blocked socket (blocked
139
   *        for writing) has unblocked and has space available
140
   * \param sendCb Callback for the event that the socket becomes
141
   *        unblocked for sending
142
   */
143
  void SetSendCallback (Callback<void, Ptr<Socket> > sendCb);
124
  /**
144
  /**
125
   * \brief Receive data
145
   * \brief Receive data
126
   * \param receivedData Invoked whenever new data is received.
146
   * \param receivedData Invoked whenever new data is received.
 Lines 232-237   protected: Link Here 
232
  void NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from);
252
  void NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from);
233
  void NotifyCloseRequested (void);
253
  void NotifyCloseRequested (void);
234
  void NotifyDataSent (uint32_t size);
254
  void NotifyDataSent (uint32_t size);
255
  void NotifySend (void);
235
  void NotifyDataReceived (Ptr<Packet> p, const Address &from);
256
  void NotifyDataReceived (Ptr<Packet> p, const Address &from);
236
257
237
  Callback<void,Ptr<Socket> >    m_closeCompleted;
258
  Callback<void,Ptr<Socket> >    m_closeCompleted;
 Lines 242-247   protected: Link Here 
242
  Callback<bool, Ptr<Socket>, const Address &>   m_connectionRequest;
263
  Callback<bool, Ptr<Socket>, const Address &>   m_connectionRequest;
243
  Callback<void, Ptr<Socket>, const Address&>    m_newConnectionCreated;
264
  Callback<void, Ptr<Socket>, const Address&>    m_newConnectionCreated;
244
  Callback<void, Ptr<Socket>, uint32_t>          m_dataSent;
265
  Callback<void, Ptr<Socket>, uint32_t>          m_dataSent;
266
  Callback<void, Ptr<Socket> >   m_sendCb;
245
  Callback<void, Ptr<Socket>, Ptr<Packet>,const Address&> m_receivedData;
267
  Callback<void, Ptr<Socket>, Ptr<Packet>,const Address&> m_receivedData;
246
};
268
};
247
269

Return to bug 131