author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Wed, 03 Jul 2013 14:43:10 -0700 | |
changeset 9894 | ac4e52a91d5d |
parent 9063 | 32755d0516f4 |
child 10410 | 4d4eb8097fa3 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7257
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
3578 | 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 "ns3/simulator.h" |
|
32 |
#include "ns3/packet.h" |
|
33 |
#include "ns3/uinteger.h" |
|
34 |
#include "ns3/trace-source-accessor.h" |
|
35 |
||
36 |
#include <algorithm> |
|
37 |
||
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
38 |
// for ntohs(). |
3578 | 39 |
#include <arpa/inet.h> |
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
40 |
#include <netinet/in.h> |
6694 | 41 |
#include "sim_interface.h" |
3578 | 42 |
|
3635
cddd59578812
compile nsc code unconditionally.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3589
diff
changeset
|
43 |
#include "sim_errno.h" |
3578 | 44 |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7775
diff
changeset
|
45 |
|
3578 | 46 |
NS_LOG_COMPONENT_DEFINE ("NscTcpSocketImpl"); |
47 |
||
48 |
namespace ns3 { |
|
49 |
||
50 |
NS_OBJECT_ENSURE_REGISTERED (NscTcpSocketImpl); |
|
51 |
||
52 |
TypeId |
|
53 |
NscTcpSocketImpl::GetTypeId () |
|
54 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
55 |
static TypeId tid = TypeId ("ns3::NscTcpSocketImpl") |
3578 | 56 |
.SetParent<TcpSocket> () |
57 |
.AddTraceSource ("CongestionWindow", |
|
58 |
"The TCP connection's congestion window", |
|
59 |
MakeTraceSourceAccessor (&NscTcpSocketImpl::m_cWnd)) |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
60 |
; |
3578 | 61 |
return tid; |
62 |
} |
|
63 |
||
6694 | 64 |
NscTcpSocketImpl::NscTcpSocketImpl () |
3578 | 65 |
: m_endPoint (0), |
66 |
m_node (0), |
|
67 |
m_tcp (0), |
|
3778
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
68 |
m_localAddress (Ipv4Address::GetZero ()), |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
69 |
m_localPort (0), |
3578 | 70 |
m_peerAddress ("0.0.0.0", 0), |
71 |
m_errno (ERROR_NOTERROR), |
|
72 |
m_shutdownSend (false), |
|
73 |
m_shutdownRecv (false), |
|
74 |
m_connected (false), |
|
75 |
m_state (CLOSED), |
|
76 |
m_closeOnEmpty (false), |
|
77 |
m_txBufferSize (0), |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
78 |
m_lastMeasuredRtt (Seconds (0.0)) |
3578 | 79 |
{ |
80 |
NS_LOG_FUNCTION (this); |
|
81 |
} |
|
82 |
||
83 |
NscTcpSocketImpl::NscTcpSocketImpl(const NscTcpSocketImpl& sock) |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
84 |
: TcpSocket (sock), //copy the base class callbacks |
3578 | 85 |
m_delAckMaxCount (sock.m_delAckMaxCount), |
86 |
m_delAckTimeout (sock.m_delAckTimeout), |
|
7619
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
87 |
m_noDelay (sock.m_noDelay), |
3578 | 88 |
m_endPoint (0), |
89 |
m_node (sock.m_node), |
|
90 |
m_tcp (sock.m_tcp), |
|
91 |
m_remoteAddress (sock.m_remoteAddress), |
|
92 |
m_remotePort (sock.m_remotePort), |
|
93 |
m_localAddress (sock.m_localAddress), |
|
94 |
m_localPort (sock.m_localPort), |
|
95 |
m_peerAddress (sock.m_peerAddress), |
|
96 |
m_errno (sock.m_errno), |
|
97 |
m_shutdownSend (sock.m_shutdownSend), |
|
98 |
m_shutdownRecv (sock.m_shutdownRecv), |
|
99 |
m_connected (sock.m_connected), |
|
100 |
m_state (sock.m_state), |
|
101 |
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
|
102 |
m_txBufferSize (sock.m_txBufferSize), |
3578 | 103 |
m_segmentSize (sock.m_segmentSize), |
104 |
m_rxWindowSize (sock.m_rxWindowSize), |
|
105 |
m_advertisedWindowSize (sock.m_advertisedWindowSize), |
|
106 |
m_cWnd (sock.m_cWnd), |
|
107 |
m_ssThresh (sock.m_ssThresh), |
|
108 |
m_initialCWnd (sock.m_initialCWnd), |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
109 |
m_lastMeasuredRtt (Seconds (0.0)), |
3578 | 110 |
m_cnTimeout (sock.m_cnTimeout), |
111 |
m_cnCount (sock.m_cnCount), |
|
112 |
m_rxAvailable (0), |
|
113 |
m_nscTcpSocket (0), |
|
114 |
m_sndBufSize (sock.m_sndBufSize) |
|
115 |
{ |
|
116 |
NS_LOG_FUNCTION_NOARGS (); |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
117 |
NS_LOG_LOGIC ("Invoked the copy constructor"); |
3578 | 118 |
//copy the pending data if necessary |
119 |
if(!sock.m_txBuffer.empty () ) |
|
120 |
{ |
|
121 |
m_txBuffer = sock.m_txBuffer; |
|
122 |
} |
|
123 |
//can't "copy" the endpoint just yes, must do this when we know the peer info |
|
124 |
//too; this is in SYN_ACK_TX |
|
125 |
} |
|
126 |
||
127 |
NscTcpSocketImpl::~NscTcpSocketImpl () |
|
128 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
129 |
NS_LOG_FUNCTION (this); |
3578 | 130 |
m_node = 0; |
131 |
if (m_endPoint != 0) |
|
132 |
{ |
|
133 |
NS_ASSERT (m_tcp != 0); |
|
134 |
/** |
|
135 |
* Note that this piece of code is a bit tricky: |
|
136 |
* when DeAllocate is called, it will call into |
|
137 |
* Ipv4EndPointDemux::Deallocate which triggers |
|
138 |
* a delete of the associated endPoint which triggers |
|
7600
57ba46094a0d
fix various doxygen errors
Vedran Miletić <rivanvx@gmail.com>
parents:
7386
diff
changeset
|
139 |
* in turn a call to the method NscTcpSocketImpl::Destroy below |
3578 | 140 |
* will will zero the m_endPoint field. |
141 |
*/ |
|
142 |
NS_ASSERT (m_endPoint != 0); |
|
143 |
m_tcp->DeAllocate (m_endPoint); |
|
144 |
NS_ASSERT (m_endPoint == 0); |
|
145 |
} |
|
146 |
m_tcp = 0; |
|
147 |
} |
|
148 |
||
149 |
void |
|
150 |
NscTcpSocketImpl::SetNode (Ptr<Node> node) |
|
151 |
{ |
|
152 |
m_node = node; |
|
153 |
// Initialize some variables |
|
154 |
m_cWnd = m_initialCWnd * m_segmentSize; |
|
155 |
m_rxWindowSize = m_advertisedWindowSize; |
|
156 |
} |
|
157 |
||
158 |
void |
|
159 |
NscTcpSocketImpl::SetTcp (Ptr<NscTcpL4Protocol> tcp) |
|
160 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
161 |
m_nscTcpSocket = tcp->m_nscStack->new_tcp_socket (); |
3578 | 162 |
m_tcp = tcp; |
163 |
} |
|
164 |
||
165 |
||
166 |
enum Socket::SocketErrno |
|
167 |
NscTcpSocketImpl::GetErrno (void) const |
|
168 |
{ |
|
169 |
NS_LOG_FUNCTION_NOARGS (); |
|
170 |
return m_errno; |
|
171 |
} |
|
172 |
||
6689
e2de571e920a
Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents:
6549
diff
changeset
|
173 |
enum Socket::SocketType |
e2de571e920a
Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents:
6549
diff
changeset
|
174 |
NscTcpSocketImpl::GetSocketType (void) const |
e2de571e920a
Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents:
6549
diff
changeset
|
175 |
{ |
6692
591fb1aa0ca4
Avoid enum name collision in socket
Josh Pelkey <jpelkey@gatech.edu>
parents:
6689
diff
changeset
|
176 |
return NS3_SOCK_STREAM; |
6689
e2de571e920a
Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents:
6549
diff
changeset
|
177 |
} |
e2de571e920a
Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents:
6549
diff
changeset
|
178 |
|
3578 | 179 |
Ptr<Node> |
180 |
NscTcpSocketImpl::GetNode (void) const |
|
181 |
{ |
|
182 |
NS_LOG_FUNCTION_NOARGS (); |
|
183 |
return m_node; |
|
184 |
} |
|
185 |
||
186 |
void |
|
187 |
NscTcpSocketImpl::Destroy (void) |
|
188 |
{ |
|
189 |
NS_LOG_FUNCTION_NOARGS (); |
|
190 |
m_node = 0; |
|
191 |
m_endPoint = 0; |
|
192 |
m_tcp = 0; |
|
193 |
} |
|
194 |
int |
|
195 |
NscTcpSocketImpl::FinishBind (void) |
|
196 |
{ |
|
197 |
NS_LOG_FUNCTION_NOARGS (); |
|
198 |
if (m_endPoint == 0) |
|
199 |
{ |
|
200 |
return -1; |
|
201 |
} |
|
202 |
m_endPoint->SetRxCallback (MakeCallback (&NscTcpSocketImpl::ForwardUp, Ptr<NscTcpSocketImpl>(this))); |
|
203 |
m_endPoint->SetDestroyCallback (MakeCallback (&NscTcpSocketImpl::Destroy, Ptr<NscTcpSocketImpl>(this))); |
|
204 |
m_localAddress = m_endPoint->GetLocalAddress (); |
|
205 |
m_localPort = m_endPoint->GetLocalPort (); |
|
206 |
return 0; |
|
207 |
} |
|
208 |
||
209 |
int |
|
210 |
NscTcpSocketImpl::Bind (void) |
|
211 |
{ |
|
212 |
NS_LOG_FUNCTION_NOARGS (); |
|
213 |
m_endPoint = m_tcp->Allocate (); |
|
214 |
return FinishBind (); |
|
215 |
} |
|
7717
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7704
diff
changeset
|
216 |
int |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7704
diff
changeset
|
217 |
NscTcpSocketImpl::Bind6 () |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7704
diff
changeset
|
218 |
{ |
7720
63b434b229bc
fix typo in NS_LOG statement
Tom Henderson <tomh@tomh.org>
parents:
7717
diff
changeset
|
219 |
NS_LOG_LOGIC ("NscTcpSocketImpl: ERROR_AFNOSUPPORT - Bind6 not supported"); |
7717
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7704
diff
changeset
|
220 |
m_errno = ERROR_AFNOSUPPORT; |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7704
diff
changeset
|
221 |
return (-1); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7704
diff
changeset
|
222 |
} |
3578 | 223 |
int |
224 |
NscTcpSocketImpl::Bind (const Address &address) |
|
225 |
{ |
|
226 |
NS_LOG_FUNCTION (this<<address); |
|
227 |
if (!InetSocketAddress::IsMatchingType (address)) |
|
228 |
{ |
|
229 |
return ERROR_INVAL; |
|
230 |
} |
|
231 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
|
232 |
Ipv4Address ipv4 = transport.GetIpv4 (); |
|
233 |
uint16_t port = transport.GetPort (); |
|
234 |
if (ipv4 == Ipv4Address::GetAny () && port == 0) |
|
235 |
{ |
|
236 |
m_endPoint = m_tcp->Allocate (); |
|
5888 | 237 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 238 |
} |
239 |
else if (ipv4 == Ipv4Address::GetAny () && port != 0) |
|
240 |
{ |
|
241 |
m_endPoint = m_tcp->Allocate (port); |
|
5888 | 242 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 243 |
} |
244 |
else if (ipv4 != Ipv4Address::GetAny () && port == 0) |
|
245 |
{ |
|
246 |
m_endPoint = m_tcp->Allocate (ipv4); |
|
5888 | 247 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 248 |
} |
249 |
else if (ipv4 != Ipv4Address::GetAny () && port != 0) |
|
250 |
{ |
|
251 |
m_endPoint = m_tcp->Allocate (ipv4, port); |
|
5888 | 252 |
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint); |
3578 | 253 |
} |
254 |
||
255 |
m_localPort = port; |
|
256 |
return FinishBind (); |
|
257 |
} |
|
258 |
||
259 |
int |
|
260 |
NscTcpSocketImpl::ShutdownSend (void) |
|
261 |
{ |
|
262 |
NS_LOG_FUNCTION_NOARGS (); |
|
263 |
m_shutdownSend = true; |
|
264 |
return 0; |
|
265 |
} |
|
266 |
int |
|
267 |
NscTcpSocketImpl::ShutdownRecv (void) |
|
268 |
{ |
|
269 |
NS_LOG_FUNCTION_NOARGS (); |
|
4491
893d48fcf7f3
bug 535: UDP/TCP ShutdownRecv incorrect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3869
diff
changeset
|
270 |
m_shutdownRecv = true; |
3578 | 271 |
return 0; |
272 |
} |
|
273 |
||
274 |
int |
|
275 |
NscTcpSocketImpl::Close (void) |
|
276 |
{ |
|
277 |
NS_LOG_FUNCTION (this << m_state); |
|
278 |
||
279 |
if (m_state == CLOSED) |
|
280 |
{ |
|
281 |
return -1; |
|
282 |
} |
|
283 |
if (!m_txBuffer.empty ()) |
|
284 |
{ // App close with pending data must wait until all data transmitted |
|
285 |
m_closeOnEmpty = true; |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
286 |
NS_LOG_LOGIC ("Socket " << this << |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
287 |
" deferring close, state " << m_state); |
3578 | 288 |
return 0; |
289 |
} |
|
290 |
||
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
291 |
NS_LOG_LOGIC ("NscTcp socket " << this << " calling disconnect(); moving to CLOSED"); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
292 |
m_nscTcpSocket->disconnect (); |
3578 | 293 |
m_state = CLOSED; |
294 |
ShutdownSend (); |
|
295 |
return 0; |
|
296 |
} |
|
297 |
||
298 |
int |
|
299 |
NscTcpSocketImpl::Connect (const Address & address) |
|
300 |
{ |
|
301 |
NS_LOG_FUNCTION (this << address); |
|
302 |
if (m_endPoint == 0) |
|
303 |
{ |
|
304 |
if (Bind () == -1) |
|
305 |
{ |
|
306 |
NS_ASSERT (m_endPoint == 0); |
|
307 |
return -1; |
|
308 |
} |
|
309 |
NS_ASSERT (m_endPoint != 0); |
|
310 |
} |
|
311 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
|
312 |
m_remoteAddress = transport.GetIpv4 (); |
|
313 |
m_remotePort = transport.GetPort (); |
|
314 |
||
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
315 |
std::ostringstream ss; |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
316 |
m_remoteAddress.Print (ss); |
3711
fed597b0583e
nsc: avoid unecessary use of posix headers
Florian Westphal <fw@strlen.de>
parents:
3635
diff
changeset
|
317 |
std::string ipstring = ss.str (); |
3578 | 318 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
319 |
m_nscTcpSocket->connect (ipstring.c_str (), m_remotePort); |
3578 | 320 |
m_state = SYN_SENT; |
321 |
return 0; |
|
322 |
} |
|
323 |
||
324 |
int |
|
325 |
NscTcpSocketImpl::Send (const Ptr<Packet> p, uint32_t flags) |
|
326 |
{ |
|
327 |
NS_LOG_FUNCTION (this << p); |
|
328 |
||
329 |
NS_ASSERT (p->GetSize () > 0); |
|
330 |
if (m_state == ESTABLISHED || m_state == SYN_SENT || m_state == CLOSE_WAIT) |
|
331 |
{ |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
332 |
if (p->GetSize () > GetTxAvailable ()) |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
333 |
{ |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
334 |
m_errno = ERROR_MSGSIZE; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
335 |
return -1; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
336 |
} |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
337 |
|
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
338 |
uint32_t sent = p->GetSize (); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
339 |
if (m_state == ESTABLISHED) |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
340 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
341 |
m_txBuffer.push (p); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
342 |
m_txBufferSize += sent; |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
343 |
SendPendingData (); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
344 |
} |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
345 |
else |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
346 |
{ // SYN_SET -- Queue Data |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
347 |
m_txBuffer.push (p); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
348 |
m_txBufferSize += sent; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
349 |
} |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
350 |
return sent; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
351 |
} |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
352 |
else |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
353 |
{ |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
354 |
m_errno = ERROR_NOTCONN; |
3578 | 355 |
return -1; |
356 |
} |
|
357 |
} |
|
358 |
||
359 |
int |
|
360 |
NscTcpSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address) |
|
361 |
{ |
|
362 |
NS_LOG_FUNCTION (this << address << p); |
|
363 |
if (!m_connected) |
|
364 |
{ |
|
365 |
m_errno = ERROR_NOTCONN; |
|
366 |
return -1; |
|
367 |
} |
|
368 |
else |
|
369 |
{ |
|
370 |
return Send (p, flags); //drop the address according to BSD manpages |
|
371 |
} |
|
372 |
} |
|
373 |
||
374 |
uint32_t |
|
375 |
NscTcpSocketImpl::GetTxAvailable (void) const |
|
376 |
{ |
|
377 |
NS_LOG_FUNCTION_NOARGS (); |
|
378 |
if (m_txBufferSize != 0) |
|
379 |
{ |
|
380 |
NS_ASSERT (m_txBufferSize <= m_sndBufSize); |
|
381 |
return m_sndBufSize - m_txBufferSize; |
|
382 |
} |
|
383 |
else |
|
384 |
{ |
|
385 |
return m_sndBufSize; |
|
386 |
} |
|
387 |
} |
|
388 |
||
389 |
int |
|
3772
f0d8608ab155
Remove queue limit from listen
Craig Dowell <craigdo@ee.washington.edu>
parents:
3711
diff
changeset
|
390 |
NscTcpSocketImpl::Listen (void) |
3578 | 391 |
{ |
3772
f0d8608ab155
Remove queue limit from listen
Craig Dowell <craigdo@ee.washington.edu>
parents:
3711
diff
changeset
|
392 |
NS_LOG_FUNCTION (this); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
393 |
m_nscTcpSocket->listen (m_localPort); |
3578 | 394 |
m_state = LISTEN; |
395 |
return 0; |
|
396 |
} |
|
397 |
||
398 |
||
399 |
void |
|
400 |
NscTcpSocketImpl::NSCWakeup () |
|
401 |
{ |
|
402 |
switch (m_state) { |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
403 |
case SYN_SENT: |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
404 |
if (!m_nscTcpSocket->is_connected ()) |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
405 |
break; |
3578 | 406 |
m_state = ESTABLISHED; |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
407 |
Simulator::ScheduleNow (&NscTcpSocketImpl::ConnectionSucceeded, this); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
408 |
// fall through to schedule read/write events |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
409 |
case ESTABLISHED: |
3578 | 410 |
if (!m_txBuffer.empty ()) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
411 |
Simulator::ScheduleNow (&NscTcpSocketImpl::SendPendingData, this); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
412 |
Simulator::ScheduleNow (&NscTcpSocketImpl::ReadPendingData, this); |
3578 | 413 |
break; |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
414 |
case LISTEN: |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
415 |
Simulator::ScheduleNow (&NscTcpSocketImpl::Accept, this); |
3578 | 416 |
break; |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
417 |
case CLOSED: break; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
418 |
default: |
3578 | 419 |
NS_LOG_DEBUG (this << " invalid state: " << m_state); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
420 |
} |
3578 | 421 |
} |
422 |
||
423 |
Ptr<Packet> |
|
424 |
NscTcpSocketImpl::Recv (uint32_t maxSize, uint32_t flags) |
|
425 |
{ |
|
426 |
NS_LOG_FUNCTION_NOARGS (); |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
427 |
if (m_deliveryQueue.empty () ) |
3578 | 428 |
{ |
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
|
429 |
m_errno = ERROR_AGAIN; |
3578 | 430 |
return 0; |
431 |
} |
|
432 |
Ptr<Packet> p = m_deliveryQueue.front (); |
|
433 |
if (p->GetSize () <= maxSize) |
|
434 |
{ |
|
435 |
m_deliveryQueue.pop (); |
|
436 |
m_rxAvailable -= p->GetSize (); |
|
437 |
} |
|
438 |
else |
|
439 |
{ |
|
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
|
440 |
m_errno = ERROR_AGAIN; |
3578 | 441 |
p = 0; |
442 |
} |
|
443 |
return p; |
|
444 |
} |
|
445 |
||
446 |
Ptr<Packet> |
|
447 |
NscTcpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags, |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
448 |
Address &fromAddress) |
3578 | 449 |
{ |
450 |
NS_LOG_FUNCTION (this << maxSize << flags); |
|
451 |
Ptr<Packet> packet = Recv (maxSize, flags); |
|
452 |
if (packet != 0) |
|
453 |
{ |
|
454 |
SocketAddressTag tag; |
|
455 |
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
|
456 |
found = packet->PeekPacketTag (tag); |
3578 | 457 |
NS_ASSERT (found); |
458 |
fromAddress = tag.GetAddress (); |
|
459 |
} |
|
460 |
return packet; |
|
461 |
} |
|
462 |
||
3778
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
463 |
int |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
464 |
NscTcpSocketImpl::GetSockName (Address &address) const |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
465 |
{ |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
466 |
NS_LOG_FUNCTION_NOARGS (); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
467 |
address = InetSocketAddress (m_localAddress, m_localPort); |
3778
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
468 |
return 0; |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
469 |
} |
78c4c41557f3
Liu's GetSockName patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
470 |
|
3578 | 471 |
uint32_t |
472 |
NscTcpSocketImpl::GetRxAvailable (void) const |
|
473 |
{ |
|
474 |
NS_LOG_FUNCTION_NOARGS (); |
|
475 |
// We separately maintain this state to avoid walking the queue |
|
476 |
// every time this might be called |
|
477 |
return m_rxAvailable; |
|
478 |
} |
|
479 |
||
480 |
void |
|
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6437
diff
changeset
|
481 |
NscTcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, |
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6437
diff
changeset
|
482 |
Ptr<Ipv4Interface> incomingInterface) |
3578 | 483 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
484 |
NSCWakeup (); |
3578 | 485 |
} |
486 |
||
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
487 |
void NscTcpSocketImpl::CompleteFork (void) |
3578 | 488 |
{ |
489 |
// The address pairs (m_localAddress, m_localPort, m_remoteAddress, m_remotePort) |
|
490 |
// are bogus, but this isn't important at the moment, because |
|
491 |
// address <-> Socket handling is done by NSC internally. |
|
492 |
// We only need to add the new ns-3 socket to the list of sockets, so |
|
493 |
// 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
|
494 |
struct sockaddr_in sin; |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
495 |
size_t sin_len = sizeof(sin); |
3578 | 496 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
497 |
if (0 == m_nscTcpSocket->getpeername ((struct sockaddr*) &sin, &sin_len)) { |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
498 |
m_remotePort = ntohs (sin.sin_port); |
7775
62dee74123ca
Bug 1304 - (temporary fix) Tag information changed after transmission
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7720
diff
changeset
|
499 |
m_remoteAddress = Ipv4Address::Deserialize ((const uint8_t*) &sin.sin_addr); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
500 |
m_peerAddress = InetSocketAddress (m_remoteAddress, m_remotePort); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
501 |
} |
3578 | 502 |
|
503 |
m_endPoint = m_tcp->Allocate (); |
|
504 |
||
505 |
//the cloned socket with be in listen state, so manually change state |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
506 |
NS_ASSERT (m_state == LISTEN); |
3578 | 507 |
m_state = ESTABLISHED; |
508 |
||
3869
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
509 |
sin_len = sizeof(sin); |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
510 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
511 |
if (0 == m_nscTcpSocket->getsockname ((struct sockaddr *) &sin, &sin_len)) |
7775
62dee74123ca
Bug 1304 - (temporary fix) Tag information changed after transmission
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7720
diff
changeset
|
512 |
m_localAddress = Ipv4Address::Deserialize ((const uint8_t*) &sin.sin_addr); |
3578 | 513 |
|
514 |
NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " accepted connection from " |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
515 |
<< m_remoteAddress << ":" << m_remotePort |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
516 |
<< " to " << m_localAddress << ":" << m_localPort); |
3578 | 517 |
//equivalent to FinishBind |
518 |
m_endPoint->SetRxCallback (MakeCallback (&NscTcpSocketImpl::ForwardUp, Ptr<NscTcpSocketImpl>(this))); |
|
519 |
m_endPoint->SetDestroyCallback (MakeCallback (&NscTcpSocketImpl::Destroy, Ptr<NscTcpSocketImpl>(this))); |
|
520 |
||
521 |
NotifyNewConnectionCreated (this, m_peerAddress); |
|
522 |
} |
|
523 |
||
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
524 |
void NscTcpSocketImpl::ConnectionSucceeded () |
3578 | 525 |
{ // We would preferred to have scheduled an event directly to |
526 |
// NotifyConnectionSucceeded, but (sigh) these are protected |
|
527 |
// 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
|
528 |
struct sockaddr_in sin; |
0edba1e055aa
nsc-tcp-socket-impl: use new nsc getsockname/getpeername interface.
Florian Westphal <fw@strlen.de>
parents:
3780
diff
changeset
|
529 |
size_t sin_len = sizeof(sin); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
530 |
if (0 == m_nscTcpSocket->getsockname ((struct sockaddr *) &sin, &sin_len)) { |
7775
62dee74123ca
Bug 1304 - (temporary fix) Tag information changed after transmission
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7720
diff
changeset
|
531 |
m_localAddress = Ipv4Address::Deserialize ((const uint8_t*)&sin.sin_addr); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
532 |
m_localPort = ntohs (sin.sin_port); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
533 |
} |
3578 | 534 |
|
535 |
NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " connected to " |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
536 |
<< m_remoteAddress << ":" << m_remotePort |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
537 |
<< " from " << m_localAddress << ":" << m_localPort); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
538 |
NotifyConnectionSucceeded (); |
3578 | 539 |
} |
540 |
||
541 |
||
542 |
bool NscTcpSocketImpl::Accept (void) |
|
543 |
{ |
|
544 |
if (m_state == CLOSED) |
|
545 |
{ // Happens if application closes listening socket after Accept() was scheduled. |
|
546 |
return false; |
|
547 |
} |
|
548 |
NS_ASSERT (m_state == LISTEN); |
|
549 |
||
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
550 |
if (!m_nscTcpSocket->is_listening ()) |
3578 | 551 |
{ |
552 |
return false; |
|
553 |
} |
|
554 |
INetStreamSocket *newsock; |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
555 |
int res = m_nscTcpSocket->accept (&newsock); |
3578 | 556 |
if (res != 0) |
557 |
{ |
|
558 |
return false; |
|
559 |
} |
|
560 |
// We could obtain a fromAddress using getpeername, but we've already |
|
561 |
// finished the tcp handshake here, i.e. this is a new connection |
|
562 |
// and not a connection request. |
|
563 |
// if (!NotifyConnectionRequest(fromAddress)) |
|
564 |
// return true; |
|
565 |
||
566 |
// Clone the socket |
|
567 |
Ptr<NscTcpSocketImpl> newSock = Copy (); |
|
568 |
newSock->m_nscTcpSocket = newsock; |
|
569 |
NS_LOG_LOGIC ("Cloned a NscTcpSocketImpl " << newSock); |
|
570 |
||
571 |
Simulator::ScheduleNow (&NscTcpSocketImpl::CompleteFork, newSock); |
|
572 |
return true; |
|
573 |
} |
|
574 |
||
575 |
bool NscTcpSocketImpl::ReadPendingData (void) |
|
576 |
{ |
|
577 |
if (m_state != ESTABLISHED) |
|
578 |
{ |
|
579 |
return false; |
|
580 |
} |
|
581 |
int len, err; |
|
582 |
uint8_t buffer[8192]; |
|
583 |
len = sizeof(buffer); |
|
584 |
m_errno = ERROR_NOTERROR; |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
585 |
err = m_nscTcpSocket->read_data (buffer, &len); |
3578 | 586 |
if (err == 0 && len == 0) |
587 |
{ |
|
588 |
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
|
589 |
m_state = CLOSE_WAIT; |
3578 | 590 |
return false; |
591 |
} |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
592 |
m_errno = GetNativeNs3Errno (err); |
3578 | 593 |
switch (m_errno) |
594 |
{ |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
595 |
case ERROR_NOTERROR: break; // some data was sent |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
596 |
case ERROR_AGAIN: return false; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
597 |
default: |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
598 |
NS_LOG_WARN ("Error (" << err << ") " << |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
599 |
"during read_data, ns-3 errno set to" << m_errno); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
600 |
m_state = CLOSED; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
601 |
return false; |
3578 | 602 |
} |
603 |
||
604 |
Ptr<Packet> p = Create<Packet> (buffer, len); |
|
605 |
||
606 |
SocketAddressTag tag; |
|
607 |
||
608 |
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
|
609 |
p->AddPacketTag (tag); |
3578 | 610 |
m_deliveryQueue.push (p); |
611 |
m_rxAvailable += p->GetSize (); |
|
612 |
||
613 |
NotifyDataRecv (); |
|
614 |
return true; |
|
615 |
} |
|
616 |
||
617 |
bool NscTcpSocketImpl::SendPendingData (void) |
|
618 |
{ |
|
619 |
NS_LOG_FUNCTION (this); |
|
620 |
NS_LOG_LOGIC ("ENTERING SendPendingData"); |
|
621 |
||
622 |
if (m_txBuffer.empty ()) |
|
623 |
{ |
|
624 |
return false; |
|
625 |
} |
|
626 |
||
627 |
int ret; |
|
628 |
size_t size, written = 0; |
|
629 |
||
630 |
do { |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
631 |
NS_ASSERT (!m_txBuffer.empty ()); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
632 |
Ptr<Packet> &p = m_txBuffer.front (); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
633 |
size = p->GetSize (); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
634 |
NS_ASSERT (size > 0); |
3578 | 635 |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
636 |
m_errno = ERROR_NOTERROR; |
6549
487146fc889e
get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents:
6448
diff
changeset
|
637 |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
638 |
uint8_t *buf = new uint8_t[size]; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
639 |
p->CopyData (buf, size); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
640 |
ret = m_nscTcpSocket->send_data ((const char *)buf, size); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
641 |
delete[] buf; |
6549
487146fc889e
get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents:
6448
diff
changeset
|
642 |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
643 |
if (ret <= 0) |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
644 |
{ |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
645 |
break; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
646 |
} |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
647 |
written += ret; |
3578 | 648 |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
649 |
NS_ASSERT (m_txBufferSize >= (size_t)ret); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
650 |
m_txBufferSize -= ret; |
3578 | 651 |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
652 |
if ((size_t)ret < size) |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
653 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
654 |
p->RemoveAtStart (ret); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
655 |
break; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
656 |
} |
3578 | 657 |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
658 |
m_txBuffer.pop (); |
3578 | 659 |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
660 |
if (m_txBuffer.empty ()) |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
661 |
{ |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
662 |
if (m_closeOnEmpty) |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
663 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
664 |
m_nscTcpSocket->disconnect (); |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
665 |
m_state = CLOSED; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
666 |
} |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
667 |
break; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
668 |
} |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
669 |
} while ((size_t) ret == size); |
3578 | 670 |
|
671 |
if (written > 0) |
|
672 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
673 |
Simulator::ScheduleNow (&NscTcpSocketImpl::NotifyDataSent, this, ret); |
3578 | 674 |
return true; |
675 |
} |
|
676 |
return false; |
|
677 |
} |
|
678 |
||
679 |
Ptr<NscTcpSocketImpl> NscTcpSocketImpl::Copy () |
|
680 |
{ |
|
681 |
return CopyObject<NscTcpSocketImpl> (this); |
|
682 |
} |
|
683 |
||
684 |
void |
|
685 |
NscTcpSocketImpl::SetSndBufSize (uint32_t size) |
|
686 |
{ |
|
687 |
m_sndBufSize = size; |
|
688 |
} |
|
689 |
||
690 |
uint32_t |
|
691 |
NscTcpSocketImpl::GetSndBufSize (void) const |
|
692 |
{ |
|
693 |
return m_sndBufSize; |
|
694 |
} |
|
695 |
||
696 |
void |
|
697 |
NscTcpSocketImpl::SetRcvBufSize (uint32_t size) |
|
698 |
{ |
|
699 |
m_rcvBufSize = size; |
|
700 |
} |
|
701 |
||
702 |
uint32_t |
|
703 |
NscTcpSocketImpl::GetRcvBufSize (void) const |
|
704 |
{ |
|
705 |
return m_rcvBufSize; |
|
706 |
} |
|
707 |
||
708 |
void |
|
709 |
NscTcpSocketImpl::SetSegSize (uint32_t size) |
|
710 |
{ |
|
711 |
m_segmentSize = size; |
|
712 |
} |
|
713 |
||
714 |
uint32_t |
|
715 |
NscTcpSocketImpl::GetSegSize (void) const |
|
716 |
{ |
|
717 |
return m_segmentSize; |
|
718 |
} |
|
719 |
||
720 |
void |
|
721 |
NscTcpSocketImpl::SetAdvWin (uint32_t window) |
|
722 |
{ |
|
723 |
m_advertisedWindowSize = window; |
|
724 |
} |
|
725 |
||
726 |
uint32_t |
|
727 |
NscTcpSocketImpl::GetAdvWin (void) const |
|
728 |
{ |
|
729 |
return m_advertisedWindowSize; |
|
730 |
} |
|
731 |
||
732 |
void |
|
733 |
NscTcpSocketImpl::SetSSThresh (uint32_t threshold) |
|
734 |
{ |
|
735 |
m_ssThresh = threshold; |
|
736 |
} |
|
737 |
||
738 |
uint32_t |
|
739 |
NscTcpSocketImpl::GetSSThresh (void) const |
|
740 |
{ |
|
741 |
return m_ssThresh; |
|
742 |
} |
|
743 |
||
744 |
void |
|
745 |
NscTcpSocketImpl::SetInitialCwnd (uint32_t cwnd) |
|
746 |
{ |
|
747 |
m_initialCWnd = cwnd; |
|
748 |
} |
|
749 |
||
750 |
uint32_t |
|
751 |
NscTcpSocketImpl::GetInitialCwnd (void) const |
|
752 |
{ |
|
753 |
return m_initialCWnd; |
|
754 |
} |
|
755 |
||
756 |
void |
|
757 |
NscTcpSocketImpl::SetConnTimeout (Time timeout) |
|
758 |
{ |
|
759 |
m_cnTimeout = timeout; |
|
760 |
} |
|
761 |
||
762 |
Time |
|
763 |
NscTcpSocketImpl::GetConnTimeout (void) const |
|
764 |
{ |
|
765 |
return m_cnTimeout; |
|
766 |
} |
|
767 |
||
768 |
void |
|
769 |
NscTcpSocketImpl::SetConnCount (uint32_t count) |
|
770 |
{ |
|
771 |
m_cnCount = count; |
|
772 |
} |
|
773 |
||
774 |
uint32_t |
|
775 |
NscTcpSocketImpl::GetConnCount (void) const |
|
776 |
{ |
|
777 |
return m_cnCount; |
|
778 |
} |
|
779 |
||
780 |
void |
|
781 |
NscTcpSocketImpl::SetDelAckTimeout (Time timeout) |
|
782 |
{ |
|
783 |
m_delAckTimeout = timeout; |
|
784 |
} |
|
785 |
||
786 |
Time |
|
787 |
NscTcpSocketImpl::GetDelAckTimeout (void) const |
|
788 |
{ |
|
789 |
return m_delAckTimeout; |
|
790 |
} |
|
791 |
||
792 |
void |
|
793 |
NscTcpSocketImpl::SetDelAckMaxCount (uint32_t count) |
|
794 |
{ |
|
795 |
m_delAckMaxCount = count; |
|
796 |
} |
|
797 |
||
798 |
uint32_t |
|
799 |
NscTcpSocketImpl::GetDelAckMaxCount (void) const |
|
800 |
{ |
|
801 |
return m_delAckMaxCount; |
|
802 |
} |
|
803 |
||
7619
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
804 |
void |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
805 |
NscTcpSocketImpl::SetTcpNoDelay (bool noDelay) |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
806 |
{ |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
807 |
m_noDelay = noDelay; |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
808 |
} |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
809 |
|
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
810 |
bool |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
811 |
NscTcpSocketImpl::GetTcpNoDelay (void) const |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
812 |
{ |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
813 |
return m_noDelay; |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
814 |
} |
b4dee6307aa7
Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7600
diff
changeset
|
815 |
|
6694 | 816 |
void |
817 |
NscTcpSocketImpl::SetPersistTimeout (Time timeout) |
|
818 |
{ |
|
819 |
m_persistTimeout = timeout; |
|
820 |
} |
|
821 |
||
822 |
Time |
|
823 |
NscTcpSocketImpl::GetPersistTimeout (void) const |
|
824 |
{ |
|
825 |
return m_persistTimeout; |
|
826 |
} |
|
827 |
||
3578 | 828 |
enum Socket::SocketErrno |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
829 |
NscTcpSocketImpl::GetNativeNs3Errno (int error) const |
3578 | 830 |
{ |
831 |
enum nsc_errno err; |
|
832 |
||
833 |
if (error >= 0) |
|
834 |
{ |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
835 |
return ERROR_NOTERROR; |
3578 | 836 |
} |
837 |
err = (enum nsc_errno) error; |
|
838 |
switch (err) |
|
839 |
{ |
|
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
840 |
case NSC_EADDRINUSE: // fallthrough |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
841 |
case NSC_EADDRNOTAVAIL: return ERROR_AFNOSUPPORT; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
842 |
case NSC_EINPROGRESS: // Altough nsc sockets are nonblocking, we pretend they're not. |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
843 |
case NSC_EAGAIN: return ERROR_AGAIN; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
844 |
case NSC_EISCONN: // fallthrough |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
845 |
case NSC_EALREADY: return ERROR_ISCONN; |
9894
ac4e52a91d5d
Doxygenate todo's
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9063
diff
changeset
|
846 |
case NSC_ECONNREFUSED: return ERROR_NOROUTETOHOST; /// \todo better mapping? |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
847 |
case NSC_ECONNRESET: // for no, all of these fall through |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
848 |
case NSC_EHOSTDOWN: |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
849 |
case NSC_ENETUNREACH: |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
850 |
case NSC_EHOSTUNREACH: return ERROR_NOROUTETOHOST; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
851 |
case NSC_EMSGSIZE: return ERROR_MSGSIZE; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
852 |
case NSC_ENOTCONN: return ERROR_NOTCONN; |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
853 |
case NSC_ESHUTDOWN: return ERROR_SHUTDOWN; |
9894
ac4e52a91d5d
Doxygenate todo's
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9063
diff
changeset
|
854 |
case NSC_ETIMEDOUT: return ERROR_NOTCONN; /// \todo this mapping isn't correct |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
855 |
case NSC_ENOTDIR: // used by eg. sysctl(2). Shouldn't happen normally, |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
856 |
// but is triggered by e.g. show_config(). |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
857 |
case NSC_EUNKNOWN: return ERROR_INVAL; // Catches stacks that 'return -1' without real mapping |
3578 | 858 |
} |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
859 |
NS_ASSERT_MSG (0, "Unknown NSC error"); |
3578 | 860 |
return ERROR_INVAL; |
861 |
} |
|
862 |
||
6448
184a509cc71d
Still Bug 943: fix UdpSocketImpl::GetAllowBroadcast, let Socket::SetAllowBroadcast return a bool indicating success/failure, instead of a fatal error.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6442
diff
changeset
|
863 |
bool |
6437
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
864 |
NscTcpSocketImpl::SetAllowBroadcast (bool allowBroadcast) |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
865 |
{ |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
866 |
if (allowBroadcast) |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
867 |
{ |
6448
184a509cc71d
Still Bug 943: fix UdpSocketImpl::GetAllowBroadcast, let Socket::SetAllowBroadcast return a bool indicating success/failure, instead of a fatal error.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6442
diff
changeset
|
868 |
return false; |
6437
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
869 |
} |
6448
184a509cc71d
Still Bug 943: fix UdpSocketImpl::GetAllowBroadcast, let Socket::SetAllowBroadcast return a bool indicating success/failure, instead of a fatal error.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6442
diff
changeset
|
870 |
return true; |
6437
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
871 |
} |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
872 |
|
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
873 |
bool |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
874 |
NscTcpSocketImpl::GetAllowBroadcast () const |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
875 |
{ |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
876 |
return false; |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
877 |
} |
c11291f51d57
Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6319
diff
changeset
|
878 |
|
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
879 |
} // namespace ns3 |