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

(-)a/src/node/socket.cc (+30 lines)
 Lines 78-83   Socket::SetRecvCallback (Callback<void, Link Here 
78
  m_receivedData = receivedData;
78
  m_receivedData = receivedData;
79
}
79
}
80
80
81
int Socket::Send (const uint8_t* buf, uint32_t size)
82
{
83
  NS_LOG_FUNCTION;
84
  Ptr<Packet> p;
85
  if(buf)
86
  {
87
    p = Create<Packet>(buf, size);
88
  }
89
  else
90
  {
91
    p = Create<Packet>(size);
92
  }
93
  return Send(p);
94
}
95
96
int Socket::SendTo (const Address &address, const uint8_t* buf, uint32_t size)
97
{
98
  NS_LOG_FUNCTION;
99
  Ptr<Packet> p;
100
  if(buf)
101
  {
102
    p = Create<Packet>(buf, size);
103
  }
104
  else
105
  {
106
    p = Create<Packet>(size);
107
  }
108
  return SendTo(address,p);
109
}
110
81
void 
111
void 
82
Socket::NotifyCloseCompleted (void)
112
Socket::NotifyCloseCompleted (void)
83
{
113
{
(-)a/src/node/socket.h (+25 lines)
 Lines 177-182   public: Link Here 
177
  virtual int Send (Ptr<Packet> p) = 0;
177
  virtual int Send (Ptr<Packet> p) = 0;
178
  
178
  
179
  /**
179
  /**
180
   * \brief Send data (or dummy data) to the remote host
181
   * \param buf A pointer to a raw byte buffer of some data to send.  If this 
182
   * is 0, we send dummy data whose size is specified by the second parameter
183
   * \param size the number of bytes to copy from the buffer
184
   * 
185
   * This is provided so as to have an API which is closer in appearance 
186
   * to that of real network or BSD sockets.  
187
   */
188
  int Send (const uint8_t* buf, uint32_t size);
189
  
190
  /**
180
   * \brief Send data to a specified peer.
191
   * \brief Send data to a specified peer.
181
   * \param address IP Address of remote host
192
   * \param address IP Address of remote host
182
   * \param p packet to send
193
   * \param p packet to send
 Lines 184-189   public: Link Here 
184
   *          internal buffer and accepted for transmission.
195
   *          internal buffer and accepted for transmission.
185
   */
196
   */
186
  virtual int SendTo(const Address &address,Ptr<Packet> p) = 0;
197
  virtual int SendTo(const Address &address,Ptr<Packet> p) = 0;
198
199
  /**
200
   * \brief Send data to a specified peer.
201
   * \param address IP Address of remote host
202
   * \param buf A pointer to a raw byte buffer of some data to send.  If this 
203
   * is 0, we send dummy data whose size is specified by the third parameter
204
   * \param size the number of bytes to copy from the buffer
205
   * \returns -1 in case of error or the number of bytes copied in the 
206
   *          internal buffer and accepted for transmission.
207
   *
208
   * This is provided so as to have an API which is closer in appearance 
209
   * to that of real network or BSD sockets.
210
   */
211
  int SendTo(const Address &address, const uint8_t* buf, uint32_t size);
187
212
188
protected:
213
protected:
189
  void NotifyCloseCompleted (void);
214
  void NotifyCloseCompleted (void);

Return to bug 117