A Discrete-Event Network Simulator
API
packet-socket.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 Emmanuelle Laprise, INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
19  * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  */
21 
22 #include "packet-socket.h"
23 #include "packet-socket-address.h"
24 #include "ns3/log.h"
25 #include "ns3/node.h"
26 #include "ns3/packet.h"
27 #include "ns3/uinteger.h"
28 #include "ns3/trace-source-accessor.h"
29 
30 #include <algorithm>
31 
32 namespace ns3 {
33 
34 NS_LOG_COMPONENT_DEFINE ("PacketSocket");
35 
36 NS_OBJECT_ENSURE_REGISTERED (PacketSocket);
37 
38 TypeId
40 {
41  static TypeId tid = TypeId ("ns3::PacketSocket")
42  .SetParent<Socket> ()
43  .SetGroupName("Network")
44  .AddConstructor<PacketSocket> ()
45  .AddTraceSource ("Drop", "Drop packet due to receive buffer overflow",
47  "ns3::Packet::TracedCallback")
48  .AddAttribute ("RcvBufSize",
49  "PacketSocket maximum receive buffer size (bytes)",
50  UintegerValue (131072),
52  MakeUintegerChecker<uint32_t> ())
53  ;
54  return tid;
55 }
56 
57 PacketSocket::PacketSocket () : m_rxAvailable (0)
58 {
59  NS_LOG_FUNCTION (this);
61  m_shutdownSend = false;
62  m_shutdownRecv = false;
64  m_isSingleDevice = false;
65  m_device = 0;
66 }
67 
68 void
70 {
71  NS_LOG_FUNCTION (this << node);
72  m_node = node;
73 }
74 
76 {
77  NS_LOG_FUNCTION (this);
78 }
79 
80 void
82 {
83  NS_LOG_FUNCTION (this);
84  m_device = 0;
85 }
86 
89 {
90  NS_LOG_FUNCTION (this);
91  return m_errno;
92 }
93 
96 {
97  NS_LOG_FUNCTION (this);
98  return NS3_SOCK_RAW;
99 }
100 
101 Ptr<Node>
103 {
104  NS_LOG_FUNCTION (this);
105  return m_node;
106 }
107 
108 int
110 {
111  NS_LOG_FUNCTION (this);
113  address.SetProtocol (0);
114  address.SetAllDevices ();
115  return DoBind (address);
116 }
117 
118 int
120 {
121  NS_LOG_FUNCTION (this);
122  return(Bind());
123 }
124 
125 int
127 {
128  NS_LOG_FUNCTION (this << address);
130  {
132  return -1;
133  }
135  return DoBind (ad);
136 }
137 
138 int
140 {
141  NS_LOG_FUNCTION (this << address);
142  if (m_state == STATE_BOUND ||
144  {
146  return -1;
147  }
148  if (m_state == STATE_CLOSED)
149  {
151  return -1;
152  }
153  Ptr<NetDevice> dev;
154  if (address.IsSingleDevice ())
155  {
156  dev = m_node->GetDevice (address.GetSingleDevice ());
157  }
158  else
159  {
160  dev = 0;
161  }
163  address.GetProtocol (), dev);
165  m_protocol = address.GetProtocol ();
166  m_isSingleDevice = address.IsSingleDevice ();
167  m_device = address.GetSingleDevice ();
168  m_boundnetdevice = dev;
169  return 0;
170 }
171 
172 int
174 {
175  NS_LOG_FUNCTION (this);
176  if (m_state == STATE_CLOSED)
177  {
179  return -1;
180  }
181  m_shutdownSend = true;
182  return 0;
183 }
184 
185 int
187 {
188  NS_LOG_FUNCTION (this);
189  if (m_state == STATE_CLOSED)
190  {
192  return -1;
193  }
194  m_shutdownRecv = true;
195  return 0;
196 }
197 
198 int
200 {
201  NS_LOG_FUNCTION (this);
202  if (m_state == STATE_CLOSED)
203  {
205  return -1;
206  }
207  else if (m_state == STATE_BOUND || m_state == STATE_CONNECTED)
208  {
210  }
212  m_shutdownSend = true;
213  m_shutdownRecv = true;
214  return 0;
215 }
216 
217 int
219 {
220  NS_LOG_FUNCTION (this << ad);
222  if (m_state == STATE_CLOSED)
223  {
225  goto error;
226  }
227  if (m_state == STATE_OPEN)
228  {
229  // connect should happen _after_ bind.
230  m_errno = ERROR_INVAL; // generic error condition.
231  goto error;
232  }
233  if (m_state == STATE_CONNECTED)
234  {
236  goto error;
237  }
239  {
241  goto error;
242  }
243  m_destAddr = ad;
246  return 0;
247 error:
249  return -1;
250 }
251 int
253 {
254  NS_LOG_FUNCTION (this);
256  return -1;
257 }
258 
259 int
260 PacketSocket::Send (Ptr<Packet> p, uint32_t flags)
261 {
262  NS_LOG_FUNCTION (this << p << flags);
263  if (m_state == STATE_OPEN ||
264  m_state == STATE_BOUND)
265  {
267  return -1;
268  }
269  return SendTo (p, flags, m_destAddr);
270 }
271 
272 uint32_t
274 {
275  NS_LOG_FUNCTION (this << ad);
276  if (ad.IsSingleDevice ())
277  {
279  return device->GetMtu ();
280  }
281  else
282  {
283  uint32_t minMtu = 0xffff;
284  for (uint32_t i = 0; i < m_node->GetNDevices (); i++)
285  {
286  Ptr<NetDevice> device = m_node->GetDevice (i);
287  minMtu = std::min (minMtu, (uint32_t)device->GetMtu ());
288  }
289  return minMtu;
290  }
291 }
292 
293 uint32_t
295 {
296  NS_LOG_FUNCTION (this);
297  if (m_state == STATE_CONNECTED)
298  {
300  return GetMinMtu (ad);
301  }
302  // If we are not connected, we return a 'safe' value by default.
303  return 0xffff;
304 }
305 
306 int
307 PacketSocket::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address)
308 {
309  NS_LOG_FUNCTION (this << p << flags << address);
311  if (m_state == STATE_CLOSED)
312  {
313  NS_LOG_LOGIC ("ERROR_BADF");
315  return -1;
316  }
317  if (m_shutdownSend)
318  {
319  NS_LOG_LOGIC ("ERROR_SHUTDOWN");
321  return -1;
322  }
324  {
325  NS_LOG_LOGIC ("ERROR_AFNOSUPPORT");
327  return -1;
328  }
329  ad = PacketSocketAddress::ConvertFrom (address);
330  if (p->GetSize () > GetMinMtu (ad))
331  {
333  return -1;
334  }
335 
336  bool error = false;
337  Address dest = ad.GetPhysicalAddress ();
338  if (ad.IsSingleDevice ())
339  {
341  if (!device->Send (p, dest, ad.GetProtocol ()))
342  {
343  NS_LOG_LOGIC ("error: NetDevice::Send error");
344  error = true;
345  }
346  }
347  else
348  {
349  for (uint32_t i = 0; i < m_node->GetNDevices (); i++)
350  {
351  Ptr<NetDevice> device = m_node->GetDevice (i);
352  if (!device->Send (p, dest, ad.GetProtocol ()))
353  {
354  NS_LOG_LOGIC ("error: NetDevice::Send error");
355  error = true;
356  }
357  }
358  }
359  if (!error)
360  {
361  NotifyDataSent (p->GetSize ());
363  }
364 
365  if (error)
366  {
367  NS_LOG_LOGIC ("ERROR_INVAL 2");
369  return -1;
370  }
371  else
372  {
373  return p->GetSize ();
374  }
375 }
376 
377 void
379  uint16_t protocol, const Address &from,
380  const Address &to, NetDevice::PacketType packetType)
381 {
382  NS_LOG_FUNCTION (this << device << packet << protocol << from << to << packetType);
383  if (m_shutdownRecv)
384  {
385  return;
386  }
388  address.SetPhysicalAddress (from);
389  address.SetSingleDevice (device->GetIfIndex ());
390  address.SetProtocol (protocol);
391 
392  if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
393  {
394  Ptr<Packet> copy = packet->Copy ();
395  DeviceNameTag dnt;
396  dnt.SetDeviceName (device->GetTypeId ().GetName ());
397  PacketSocketTag pst;
398  pst.SetPacketType (packetType);
399  pst.SetDestAddress (to);
400  SocketAddressTag tag;
401  tag.SetAddress (address);
402  copy->AddPacketTag (tag); // Attach From Physical Address
403  copy->AddPacketTag (pst); // Attach Packet Type and Dest Address
404  copy->AddPacketTag (dnt); // Attach device source name
405  m_deliveryQueue.push (copy);
406  m_rxAvailable += packet->GetSize ();
407  NS_LOG_LOGIC ("UID is " << packet->GetUid () << " PacketSocket " << this);
408  NotifyDataRecv ();
409  }
410  else
411  {
412  // In general, this case should not occur unless the
413  // receiving application reads data from this socket slowly
414  // in comparison to the arrival rate
415  //
416  // drop and trace packet
417  NS_LOG_WARN ("No receive buffer space available. Drop.");
418  m_dropTrace (packet);
419  }
420 }
421 
422 uint32_t
424 {
425  NS_LOG_FUNCTION (this);
426  // We separately maintain this state to avoid walking the queue
427  // every time this might be called
428  return m_rxAvailable;
429 }
430 
432 PacketSocket::Recv (uint32_t maxSize, uint32_t flags)
433 {
434  NS_LOG_FUNCTION (this << maxSize << flags);
435  if (m_deliveryQueue.empty () )
436  {
437  return 0;
438  }
439  Ptr<Packet> p = m_deliveryQueue.front ();
440  if (p->GetSize () <= maxSize)
441  {
442  m_deliveryQueue.pop ();
443  m_rxAvailable -= p->GetSize ();
444  }
445  else
446  {
447  p = 0;
448  }
449  return p;
450 }
451 
453 PacketSocket::RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)
454 {
455  NS_LOG_FUNCTION (this << maxSize << flags << fromAddress);
456  Ptr<Packet> packet = Recv (maxSize, flags);
457  if (packet != 0)
458  {
459  SocketAddressTag tag;
460  bool found;
461  found = packet->PeekPacketTag (tag);
462  NS_ASSERT (found);
463  fromAddress = tag.GetAddress ();
464  }
465  return packet;
466 }
467 
468 int
470 {
471  NS_LOG_FUNCTION (this << address);
473 
474  ad.SetProtocol (m_protocol);
475  if (m_isSingleDevice)
476  {
478  ad.SetPhysicalAddress (device->GetAddress ());
480  }
481  else
482  {
483  ad.SetPhysicalAddress (Address ());
484  ad.SetAllDevices ();
485  }
486  address = ad;
487 
488  return 0;
489 }
490 
491 int
493 {
494  NS_LOG_FUNCTION (this << address);
495 
496  if (m_state != STATE_CONNECTED)
497  {
499  return -1;
500  }
501 
502  address = m_destAddr;
503 
504  return 0;
505 }
506 
507 bool
508 PacketSocket::SetAllowBroadcast (bool allowBroadcast)
509 {
510  NS_LOG_FUNCTION (this << allowBroadcast);
511  if (allowBroadcast)
512  {
513  return false;
514  }
515  return true;
516 }
517 
518 bool
520 {
521  NS_LOG_FUNCTION (this);
522  return false;
523 }
524 
525 /***************************************************************
526  * PacketSocket Tags
527  ***************************************************************/
528 
530 {
531 }
532 
533 void
535 {
536  m_packetType = t;
537 }
538 
541 {
542  return m_packetType;
543 }
544 
545 void
547 {
548  m_destAddr = a;
549 }
550 
551 Address
553 {
554  return m_destAddr;
555 }
556 
558 
559 TypeId
561 {
562  static TypeId tid = TypeId ("ns3::PacketSocketTag")
563  .SetParent<Tag> ()
564  .SetGroupName("Network")
565  .AddConstructor<PacketSocketTag> ()
566  ;
567  return tid;
568 }
569 TypeId
571 {
572  return GetTypeId ();
573 }
574 uint32_t
576 {
577  return 1 + m_destAddr.GetSerializedSize();
578 }
579 void
581 {
582  i.WriteU8 (m_packetType);
583  m_destAddr.Serialize (i);
584 }
585 void
587 {
590 }
591 void
592 PacketSocketTag::Print (std::ostream &os) const
593 {
594  os << "packetType=" << m_packetType;
595 }
596 
597 /***************************************************************
598  * DeviceName Tags
599  ***************************************************************/
600 
602 {
603 }
604 
605 void
607 {
608  if ( n.substr(0,5) == "ns3::" )
609  {
610  n = n.substr (5);
611  }
612  m_deviceName = n;
613 }
614 
615 std::string
617 {
618  return m_deviceName;
619 }
620 
622 
623 TypeId
625 {
626  static TypeId tid = TypeId ("ns3::DeviceNameTag")
627  .SetParent<Tag> ()
628  .SetGroupName("Network")
629  .AddConstructor<DeviceNameTag> ();
630  return tid;
631 }
632 TypeId
634 {
635  return GetTypeId ();
636 }
637 uint32_t
639 {
640  uint32_t s = 1 + m_deviceName.size(); // +1 for name length field
641  s = std::min (s, (uint32_t)PacketTagList::TagData::MAX_SIZE);
642  return s;
643 }
644 void
646 {
647  const char *n = m_deviceName.c_str();
648  uint8_t l = (uint8_t) m_deviceName.size ();
649 
650  l = std::min ((uint32_t)l, (uint32_t)PacketTagList::TagData::MAX_SIZE - 1);
651 
652  i.WriteU8 (l);
653  i.Write ( (uint8_t*) n , (uint32_t) l);
654 }
655 void
657 {
658  uint8_t l = i.ReadU8();
659  char buf[256];
660 
661  i.Read ( (uint8_t* ) buf, (uint32_t) l);
662  m_deviceName = std::string (buf, l);
663 }
664 void
665 DeviceNameTag::Print (std::ostream &os) const
666 {
667  os << "DeviceName=" << m_deviceName;
668 }
669 
670 
671 } // namespace ns3
static TypeId GetTypeId(void)
Get the type ID.
uint16_t GetProtocol(void) const
Get the protocol.
Size of serialization buffer data.
void Write(const uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:125
virtual enum SocketErrno GetErrno(void) const
Get last error number.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
std::string m_deviceName
Device name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
#define min(a, b)
Definition: 80211b.c:44
void NotifyDataRecv(void)
Notify through the callback (if set) that some data have been received.
Definition: socket.cc:305
Address GetDestAddress(void) const
Get the destination address of the corresponding packet.
Ptr< Packet > Recv(void)
Read a single packet from the socket.
Definition: socket.cc:175
NetDevice::PacketType m_packetType
Packet type.
Address m_destAddr
Default destination address.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:824
void SetAddress(Address addr)
Set the tag's address.
Definition: socket.cc:555
uint64_t GetUid(void) const
Returns the packet's Uid.
Definition: packet.cc:368
void NotifyConnectionFailed(void)
Notify through the callback (if set) that the connection has not been established due to an error...
Definition: socket.cc:227
std::queue< Ptr< Packet > > m_deliveryQueue
Rx queue.
an address for a packet socket
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)
Read a single packet from the socket and retrieve the sender address.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:538
static bool IsMatchingType(const Address &address)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
virtual void DoDispose(void)
Destructor implementation.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:786
A PacketSocket is a link between an application and a net device.
Definition: packet-socket.h:78
void SetAllDevices(void)
Set the address to match all the outgoing NetDevice.
virtual uint32_t GetSerializedSize(void) const
SocketType
Enumeration of the possible socket types.
Definition: socket.h:104
void SetPacketType(NetDevice::PacketType t)
Set the packet type.
virtual int Bind(void)
Bind the socket to the NetDevice and register the protocol handler.
virtual void Print(std::ostream &os) const
uint32_t m_rxAvailable
Rx queue size [Bytes].
virtual int GetSockName(Address &address) const
Get socket address.
uint32_t GetSingleDevice(void) const
Get the device this address is bound to.
void UnregisterProtocolHandler(ProtocolHandler handler)
Definition: node.cc:261
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition: tag-buffer.h:195
a polymophic address class
Definition: address.h:90
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Ptr< Node > m_node
the associated node
virtual void Serialize(TagBuffer i) const
virtual int GetPeerName(Address &address) const
Get the peer address of a connected socket.
A low-level Socket API based loosely on the BSD Socket API.
Definition: socket.h:66
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:846
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed.
void SetDestAddress(Address a)
Set the destination address of the corresponding packet.
virtual int ShutdownRecv(void)
virtual void Deserialize(TagBuffer i)
Hold an unsigned integer type.
Definition: uinteger.h:44
enum State m_state
Socket state.
virtual uint32_t GetSerializedSize(void) const
static TypeId GetTypeId(void)
Get the type ID.
PacketSocketTag()
Create an empty PacketSocketTag.
bool m_isSingleDevice
Is bound to a single netDevice.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:142
This class implements a tag that carries an address of a packet across the socket interface...
Definition: socket.h:1005
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1480
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:285
virtual Ptr< Node > GetNode(void) const
Return the node this socket is associated with.
virtual int Listen(void)
Listen for incoming connections.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
void Deserialize(TagBuffer buffer)
Definition: address.cc:163
void NotifyConnectionSucceeded(void)
Notify through the callback (if set) that the connection has been established.
Definition: socket.cc:217
uint32_t GetSerializedSize(void) const
Get the number of bytes needed to serialize the underlying Address Typically, this is GetLength () + ...
Definition: address.cc:147
uint32_t m_device
index of the bound NetDevice
uint32_t GetNDevices(void) const
Definition: node.cc:150
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
virtual uint32_t GetRxAvailable(void) const
Return number of bytes which can be returned from one or multiple calls to Recv.
tag a set of bytes in a packet
Definition: tag.h:36
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPhysicalAddress(const Address address)
Set the destination address.
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host.
uint32_t m_rcvBufSize
Rx buffer size [Bytes].
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)
Send data to a specified peer.
Address GetPhysicalAddress(void) const
Get the destination address.
bool m_shutdownSend
Send no longer allowed.
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
This class implements a tag that carries the ns3 device name from where a packet is coming...
virtual bool GetAllowBroadcast() const
Query whether broadcast datagram transmissions are allowed.
enum SocketErrno m_errno
Socket error code.
void RegisterProtocolHandler(ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false)
Definition: node.cc:227
virtual void Deserialize(TagBuffer i)
virtual int Close(void)
Close a socket.
uint16_t m_protocol
Socket protocol.
Address m_destAddr
Destination address.
bool m_shutdownRecv
Receive no longer allowed.
void SetNode(Ptr< Node > node)
Set the associated node.
static TypeId GetTypeId(void)
Get the type ID.
read and write tag data
Definition: tag-buffer.h:51
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:967
void Serialize(TagBuffer buffer) const
Serialize this address in host byte order to a byte buffer.
Definition: address.cc:154
int DoBind(const PacketSocketAddress &address)
Bind the socket to the NetDevice and register the protocol handler specified in the address...
virtual uint32_t GetTxAvailable(void) const
Returns the number of bytes which can be sent in a single call to Send.
virtual void Serialize(TagBuffer i) const
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:228
Address GetAddress(void) const
Get the tag's address.
Definition: socket.cc:562
virtual ~PacketSocket()
NetDevice::PacketType GetPacketType(void) const
Get the packet type.
virtual void Print(std::ostream &os) const
bool IsSingleDevice(void) const
Checks if the address is bound to a specified NetDevice.
DeviceNameTag()
Create an empty DeviceNameTag.
void SetProtocol(uint16_t protocol)
Set the protocol.
static PacketSocketAddress ConvertFrom(const Address &address)
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
void Read(uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:176
uint32_t GetMinMtu(PacketSocketAddress ad) const
Get the minimum MTU supported by the NetDevices bound to a specific address.
virtual int Bind6(void)
Bind the socket to the NetDevice and register the protocol handler.
std::string GetDeviceName(void) const
Get the device name from where the corresponding packet is coming.
tuple address
Definition: first.py:37
This class implements a tag that carries the dest address of a packet and the packet type...
TracedCallback< Ptr< const Packet > > m_dropTrace
Traced callback: dropped packets.
virtual int ShutdownSend(void)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
a unique identifier for an interface.
Definition: type-id.h:58
void NotifySend(uint32_t spaceAvailable)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:295
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:826
virtual enum SocketType GetSocketType(void) const
void ForwardUp(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
Called by the L3 protocol when it received a packet to pass on to TCP.
void SetDeviceName(std::string n)
Set the device name.