author | Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
Tue, 15 Jun 2010 18:29:45 +0100 | |
changeset 6357 | 2e15529e2402 |
parent 6319 | 2b1bbc8d0c58 |
permissions | -rw-r--r-- |
3578 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* This program is free software; you can redistribute it and/or modify |
|
4 |
* it under the terms of the GNU General Public License version 2 as |
|
5 |
* published by the Free Software Foundation; |
|
6 |
* |
|
7 |
* This program is distributed in the hope that it will be useful, |
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 |
* GNU General Public License for more details. |
|
11 |
* |
|
12 |
* You should have received a copy of the GNU General Public License |
|
13 |
* along with this program; if not, write to the Free Software |
|
14 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
15 |
* |
|
16 |
* based on tcp-socket-impl.cc, Author: Raj Bhattacharjea <raj.b@gatech.edu> |
|
17 |
* Author: Florian Westphal <fw@strlen.de> |
|
18 |
*/ |
|
19 |
||
5887 | 20 |
#define NS_LOG_APPEND_CONTEXT \ |
21 |
if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } |
|
22 |
||
3578 | 23 |
#include "ns3/node.h" |
24 |
#include "ns3/inet-socket-address.h" |
|
25 |
#include "ns3/log.h" |
|
26 |
#include "ns3/ipv4.h" |
|
27 |
#include "ipv4-end-point.h" |
|
28 |
#include "nsc-tcp-l4-protocol.h" |
|
29 |
#include "nsc-tcp-socket-impl.h" |
|
30 |
#include "ns3/simulation-singleton.h" |
|
31 |
#include "tcp-typedefs.h" |
|
32 |
#include "ns3/simulator.h" |
|
33 |
#include "ns3/packet.h" |
|
34 |
#include "ns3/uinteger.h" |
|
35 |
#include "ns3/trace-source-accessor.h" |
|
36 |
||
37 |
#include <algorithm> |
|
38 |
||
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
39 |
// for ntohs(). |
3578 | 40 |
#include <arpa/inet.h> |
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
41 |
#include <netinet/in.h> |
3578 | 42 |
|
3635
cddd59578812
compile nsc code unconditionally.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3589
diff
changeset
|
43 |
#include "sim_interface.h" |
cddd59578812
compile nsc code unconditionally.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3589
diff
changeset
|
44 |
#include "sim_errno.h" |
3578 | 45 |
|
46 |
NS_LOG_COMPONENT_DEFINE ("NscTcpSocketImpl"); |
|
47 |
||
48 |
using namespace std; |
|
49 |
||
50 |
namespace ns3 { |
|
51 |
||
52 |
NS_OBJECT_ENSURE_REGISTERED (NscTcpSocketImpl); |
|
53 |
||
54 |
TypeId |
|
55 |
NscTcpSocketImpl::GetTypeId () |
|
56 |
{ |
|
57 |
static TypeId tid = TypeId("ns3::NscTcpSocketImpl") |
|
58 |
.SetParent<TcpSocket> () |
|
59 |
.AddTraceSource ("CongestionWindow", |
|
60 |
"The TCP connection's congestion window", |
|
61 |
MakeTraceSourceAccessor (&NscTcpSocketImpl::m_cWnd)) |
|
62 |
; |
|
63 |
return tid; |
|
64 |
} |
|
65 |
||
66 |
NscTcpSocketImpl::NscTcpSocketImpl () |
|
67 |
: m_endPoint (0), |
|
68 |
m_node (0), |
|
69 |
m_tcp (0), |
|
3778
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
70 |
m_localAddress (Ipv4Address::GetZero ()), |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
71 |
m_localPort (0), |
3578 | 72 |
m_peerAddress ("0.0.0.0", 0), |
73 |
m_errno (ERROR_NOTERROR), |
|
74 |
m_shutdownSend (false), |
|
75 |
m_shutdownRecv (false), |
|
76 |
m_connected (false), |
|
77 |
m_state (CLOSED), |
|
78 |
m_closeOnEmpty (false), |
|
79 |
m_txBufferSize (0), |
|
80 |
m_lastMeasuredRtt (Seconds(0.0)) |
|
81 |
{ |
|
82 |
NS_LOG_FUNCTION (this); |
|
83 |
} |
|
84 |
||
85 |
NscTcpSocketImpl::NscTcpSocketImpl(const NscTcpSocketImpl& sock) |
|
86 |
: TcpSocket(sock), //copy the base class callbacks |
|
87 |
m_delAckMaxCount (sock.m_delAckMaxCount), |
|
88 |
m_delAckTimeout (sock.m_delAckTimeout), |
|
89 |
m_endPoint (0), |
|
90 |
m_node (sock.m_node), |
|
91 |
m_tcp (sock.m_tcp), |
|
92 |
m_remoteAddress (sock.m_remoteAddress), |
|
93 |
m_remotePort (sock.m_remotePort), |
|
94 |
m_localAddress (sock.m_localAddress), |
|
95 |
m_localPort (sock.m_localPort), |
|
96 |
m_peerAddress (sock.m_peerAddress), |
|
97 |
m_errno (sock.m_errno), |
|
98 |
m_shutdownSend (sock.m_shutdownSend), |
|
99 |
m_shutdownRecv (sock.m_shutdownRecv), |
|
100 |
m_connected (sock.m_connected), |
|
101 |
m_state (sock.m_state), |
|
102 |
m_closeOnEmpty (sock.m_closeOnEmpty), |
|
6319
2b1bbc8d0c58
bug 906: NSC TCP socket fork did not copy txbuffersize over
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5971
diff
changeset
|
103 |
m_txBufferSize (sock.m_txBufferSize), |
3578 | 104 |
m_segmentSize (sock.m_segmentSize), |
105 |
m_rxWindowSize (sock.m_rxWindowSize), |
|
106 |
m_advertisedWindowSize (sock.m_advertisedWindowSize), |
|
107 |
m_cWnd (sock.m_cWnd), |
|
108 |
m_ssThresh (sock.m_ssThresh), |
|
109 |
m_initialCWnd (sock.m_initialCWnd), |
|
110 |
m_lastMeasuredRtt (Seconds(0.0)), |
|
111 |
m_cnTimeout (sock.m_cnTimeout), |
|
112 |
m_cnCount (sock.m_cnCount), |
|
113 |
m_rxAvailable (0), |
|
114 |
m_nscTcpSocket (0), |
|
115 |
m_sndBufSize (sock.m_sndBufSize) |
|
116 |
{ |
|
117 |
NS_LOG_FUNCTION_NOARGS (); |
|
118 |
NS_LOG_LOGIC("Invoked the copy constructor"); |
|
119 |
//copy the pending data if necessary |
|
120 |
if(!sock.m_txBuffer.empty () ) |
|
121 |
{ |
|
122 |
m_txBuffer = sock.m_txBuffer; |
|
123 |
} |
|
124 |
//can't "copy" the endpoint just yes, must do this when we know the peer info |
|
125 |
//too; this is in SYN_ACK_TX |
|
126 |
} |
|
127 |
||
128 |
NscTcpSocketImpl::~NscTcpSocketImpl () |
|
129 |
{ |
|
130 |
NS_LOG_FUNCTION(this); |
|
131 |
m_node = 0; |
|
132 |
if (m_endPoint != 0) |
|
133 |
{ |
|
134 |
NS_ASSERT (m_tcp != 0); |
|
135 |
/** |
|
136 |
* Note that this piece of code is a bit tricky: |
|
137 |
* when DeAllocate is called, it will call into |
|
138 |
* Ipv4EndPointDemux::Deallocate which triggers |
|
139 |
* a delete of the associated endPoint which triggers |
|
140 |
* in turn a call to the method ::Destroy below |
|
141 |
* will will zero the m_endPoint field. |
|
142 |
*/ |
|
143 |
NS_ASSERT (m_endPoint != 0); |
|
144 |
m_tcp->DeAllocate (m_endPoint); |
|
145 |
NS_ASSERT (m_endPoint == 0); |
|
146 |
} |
|
147 |
m_tcp = 0; |
|
148 |
} |
|
149 |
||
150 |
void |
|
151 |
NscTcpSocketImpl::SetNode (Ptr<Node> node) |
|
152 |
{ |
|
153 |
m_node = node; |
|
154 |
// Initialize some variables |
|
155 |
m_cWnd = m_initialCWnd * m_segmentSize; |
|
156 |
m_rxWindowSize = m_advertisedWindowSize; |
|
157 |
} |
|
158 |
||
159 |
void |
|
160 |
NscTcpSocketImpl::SetTcp (Ptr<NscTcpL4Protocol> tcp) |
|
161 |
{ |
|
162 |
m_nscTcpSocket = tcp->m_nscStack->new_tcp_socket(); |
|
163 |
m_tcp = tcp; |
|
164 |
} |
|
165 |
||
166 |
||
167 |
enum Socket::SocketErrno |
|
168 |
NscTcpSocketImpl::GetErrno (void) const |
|
169 |
{ |
|
170 |
NS_LOG_FUNCTION_NOARGS (); |
|
171 |
return m_errno; |
|
172 |
} |
|
173 |
||
174 |
Ptr<Node> |
|
175 |
NscTcpSocketImpl::GetNode (void) const |
|
176 |
{ |
|
177 |
NS_LOG_FUNCTION_NOARGS (); |
|
178 |
return m_node; |
|
179 |
} |
|
180 |
||
181 |
void |
|
182 |
NscTcpSocketImpl::Destroy (void) |
|
183 |
{ |
|
184 |
NS_LOG_FUNCTION_NOARGS (); |
|
185 |
m_node = 0; |
|
186 |
m_endPoint = 0; |
|
187 |
m_tcp = 0; |
|
188 |
} |
|
189 |
int |
|
190 |
NscTcpSocketImpl::FinishBind (void) |
|
191 |
{ |
|
192 |
NS_LOG_FUNCTION_NOARGS (); |
|
193 |
if (m_endPoint == 0) |
|
194 |
{ |
|
195 |
return -1; |
|
196 |
} |
|
197 |
m_endPoint->SetRxCallback (MakeCallback (&NscTcpSocketImpl::ForwardUp, Ptr<NscTcpSocketImpl>(this))); |
|
198 |
m_endPoint->SetDestroyCallback (MakeCallback (&NscTcpSocketImpl::Destroy, Ptr<NscTcpSocketImpl>(this))); |
|
199 |
m_localAddress = m_endPoint->GetLocalAddress (); |
|
200 |
m_localPort = m_endPoint->GetLocalPort (); |
|
201 |
return 0; |
|
202 |
} |
|
203 |
||
204 |
int |
|
205 |
NscTcpSocketImpl::Bind (void) |
|
206 |
{ |
|
207 |
NS_LOG_FUNCTION_NOARGS (); |
|
208 |
m_endPoint = m_tcp->Allocate (); |
|
209 |
return FinishBind (); |
|
210 |
} |
|
211 |
int |
|
212 |
NscTcpSocketImpl::Bind (const Address &address) |
|
213 |
{ |
|
214 |
NS_LOG_FUNCTION (this<<address); |
|
215 |
if (!InetSocketAddress::IsMatchingType (address)) |
|
216 |
{ |
|
217 |
return ERROR_INVAL; |
|
218 |
} |
|
219 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
|
220 |
Ipv4Address ipv4 = transport.GetIpv4 (); |
|
221 |
uint16_t port = transport.GetPort (); |
|
222 |
if (ipv4 == Ipv4Address::GetAny () && port == 0) |
|
223 |
{ |
|
224 |
m_endPoint = m_tcp->Allocate (); |
|
5888 | 225 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 226 |
} |
227 |
else if (ipv4 == Ipv4Address::GetAny () && port != 0) |
|
228 |
{ |
|
229 |
m_endPoint = m_tcp->Allocate (port); |
|
5888 | 230 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 231 |
} |
232 |
else if (ipv4 != Ipv4Address::GetAny () && port == 0) |
|
233 |
{ |
|
234 |
m_endPoint = m_tcp->Allocate (ipv4); |
|
5888 | 235 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 236 |
} |
237 |
else if (ipv4 != Ipv4Address::GetAny () && port != 0) |
|
238 |
{ |
|
239 |
m_endPoint = m_tcp->Allocate (ipv4, port); |
|
5888 | 240 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 241 |
} |
242 |
||
243 |
m_localPort = port; |
|
244 |
return FinishBind (); |
|
245 |
} |
|
246 |
||
247 |
int |
|
248 |
NscTcpSocketImpl::ShutdownSend (void) |
|
249 |
{ |
|
250 |
NS_LOG_FUNCTION_NOARGS (); |
|
251 |
m_shutdownSend = true; |
|
252 |
return 0; |
|
253 |
} |
|
254 |
int |
|
255 |
NscTcpSocketImpl::ShutdownRecv (void) |
|
256 |
{ |
|
257 |
NS_LOG_FUNCTION_NOARGS (); |
|
4491
893d48fcf7f3
bug 535: UDP/TCP ShutdownRecv incorrect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3869
diff
changeset
|
258 |
m_shutdownRecv = true; |
3578 | 259 |
return 0; |
260 |
} |
|
261 |
||
262 |
int |
|
263 |
NscTcpSocketImpl::Close (void) |
|
264 |
{ |
|
265 |
NS_LOG_FUNCTION (this << m_state); |
|
266 |
||
267 |
if (m_state == CLOSED) |
|
268 |
{ |
|
269 |
return -1; |
|
270 |
} |
|
271 |
if (!m_txBuffer.empty ()) |
|
272 |
{ // App close with pending data must wait until all data transmitted |
|
273 |
m_closeOnEmpty = true; |
|
274 |
NS_LOG_LOGIC("Socket " << this << |
|
275 |
" deferring close, state " << m_state); |
|
276 |
return 0; |
|
277 |
} |
|
278 |
||
5888 | 279 |
NS_LOG_LOGIC("NscTcp socket " << this << " calling disconnect(); moving to CLOSED"); |
3578 | 280 |
m_nscTcpSocket->disconnect(); |
281 |
m_state = CLOSED; |
|
282 |
ShutdownSend (); |
|
283 |
return 0; |
|
284 |
} |
|
285 |
||
286 |
int |
|
287 |
NscTcpSocketImpl::Connect (const Address & address) |
|
288 |
{ |
|
289 |
NS_LOG_FUNCTION (this << address); |
|
290 |
if (m_endPoint == 0) |
|
291 |
{ |
|
292 |
if (Bind () == -1) |
|
293 |
{ |
|
294 |
NS_ASSERT (m_endPoint == 0); |
|
295 |
return -1; |
|
296 |
} |
|
297 |
NS_ASSERT (m_endPoint != 0); |
|
298 |
} |
|
299 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
|
300 |
m_remoteAddress = transport.GetIpv4 (); |
|
301 |
m_remotePort = transport.GetPort (); |
|
302 |
||
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
303 |
std::ostringstream ss; |
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
304 |
m_remoteAddress.Print(ss); |
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
305 |
std::string ipstring = ss.str (); |
3578 | 306 |
|
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
307 |
m_nscTcpSocket->connect(ipstring.c_str (), m_remotePort); |
3578 | 308 |
m_state = SYN_SENT; |
309 |
return 0; |
|
310 |
} |
|
311 |
||
312 |
int |
|
313 |
NscTcpSocketImpl::Send (const Ptr<Packet> p, uint32_t flags) |
|
314 |
{ |
|
315 |
NS_LOG_FUNCTION (this << p); |
|
316 |
||
317 |
NS_ASSERT (p->GetSize () > 0); |
|
318 |
if (m_state == ESTABLISHED || m_state == SYN_SENT || m_state == CLOSE_WAIT) |
|
319 |
{ |
|
320 |
if (p->GetSize () > GetTxAvailable ()) |
|
321 |
{ |
|
322 |
m_errno = ERROR_MSGSIZE; |
|
323 |
return -1; |
|
324 |
} |
|
325 |
||
3780
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
326 |
uint32_t sent = p->GetSize (); |
3578 | 327 |
if (m_state == ESTABLISHED) |
328 |
{ |
|
3780
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
329 |
m_txBuffer.push(p); |
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
330 |
m_txBufferSize += sent; |
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
331 |
SendPendingData(); |
3578 | 332 |
} |
333 |
else |
|
334 |
{ // SYN_SET -- Queue Data |
|
335 |
m_txBuffer.push(p); |
|
3780
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
336 |
m_txBufferSize += sent; |
3578 | 337 |
} |
3780
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
338 |
return sent; |
3578 | 339 |
} |
340 |
else |
|
341 |
{ |
|
342 |
m_errno = ERROR_NOTCONN; |
|
343 |
return -1; |
|
344 |
} |
|
345 |
} |
|
346 |
||
347 |
int |
|
348 |
NscTcpSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address) |
|
349 |
{ |
|
350 |
NS_LOG_FUNCTION (this << address << p); |
|
351 |
if (!m_connected) |
|
352 |
{ |
|
353 |
m_errno = ERROR_NOTCONN; |
|
354 |
return -1; |
|
355 |
} |
|
356 |
else |
|
357 |
{ |
|
358 |
return Send (p, flags); //drop the address according to BSD manpages |
|
359 |
} |
|
360 |
} |
|
361 |
||
362 |
uint32_t |
|
363 |
NscTcpSocketImpl::GetTxAvailable (void) const |
|
364 |
{ |
|
365 |
NS_LOG_FUNCTION_NOARGS (); |
|
366 |
if (m_txBufferSize != 0) |
|
367 |
{ |
|
368 |
NS_ASSERT (m_txBufferSize <= m_sndBufSize); |
|
369 |
return m_sndBufSize - m_txBufferSize; |
|
370 |
} |
|
371 |
else |
|
372 |
{ |
|
373 |
return m_sndBufSize; |
|
374 |
} |
|
375 |
} |
|
376 |
||
377 |
int |
|
3772
f0d8608ab155
Remove queue limit from listen
Craig Dowell <craigdo@ee.washington.edu>
parents:
3711
diff
changeset
|
378 |
NscTcpSocketImpl::Listen (void) |
3578 | 379 |
{ |
3772
f0d8608ab155
Remove queue limit from listen
Craig Dowell <craigdo@ee.washington.edu>
parents:
3711
diff
changeset
|
380 |
NS_LOG_FUNCTION (this); |
3578 | 381 |
m_nscTcpSocket->listen(m_localPort); |
382 |
m_state = LISTEN; |
|
383 |
return 0; |
|
384 |
} |
|
385 |
||
386 |
||
387 |
void |
|
388 |
NscTcpSocketImpl::NSCWakeup () |
|
389 |
{ |
|
390 |
switch (m_state) { |
|
391 |
case SYN_SENT: |
|
392 |
if (!m_nscTcpSocket->is_connected()) |
|
393 |
break; |
|
394 |
m_state = ESTABLISHED; |
|
395 |
Simulator::ScheduleNow(&NscTcpSocketImpl::ConnectionSucceeded, this); |
|
396 |
// fall through to schedule read/write events |
|
397 |
case ESTABLISHED: |
|
398 |
if (!m_txBuffer.empty ()) |
|
399 |
Simulator::ScheduleNow(&NscTcpSocketImpl::SendPendingData, this); |
|
400 |
Simulator::ScheduleNow(&NscTcpSocketImpl::ReadPendingData, this); |
|
401 |
break; |
|
402 |
case LISTEN: |
|
403 |
Simulator::ScheduleNow(&NscTcpSocketImpl::Accept, this); |
|
404 |
break; |
|
405 |
case CLOSED: break; |
|
406 |
default: |
|
407 |
NS_LOG_DEBUG (this << " invalid state: " << m_state); |
|
408 |
} |
|
409 |
} |
|
410 |
||
411 |
Ptr<Packet> |
|
412 |
NscTcpSocketImpl::Recv (uint32_t maxSize, uint32_t flags) |
|
413 |
{ |
|
414 |
NS_LOG_FUNCTION_NOARGS (); |
|
415 |
if (m_deliveryQueue.empty() ) |
|
416 |
{ |
|
3780
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
417 |
m_errno = ERROR_AGAIN; |
3578 | 418 |
return 0; |
419 |
} |
|
420 |
Ptr<Packet> p = m_deliveryQueue.front (); |
|
421 |
if (p->GetSize () <= maxSize) |
|
422 |
{ |
|
423 |
m_deliveryQueue.pop (); |
|
424 |
m_rxAvailable -= p->GetSize (); |
|
425 |
} |
|
426 |
else |
|
427 |
{ |
|
3780
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
428 |
m_errno = ERROR_AGAIN; |
3578 | 429 |
p = 0; |
430 |
} |
|
431 |
return p; |
|
432 |
} |
|
433 |
||
434 |
Ptr<Packet> |
|
435 |
NscTcpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags, |
|
436 |
Address &fromAddress) |
|
437 |
{ |
|
438 |
NS_LOG_FUNCTION (this << maxSize << flags); |
|
439 |
Ptr<Packet> packet = Recv (maxSize, flags); |
|
440 |
if (packet != 0) |
|
441 |
{ |
|
442 |
SocketAddressTag tag; |
|
443 |
bool found; |
|
4523
b8bdc36a3355
use packet tags rather than byte tags to match TcpSocketImpl and UdpSocketImpl
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4516
diff
changeset
|
444 |
found = packet->PeekPacketTag (tag); |
3578 | 445 |
NS_ASSERT (found); |
446 |
fromAddress = tag.GetAddress (); |
|
447 |
} |
|
448 |
return packet; |
|
449 |
} |
|
450 |
||
3778
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
451 |
int |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
452 |
NscTcpSocketImpl::GetSockName (Address &address) const |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
453 |
{ |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
454 |
NS_LOG_FUNCTION_NOARGS (); |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
455 |
address = InetSocketAddress(m_localAddress, m_localPort); |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
456 |
return 0; |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
457 |
} |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
458 |
|
3578 | 459 |
uint32_t |
460 |
NscTcpSocketImpl::GetRxAvailable (void) const |
|
461 |
{ |
|
462 |
NS_LOG_FUNCTION_NOARGS (); |
|
463 |
// We separately maintain this state to avoid walking the queue |
|
464 |
// every time this might be called |
|
465 |
return m_rxAvailable; |
|
466 |
} |
|
467 |
||
468 |
void |
|
5971
805783c866fc
Bug 748 - Cloned TCP socket uses wrong source address
Fabian Mauchle <f1mauchl@hsr.ch>
parents:
5889
diff
changeset
|
469 |
NscTcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t port) |
3578 | 470 |
{ |
471 |
NSCWakeup(); |
|
472 |
} |
|
473 |
||
474 |
void NscTcpSocketImpl::CompleteFork(void) |
|
475 |
{ |
|
476 |
// The address pairs (m_localAddress, m_localPort, m_remoteAddress, m_remotePort) |
|
477 |
// are bogus, but this isn't important at the moment, because |
|
478 |
// address <-> Socket handling is done by NSC internally. |
|
479 |
// We only need to add the new ns-3 socket to the list of sockets, so |
|
480 |
// we use plain Allocate() instead of Allocate(m_localAddress, ... ) |
|
3869
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
481 |
struct sockaddr_in sin; |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
482 |
size_t sin_len = sizeof(sin); |
3578 | 483 |
|
3869
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
484 |
if (0 == m_nscTcpSocket->getpeername((struct sockaddr*) &sin, &sin_len)) { |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
485 |
m_remotePort = ntohs(sin.sin_port); |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
486 |
m_remoteAddress = m_remoteAddress.Deserialize((const uint8_t*) &sin.sin_addr); |
3578 | 487 |
m_peerAddress = InetSocketAddress(m_remoteAddress, m_remotePort); |
488 |
} |
|
489 |
||
490 |
m_endPoint = m_tcp->Allocate (); |
|
491 |
||
492 |
//the cloned socket with be in listen state, so manually change state |
|
493 |
NS_ASSERT(m_state == LISTEN); |
|
494 |
m_state = ESTABLISHED; |
|
495 |
||
3869
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
496 |
sin_len = sizeof(sin); |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
497 |
|
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
498 |
if (0 == m_nscTcpSocket->getsockname((struct sockaddr *) &sin, &sin_len)) |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
499 |
m_localAddress = m_localAddress.Deserialize((const uint8_t*) &sin.sin_addr); |
3578 | 500 |
|
501 |
NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " accepted connection from " |
|
502 |
<< m_remoteAddress << ":" << m_remotePort |
|
503 |
<< " to " << m_localAddress << ":" << m_localPort); |
|
504 |
//equivalent to FinishBind |
|
505 |
m_endPoint->SetRxCallback (MakeCallback (&NscTcpSocketImpl::ForwardUp, Ptr<NscTcpSocketImpl>(this))); |
|
506 |
m_endPoint->SetDestroyCallback (MakeCallback (&NscTcpSocketImpl::Destroy, Ptr<NscTcpSocketImpl>(this))); |
|
507 |
||
508 |
NotifyNewConnectionCreated (this, m_peerAddress); |
|
509 |
} |
|
510 |
||
511 |
void NscTcpSocketImpl::ConnectionSucceeded() |
|
512 |
{ // We would preferred to have scheduled an event directly to |
|
513 |
// NotifyConnectionSucceeded, but (sigh) these are protected |
|
514 |
// and we can get the address of it :( |
|
3869
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
515 |
struct sockaddr_in sin; |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
516 |
size_t sin_len = sizeof(sin); |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
517 |
if (0 == m_nscTcpSocket->getsockname((struct sockaddr *) &sin, &sin_len)) { |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
518 |
m_localAddress = m_localAddress.Deserialize((const uint8_t*)&sin.sin_addr); |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
519 |
m_localPort = ntohs(sin.sin_port); |
3578 | 520 |
} |
521 |
||
522 |
NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " connected to " |
|
523 |
<< m_remoteAddress << ":" << m_remotePort |
|
524 |
<< " from " << m_localAddress << ":" << m_localPort); |
|
525 |
NotifyConnectionSucceeded(); |
|
526 |
} |
|
527 |
||
528 |
||
529 |
bool NscTcpSocketImpl::Accept (void) |
|
530 |
{ |
|
531 |
if (m_state == CLOSED) |
|
532 |
{ // Happens if application closes listening socket after Accept() was scheduled. |
|
533 |
return false; |
|
534 |
} |
|
535 |
NS_ASSERT (m_state == LISTEN); |
|
536 |
||
537 |
if (!m_nscTcpSocket->is_listening()) |
|
538 |
{ |
|
539 |
return false; |
|
540 |
} |
|
541 |
INetStreamSocket *newsock; |
|
542 |
int res = m_nscTcpSocket->accept(&newsock); |
|
543 |
if (res != 0) |
|
544 |
{ |
|
545 |
return false; |
|
546 |
} |
|
547 |
// We could obtain a fromAddress using getpeername, but we've already |
|
548 |
// finished the tcp handshake here, i.e. this is a new connection |
|
549 |
// and not a connection request. |
|
550 |
// if (!NotifyConnectionRequest(fromAddress)) |
|
551 |
// return true; |
|
552 |
||
553 |
// Clone the socket |
|
554 |
Ptr<NscTcpSocketImpl> newSock = Copy (); |
|
555 |
newSock->m_nscTcpSocket = newsock; |
|
556 |
NS_LOG_LOGIC ("Cloned a NscTcpSocketImpl " << newSock); |
|
557 |
||
558 |
Simulator::ScheduleNow (&NscTcpSocketImpl::CompleteFork, newSock); |
|
559 |
return true; |
|
560 |
} |
|
561 |
||
562 |
bool NscTcpSocketImpl::ReadPendingData (void) |
|
563 |
{ |
|
564 |
if (m_state != ESTABLISHED) |
|
565 |
{ |
|
566 |
return false; |
|
567 |
} |
|
568 |
int len, err; |
|
569 |
uint8_t buffer[8192]; |
|
570 |
len = sizeof(buffer); |
|
571 |
m_errno = ERROR_NOTERROR; |
|
572 |
err = m_nscTcpSocket->read_data(buffer, &len); |
|
573 |
if (err == 0 && len == 0) |
|
574 |
{ |
|
575 |
NS_LOG_LOGIC ("ReadPendingData got EOF from socket"); |
|
5889
526381e48c1d
Fix NSC improper response to FIN
Tom Henderson <tomh@tomh.org>
parents:
5888
diff
changeset
|
576 |
m_state = CLOSE_WAIT; |
3578 | 577 |
return false; |
578 |
} |
|
579 |
m_errno = GetNativeNs3Errno(err); |
|
580 |
switch (m_errno) |
|
581 |
{ |
|
582 |
case ERROR_NOTERROR: break; // some data was sent |
|
583 |
case ERROR_AGAIN: return false; |
|
584 |
default: |
|
585 |
NS_LOG_WARN ("Error (" << err << ") " << |
|
586 |
"during read_data, ns-3 errno set to" << m_errno); |
|
587 |
m_state = CLOSED; |
|
588 |
return false; |
|
589 |
} |
|
590 |
||
591 |
Ptr<Packet> p = Create<Packet> (buffer, len); |
|
592 |
||
593 |
SocketAddressTag tag; |
|
594 |
||
595 |
tag.SetAddress (m_peerAddress); |
|
4523
b8bdc36a3355
use packet tags rather than byte tags to match TcpSocketImpl and UdpSocketImpl
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4516
diff
changeset
|
596 |
p->AddPacketTag (tag); |
3578 | 597 |
m_deliveryQueue.push (p); |
598 |
m_rxAvailable += p->GetSize (); |
|
599 |
||
600 |
NotifyDataRecv (); |
|
601 |
return true; |
|
602 |
} |
|
603 |
||
604 |
bool NscTcpSocketImpl::SendPendingData (void) |
|
605 |
{ |
|
606 |
NS_LOG_FUNCTION (this); |
|
607 |
NS_LOG_LOGIC ("ENTERING SendPendingData"); |
|
608 |
||
609 |
if (m_txBuffer.empty ()) |
|
610 |
{ |
|
611 |
return false; |
|
612 |
} |
|
613 |
||
614 |
int ret; |
|
615 |
size_t size, written = 0; |
|
616 |
||
617 |
do { |
|
3780
317ccc4ebb4e
bug 386: make sure errno is not set incorrectly and don't access stale packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3778
diff
changeset
|
618 |
NS_ASSERT (!m_txBuffer.empty ()); |
3578 | 619 |
Ptr<Packet> &p = m_txBuffer.front (); |
620 |
size = p->GetSize (); |
|
621 |
NS_ASSERT (size > 0); |
|
622 |
||
623 |
m_errno = ERROR_NOTERROR; |
|
624 |
ret = m_nscTcpSocket->send_data((const char *)p->PeekData (), size); |
|
625 |
if (ret <= 0) |
|
626 |
{ |
|
627 |
break; |
|
628 |
} |
|
629 |
written += ret; |
|
630 |
||
631 |
NS_ASSERT (m_txBufferSize >= (size_t)ret); |
|
632 |
m_txBufferSize -= ret; |
|
633 |
||
634 |
if ((size_t)ret < size) |
|
635 |
{ |
|
636 |
p->RemoveAtStart(ret); |
|
637 |
break; |
|
638 |
} |
|
639 |
||
640 |
m_txBuffer.pop (); |
|
641 |
||
642 |
if (m_txBuffer.empty ()) |
|
643 |
{ |
|
644 |
if (m_closeOnEmpty) |
|
645 |
{ |
|
646 |
m_nscTcpSocket->disconnect(); |
|
647 |
m_state = CLOSED; |
|
648 |
} |
|
649 |
break; |
|
650 |
} |
|
651 |
} while ((size_t) ret == size); |
|
652 |
||
653 |
if (written > 0) |
|
654 |
{ |
|
655 |
Simulator::ScheduleNow(&NscTcpSocketImpl::NotifyDataSent, this, ret); |
|
656 |
return true; |
|
657 |
} |
|
658 |
return false; |
|
659 |
} |
|
660 |
||
661 |
Ptr<NscTcpSocketImpl> NscTcpSocketImpl::Copy () |
|
662 |
{ |
|
663 |
return CopyObject<NscTcpSocketImpl> (this); |
|
664 |
} |
|
665 |
||
666 |
void |
|
667 |
NscTcpSocketImpl::SetSndBufSize (uint32_t size) |
|
668 |
{ |
|
669 |
m_sndBufSize = size; |
|
670 |
} |
|
671 |
||
672 |
uint32_t |
|
673 |
NscTcpSocketImpl::GetSndBufSize (void) const |
|
674 |
{ |
|
675 |
return m_sndBufSize; |
|
676 |
} |
|
677 |
||
678 |
void |
|
679 |
NscTcpSocketImpl::SetRcvBufSize (uint32_t size) |
|
680 |
{ |
|
681 |
m_rcvBufSize = size; |
|
682 |
} |
|
683 |
||
684 |
uint32_t |
|
685 |
NscTcpSocketImpl::GetRcvBufSize (void) const |
|
686 |
{ |
|
687 |
return m_rcvBufSize; |
|
688 |
} |
|
689 |
||
690 |
void |
|
691 |
NscTcpSocketImpl::SetSegSize (uint32_t size) |
|
692 |
{ |
|
693 |
m_segmentSize = size; |
|
694 |
} |
|
695 |
||
696 |
uint32_t |
|
697 |
NscTcpSocketImpl::GetSegSize (void) const |
|
698 |
{ |
|
699 |
return m_segmentSize; |
|
700 |
} |
|
701 |
||
702 |
void |
|
703 |
NscTcpSocketImpl::SetAdvWin (uint32_t window) |
|
704 |
{ |
|
705 |
m_advertisedWindowSize = window; |
|
706 |
} |
|
707 |
||
708 |
uint32_t |
|
709 |
NscTcpSocketImpl::GetAdvWin (void) const |
|
710 |
{ |
|
711 |
return m_advertisedWindowSize; |
|
712 |
} |
|
713 |
||
714 |
void |
|
715 |
NscTcpSocketImpl::SetSSThresh (uint32_t threshold) |
|
716 |
{ |
|
717 |
m_ssThresh = threshold; |
|
718 |
} |
|
719 |
||
720 |
uint32_t |
|
721 |
NscTcpSocketImpl::GetSSThresh (void) const |
|
722 |
{ |
|
723 |
return m_ssThresh; |
|
724 |
} |
|
725 |
||
726 |
void |
|
727 |
NscTcpSocketImpl::SetInitialCwnd (uint32_t cwnd) |
|
728 |
{ |
|
729 |
m_initialCWnd = cwnd; |
|
730 |
} |
|
731 |
||
732 |
uint32_t |
|
733 |
NscTcpSocketImpl::GetInitialCwnd (void) const |
|
734 |
{ |
|
735 |
return m_initialCWnd; |
|
736 |
} |
|
737 |
||
738 |
void |
|
739 |
NscTcpSocketImpl::SetConnTimeout (Time timeout) |
|
740 |
{ |
|
741 |
m_cnTimeout = timeout; |
|
742 |
} |
|
743 |
||
744 |
Time |
|
745 |
NscTcpSocketImpl::GetConnTimeout (void) const |
|
746 |
{ |
|
747 |
return m_cnTimeout; |
|
748 |
} |
|
749 |
||
750 |
void |
|
751 |
NscTcpSocketImpl::SetConnCount (uint32_t count) |
|
752 |
{ |
|
753 |
m_cnCount = count; |
|
754 |
} |
|
755 |
||
756 |
uint32_t |
|
757 |
NscTcpSocketImpl::GetConnCount (void) const |
|
758 |
{ |
|
759 |
return m_cnCount; |
|
760 |
} |
|
761 |
||
762 |
void |
|
763 |
NscTcpSocketImpl::SetDelAckTimeout (Time timeout) |
|
764 |
{ |
|
765 |
m_delAckTimeout = timeout; |
|
766 |
} |
|
767 |
||
768 |
Time |
|
769 |
NscTcpSocketImpl::GetDelAckTimeout (void) const |
|
770 |
{ |
|
771 |
return m_delAckTimeout; |
|
772 |
} |
|
773 |
||
774 |
void |
|
775 |
NscTcpSocketImpl::SetDelAckMaxCount (uint32_t count) |
|
776 |
{ |
|
777 |
m_delAckMaxCount = count; |
|
778 |
} |
|
779 |
||
780 |
uint32_t |
|
781 |
NscTcpSocketImpl::GetDelAckMaxCount (void) const |
|
782 |
{ |
|
783 |
return m_delAckMaxCount; |
|
784 |
} |
|
785 |
||
786 |
enum Socket::SocketErrno |
|
787 |
NscTcpSocketImpl::GetNativeNs3Errno(int error) const |
|
788 |
{ |
|
789 |
enum nsc_errno err; |
|
790 |
||
791 |
if (error >= 0) |
|
792 |
{ |
|
793 |
return ERROR_NOTERROR; |
|
794 |
} |
|
795 |
err = (enum nsc_errno) error; |
|
796 |
switch (err) |
|
797 |
{ |
|
798 |
case NSC_EADDRINUSE: // fallthrough |
|
799 |
case NSC_EADDRNOTAVAIL: return ERROR_AFNOSUPPORT; |
|
800 |
case NSC_EINPROGRESS: // Altough nsc sockets are nonblocking, we pretend they're not. |
|
801 |
case NSC_EAGAIN: return ERROR_AGAIN; |
|
802 |
case NSC_EISCONN: // fallthrough |
|
803 |
case NSC_EALREADY: return ERROR_ISCONN; |
|
804 |
case NSC_ECONNREFUSED: return ERROR_NOROUTETOHOST; // XXX, better mapping? |
|
805 |
case NSC_ECONNRESET: // for no, all of these fall through |
|
806 |
case NSC_EHOSTDOWN: |
|
807 |
case NSC_ENETUNREACH: |
|
808 |
case NSC_EHOSTUNREACH: return ERROR_NOROUTETOHOST; |
|
809 |
case NSC_EMSGSIZE: return ERROR_MSGSIZE; |
|
810 |
case NSC_ENOTCONN: return ERROR_NOTCONN; |
|
811 |
case NSC_ESHUTDOWN: return ERROR_SHUTDOWN; |
|
812 |
case NSC_ETIMEDOUT: return ERROR_NOTCONN; // XXX - this mapping isn't correct |
|
813 |
case NSC_ENOTDIR: // used by eg. sysctl(2). Shouldn't happen normally, |
|
814 |
// but is triggered by e.g. show_config(). |
|
815 |
case NSC_EUNKNOWN: return ERROR_INVAL; // Catches stacks that 'return -1' without real mapping |
|
816 |
} |
|
817 |
NS_ASSERT_MSG(0, "Unknown NSC error"); |
|
818 |
return ERROR_INVAL; |
|
819 |
} |
|
820 |
||
6357
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
821 |
void |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
822 |
NscTcpSocketImpl::SetAllowBroadcast (bool allowBroadcast) |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
823 |
{ |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
824 |
if (allowBroadcast) |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
825 |
{ |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
826 |
NS_FATAL_ERROR ("not implemented"); |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
827 |
} |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
828 |
} |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
829 |
|
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
830 |
bool |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
831 |
NscTcpSocketImpl::GetAllowBroadcast () const |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
832 |
{ |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
833 |
return false; |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
834 |
} |
2e15529e2402
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
835 |
|
3578 | 836 |
}//namespace ns3 |