This documentation is not the Latest Release.
A Discrete-Event Network Simulator
API
udp-socket-impl.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 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  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include "ns3/log.h"
22 #include "ns3/node.h"
23 #include "ns3/inet-socket-address.h"
24 #include "ns3/inet6-socket-address.h"
25 #include "ns3/ipv4-route.h"
26 #include "ns3/ipv6-route.h"
27 #include "ns3/ipv4.h"
28 #include "ns3/ipv6.h"
29 #include "ns3/ipv4-header.h"
30 #include "ns3/ipv4-routing-protocol.h"
31 #include "ns3/ipv6-routing-protocol.h"
32 #include "ns3/udp-socket-factory.h"
33 #include "ns3/trace-source-accessor.h"
34 #include "ns3/ipv4-packet-info-tag.h"
35 #include "ns3/ipv6-packet-info-tag.h"
36 #include "udp-socket-impl.h"
37 #include "udp-l4-protocol.h"
38 #include "ipv4-end-point.h"
39 #include "ipv6-end-point.h"
40 #include <limits>
41 
42 namespace ns3 {
43 
44 NS_LOG_COMPONENT_DEFINE ("UdpSocketImpl");
45 
46 NS_OBJECT_ENSURE_REGISTERED (UdpSocketImpl);
47 
48 // The correct maximum UDP message size is 65507, as determined by the following formula:
49 // 0xffff - (sizeof(IP Header) + sizeof(UDP Header)) = 65535-(20+8) = 65507
50 // \todo MAX_IPV4_UDP_DATAGRAM_SIZE is correct only for IPv4
51 static const uint32_t MAX_IPV4_UDP_DATAGRAM_SIZE = 65507;
52 
53 // Add attributes generic to all UdpSockets to base class UdpSocket
54 TypeId
56 {
57  static TypeId tid = TypeId ("ns3::UdpSocketImpl")
58  .SetParent<UdpSocket> ()
59  .SetGroupName ("Internet")
60  .AddConstructor<UdpSocketImpl> ()
61  .AddTraceSource ("Drop",
62  "Drop UDP packet due to receive buffer overflow",
64  "ns3::Packet::TracedCallback")
65  .AddAttribute ("IcmpCallback", "Callback invoked whenever an icmp error is received on this socket.",
66  CallbackValue (),
69  .AddAttribute ("IcmpCallback6", "Callback invoked whenever an icmpv6 error is received on this socket.",
70  CallbackValue (),
73  ;
74  return tid;
75 }
76 
78  : m_endPoint (0),
79  m_endPoint6 (0),
80  m_node (0),
81  m_udp (0),
82  m_errno (ERROR_NOTERROR),
83  m_shutdownSend (false),
84  m_shutdownRecv (false),
85  m_connected (false),
86  m_rxAvailable (0)
87 {
89  m_allowBroadcast = false;
90 }
91 
93 {
95 
97  m_node = 0;
103  if (m_endPoint != 0)
104  {
105  NS_ASSERT (m_udp != 0);
114  NS_ASSERT (m_endPoint != 0);
115  m_udp->DeAllocate (m_endPoint);
116  NS_ASSERT (m_endPoint == 0);
117  }
118  if (m_endPoint6 != 0)
119  {
120  NS_ASSERT (m_udp != 0);
129  NS_ASSERT (m_endPoint6 != 0);
130  m_udp->DeAllocate (m_endPoint6);
131  NS_ASSERT (m_endPoint6 == 0);
132  }
133  m_udp = 0;
134 }
135 
136 void
138 {
140  m_node = node;
141 
142 }
143 void
145 {
147  m_udp = udp;
148 }
149 
150 
153 {
155  return m_errno;
156 }
157 
160 {
161  return NS3_SOCK_DGRAM;
162 }
163 
164 Ptr<Node>
166 {
168  return m_node;
169 }
170 
171 void
173 {
175  m_endPoint = 0;
176 }
177 
178 void
180 {
182  m_endPoint6 = 0;
183 }
184 
185 /* Deallocate the end point and cancel all the timers */
186 void
188 {
189  if (m_endPoint != 0)
190  {
191  m_endPoint->SetDestroyCallback (MakeNullCallback<void> ());
192  m_udp->DeAllocate (m_endPoint);
193  m_endPoint = 0;
194  }
195  if (m_endPoint6 != 0)
196  {
197  m_endPoint6->SetDestroyCallback (MakeNullCallback<void> ());
198  m_udp->DeAllocate (m_endPoint6);
199  m_endPoint6 = 0;
200  }
201 }
202 
203 
204 int
206 {
208  bool done = false;
209  if (m_endPoint != 0)
210  {
214  done = true;
215  }
216  if (m_endPoint6 != 0)
217  {
221  done = true;
222  }
223  if (done)
224  {
225  return 0;
226  }
227  return -1;
228 }
229 
230 int
232 {
234  m_endPoint = m_udp->Allocate ();
235  return FinishBind ();
236 }
237 
238 int
240 {
242  m_endPoint6 = m_udp->Allocate6 ();
243  return FinishBind ();
244 }
245 
246 int
248 {
249  NS_LOG_FUNCTION (this << address);
250 
251  if (InetSocketAddress::IsMatchingType (address))
252  {
253  NS_ASSERT_MSG (m_endPoint == 0, "Endpoint already allocated (maybe you used BindToNetDevice before Bind).");
254 
256  Ipv4Address ipv4 = transport.GetIpv4 ();
257  uint16_t port = transport.GetPort ();
258  if (ipv4 == Ipv4Address::GetAny () && port == 0)
259  {
260  m_endPoint = m_udp->Allocate ();
261  }
262  else if (ipv4 == Ipv4Address::GetAny () && port != 0)
263  {
264  m_endPoint = m_udp->Allocate (port);
265  }
266  else if (ipv4 != Ipv4Address::GetAny () && port == 0)
267  {
268  m_endPoint = m_udp->Allocate (ipv4);
269  }
270  else if (ipv4 != Ipv4Address::GetAny () && port != 0)
271  {
272  m_endPoint = m_udp->Allocate (ipv4, port);
273  }
274  if (0 == m_endPoint)
275  {
277  return -1;
278  }
279  }
280  else if (Inet6SocketAddress::IsMatchingType (address))
281  {
282  NS_ASSERT_MSG (m_endPoint == 0, "Endpoint already allocated (maybe you used BindToNetDevice before Bind).");
283 
285  Ipv6Address ipv6 = transport.GetIpv6 ();
286  uint16_t port = transport.GetPort ();
287  if (ipv6 == Ipv6Address::GetAny () && port == 0)
288  {
289  m_endPoint6 = m_udp->Allocate6 ();
290  }
291  else if (ipv6 == Ipv6Address::GetAny () && port != 0)
292  {
293  m_endPoint6 = m_udp->Allocate6 (port);
294  }
295  else if (ipv6 != Ipv6Address::GetAny () && port == 0)
296  {
297  m_endPoint6 = m_udp->Allocate6 (ipv6);
298  }
299  else if (ipv6 != Ipv6Address::GetAny () && port != 0)
300  {
301  m_endPoint6 = m_udp->Allocate6 (ipv6, port);
302  }
303  if (0 == m_endPoint6)
304  {
306  return -1;
307  }
308  }
309  else
310  {
311  NS_LOG_ERROR ("Not IsMatchingType");
313  return -1;
314  }
315 
316  return FinishBind ();
317 }
318 
319 int
321 {
323  m_shutdownSend = true;
324  return 0;
325 }
326 
327 int
329 {
331  m_shutdownRecv = true;
332  if (m_endPoint)
333  {
334  m_endPoint->SetRxEnabled (false);
335  }
336  if (m_endPoint6)
337  {
338  m_endPoint6->SetRxEnabled (false);
339  }
340  return 0;
341 }
342 
343 int
345 {
347  if (m_shutdownRecv == true && m_shutdownSend == true)
348  {
350  return -1;
351  }
352  m_shutdownRecv = true;
353  m_shutdownSend = true;
355  return 0;
356 }
357 
358 int
360 {
361  NS_LOG_FUNCTION (this << address);
362  if (InetSocketAddress::IsMatchingType(address) == true)
363  {
365  m_defaultAddress = Address(transport.GetIpv4 ());
366  m_defaultPort = transport.GetPort ();
367  m_connected = true;
369  }
370  else if (Inet6SocketAddress::IsMatchingType(address) == true)
371  {
373  m_defaultAddress = Address(transport.GetIpv6 ());
374  m_defaultPort = transport.GetPort ();
375  m_connected = true;
377  }
378  else
379  {
380  return -1;
381  }
382 
383  return 0;
384 }
385 
386 int
388 {
390  return -1;
391 }
392 
393 int
394 UdpSocketImpl::Send (Ptr<Packet> p, uint32_t flags)
395 {
396  NS_LOG_FUNCTION (this << p << flags);
397 
398  if (!m_connected)
399  {
401  return -1;
402  }
403 
404  return DoSend (p);
405 }
406 
407 int
409 {
410  NS_LOG_FUNCTION (this << p);
412  {
413  if (Bind () == -1)
414  {
415  NS_ASSERT (m_endPoint == 0);
416  return -1;
417  }
418  NS_ASSERT (m_endPoint != 0);
419  }
421  {
422  if (Bind6 () == -1)
423  {
424  NS_ASSERT (m_endPoint6 == 0);
425  return -1;
426  }
427  NS_ASSERT (m_endPoint6 != 0);
428  }
429  if (m_shutdownSend)
430  {
432  return -1;
433  }
434 
435  return DoSendTo (p, (const Address)m_defaultAddress);
436 }
437 
438 int
440 {
441  NS_LOG_FUNCTION (this << p << address);
442 
443  if (!m_connected)
444  {
445  NS_LOG_LOGIC ("Not connected");
446  if (InetSocketAddress::IsMatchingType(address) == true)
447  {
449  Ipv4Address ipv4 = transport.GetIpv4 ();
450  uint16_t port = transport.GetPort ();
451  return DoSendTo (p, ipv4, port);
452  }
453  else if (Inet6SocketAddress::IsMatchingType(address) == true)
454  {
456  Ipv6Address ipv6 = transport.GetIpv6 ();
457  uint16_t port = transport.GetPort ();
458  return DoSendTo (p, ipv6, port);
459  }
460  else
461  {
462  return -1;
463  }
464  }
465  else
466  {
467  // connected UDP socket must use default addresses
468  NS_LOG_LOGIC ("Connected");
470  {
472  }
474  {
476  }
477  }
479  return(-1);
480 }
481 
482 int
484 {
485  NS_LOG_FUNCTION (this << p << dest << port);
486  if (m_boundnetdevice)
487  {
488  NS_LOG_LOGIC ("Bound interface number " << m_boundnetdevice->GetIfIndex ());
489  }
490  if (m_endPoint == 0)
491  {
492  if (Bind () == -1)
493  {
494  NS_ASSERT (m_endPoint == 0);
495  return -1;
496  }
497  NS_ASSERT (m_endPoint != 0);
498  }
499  if (m_shutdownSend)
500  {
502  return -1;
503  }
504 
505  if (p->GetSize () > GetTxAvailable () )
506  {
508  return -1;
509  }
510 
511  if (IsManualIpTos ())
512  {
513  SocketIpTosTag ipTosTag;
514  ipTosTag.SetTos (GetIpTos ());
515  p->AddPacketTag (ipTosTag);
516  }
517 
518  Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
519 
520  // Locally override the IP TTL for this socket
521  // We cannot directly modify the TTL at this stage, so we set a Packet tag
522  // The destination can be either multicast, unicast/anycast, or
523  // either all-hosts broadcast or limited (subnet-directed) broadcast.
524  // For the latter two broadcast types, the TTL will later be set to one
525  // irrespective of what is set in these socket options. So, this tagging
526  // may end up setting the TTL of a limited broadcast packet to be
527  // the same as a unicast, but it will be fixed further down the stack
528  if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
529  {
530  SocketIpTtlTag tag;
531  tag.SetTtl (m_ipMulticastTtl);
532  p->AddPacketTag (tag);
533  }
534  else if (IsManualIpTtl () && GetIpTtl () != 0 && !dest.IsMulticast () && !dest.IsBroadcast ())
535  {
536  SocketIpTtlTag tag;
537  tag.SetTtl (GetIpTtl ());
538  p->AddPacketTag (tag);
539  }
540  {
542  bool found = p->RemovePacketTag (tag);
543  if (!found)
544  {
545  if (m_mtuDiscover)
546  {
547  tag.Enable ();
548  }
549  else
550  {
551  tag.Disable ();
552  }
553  p->AddPacketTag (tag);
554  }
555  }
556  //
557  // If dest is set to the limited broadcast address (all ones),
558  // convert it to send a copy of the packet out of every
559  // interface as a subnet-directed broadcast.
560  // Exception: if the interface has a /32 address, there is no
561  // valid subnet-directed broadcast, so send it as limited broadcast
562  // Note also that some systems will only send limited broadcast packets
563  // out of the "default" interface; here we send it out all interfaces
564  //
565  if (dest.IsBroadcast ())
566  {
567  if (!m_allowBroadcast)
568  {
570  return -1;
571  }
572  NS_LOG_LOGIC ("Limited broadcast start.");
573  for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ )
574  {
575  // Get the primary address
576  Ipv4InterfaceAddress iaddr = ipv4->GetAddress (i, 0);
577  Ipv4Address addri = iaddr.GetLocal ();
578  if (addri == Ipv4Address ("127.0.0.1"))
579  continue;
580  // Check if interface-bound socket
581  if (m_boundnetdevice)
582  {
583  if (ipv4->GetNetDevice (i) != m_boundnetdevice)
584  continue;
585  }
586  Ipv4Mask maski = iaddr.GetMask ();
587  if (maski == Ipv4Mask::GetOnes ())
588  {
589  // if the network mask is 255.255.255.255, do not convert dest
590  NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << dest
591  << " (mask is " << maski << ")");
592  m_udp->Send (p->Copy (), addri, dest,
594  NotifyDataSent (p->GetSize ());
596  }
597  else
598  {
599  // Convert to subnet-directed broadcast
600  Ipv4Address bcast = addri.GetSubnetDirectedBroadcast (maski);
601  NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << bcast
602  << " (mask is " << maski << ")");
603  m_udp->Send (p->Copy (), addri, bcast,
605  NotifyDataSent (p->GetSize ());
607  }
608  }
609  NS_LOG_LOGIC ("Limited broadcast end.");
610  return p->GetSize ();
611  }
613  {
614  m_udp->Send (p->Copy (), m_endPoint->GetLocalAddress (), dest,
615  m_endPoint->GetLocalPort (), port, 0);
616  NotifyDataSent (p->GetSize ());
618  return p->GetSize ();
619  }
620  else if (ipv4->GetRoutingProtocol () != 0)
621  {
622  Ipv4Header header;
623  header.SetDestination (dest);
625  Socket::SocketErrno errno_;
626  Ptr<Ipv4Route> route;
627  Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a specific device
628  // TBD-- we could cache the route and just check its validity
629  route = ipv4->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_);
630  if (route != 0)
631  {
632  NS_LOG_LOGIC ("Route exists");
633  if (!m_allowBroadcast)
634  {
635  uint32_t outputIfIndex = ipv4->GetInterfaceForDevice (route->GetOutputDevice ());
636  uint32_t ifNAddr = ipv4->GetNAddresses (outputIfIndex);
637  for (uint32_t addrI = 0; addrI < ifNAddr; ++addrI)
638  {
639  Ipv4InterfaceAddress ifAddr = ipv4->GetAddress (outputIfIndex, addrI);
640  if (dest == ifAddr.GetBroadcast ())
641  {
643  return -1;
644  }
645  }
646  }
647 
648  header.SetSource (route->GetSource ());
649  m_udp->Send (p->Copy (), header.GetSource (), header.GetDestination (),
650  m_endPoint->GetLocalPort (), port, route);
651  NotifyDataSent (p->GetSize ());
652  return p->GetSize ();
653  }
654  else
655  {
656  NS_LOG_LOGIC ("No route to destination");
657  NS_LOG_ERROR (errno_);
658  m_errno = errno_;
659  return -1;
660  }
661  }
662  else
663  {
664  NS_LOG_ERROR ("ERROR_NOROUTETOHOST");
666  return -1;
667  }
668 
669  return 0;
670 }
671 
672 int
674 {
675  NS_LOG_FUNCTION (this << p << dest << port);
676 
677  if (dest.IsIpv4MappedAddress ())
678  {
679  return (DoSendTo(p, dest.GetIpv4MappedAddress (), port));
680  }
681  if (m_boundnetdevice)
682  {
683  NS_LOG_LOGIC ("Bound interface number " << m_boundnetdevice->GetIfIndex ());
684  }
685  if (m_endPoint6 == 0)
686  {
687  if (Bind6 () == -1)
688  {
689  NS_ASSERT (m_endPoint6 == 0);
690  return -1;
691  }
692  NS_ASSERT (m_endPoint6 != 0);
693  }
694  if (m_shutdownSend)
695  {
697  return -1;
698  }
699 
700  if (p->GetSize () > GetTxAvailable () )
701  {
703  return -1;
704  }
705 
706  if (IsManualIpv6Tclass ())
707  {
708  SocketIpv6TclassTag ipTclassTag;
709  ipTclassTag.SetTclass (GetIpv6Tclass ());
710  p->AddPacketTag (ipTclassTag);
711  }
712 
713  Ptr<Ipv6> ipv6 = m_node->GetObject<Ipv6> ();
714 
715  // Locally override the IP TTL for this socket
716  // We cannot directly modify the TTL at this stage, so we set a Packet tag
717  // The destination can be either multicast, unicast/anycast, or
718  // either all-hosts broadcast or limited (subnet-directed) broadcast.
719  // For the latter two broadcast types, the TTL will later be set to one
720  // irrespective of what is set in these socket options. So, this tagging
721  // may end up setting the TTL of a limited broadcast packet to be
722  // the same as a unicast, but it will be fixed further down the stack
723  if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
724  {
727  p->AddPacketTag (tag);
728  }
729  else if (IsManualIpv6HopLimit () && GetIpv6HopLimit () != 0 && !dest.IsMulticast ())
730  {
732  tag.SetHopLimit (GetIpv6HopLimit ());
733  p->AddPacketTag (tag);
734  }
735  // There is no analgous to an IPv4 broadcast address in IPv6.
736  // Instead, we use a set of link-local, site-local, and global
737  // multicast addresses. The Ipv6 routing layers should all
738  // provide an interface-specific route to these addresses such
739  // that we can treat these multicast addresses as "not broadcast"
740 
742  {
743  m_udp->Send (p->Copy (), m_endPoint6->GetLocalAddress (), dest,
744  m_endPoint6->GetLocalPort (), port, 0);
745  NotifyDataSent (p->GetSize ());
747  return p->GetSize ();
748  }
749  else if (ipv6->GetRoutingProtocol () != 0)
750  {
751  Ipv6Header header;
752  header.SetDestinationAddress (dest);
754  Socket::SocketErrno errno_;
755  Ptr<Ipv6Route> route;
756  Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a specific device
757  // TBD-- we could cache the route and just check its validity
758  route = ipv6->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_);
759  if (route != 0)
760  {
761  NS_LOG_LOGIC ("Route exists");
762  header.SetSourceAddress (route->GetSource ());
763  m_udp->Send (p->Copy (), header.GetSourceAddress (), header.GetDestinationAddress (),
764  m_endPoint6->GetLocalPort (), port, route);
765  NotifyDataSent (p->GetSize ());
766  return p->GetSize ();
767  }
768  else
769  {
770  NS_LOG_LOGIC ("No route to destination");
771  NS_LOG_ERROR (errno_);
772  m_errno = errno_;
773  return -1;
774  }
775  }
776  else
777  {
778  NS_LOG_ERROR ("ERROR_NOROUTETOHOST");
780  return -1;
781  }
782 
783  return 0;
784 }
785 
786 
787 // maximum message size for UDP broadcast is limited by MTU
788 // size of underlying link; we are not checking that now.
789 // \todo Check MTU size of underlying link
790 uint32_t
792 {
794  // No finite send buffer is modelled, but we must respect
795  // the maximum size of an IP datagram (65535 bytes - headers).
797 }
798 
799 int
801 {
802  NS_LOG_FUNCTION (this << p << flags << address);
803  if (InetSocketAddress::IsMatchingType (address))
804  {
805  if (IsManualIpTos ())
806  {
807  SocketIpTosTag ipTosTag;
808  ipTosTag.SetTos (GetIpTos ());
809  p->AddPacketTag (ipTosTag);
810  }
811 
813  Ipv4Address ipv4 = transport.GetIpv4 ();
814  uint16_t port = transport.GetPort ();
815  return DoSendTo (p, ipv4, port);
816  }
817  else if (Inet6SocketAddress::IsMatchingType (address))
818  {
819  if (IsManualIpv6Tclass ())
820  {
821  SocketIpv6TclassTag ipTclassTag;
822  ipTclassTag.SetTclass (GetIpv6Tclass ());
823  p->AddPacketTag (ipTclassTag);
824  }
825 
827  Ipv6Address ipv6 = transport.GetIpv6 ();
828  uint16_t port = transport.GetPort ();
829  return DoSendTo (p, ipv6, port);
830  }
831  return -1;
832 }
833 
834 uint32_t
836 {
838  // We separately maintain this state to avoid walking the queue
839  // every time this might be called
840  return m_rxAvailable;
841 }
842 
844 UdpSocketImpl::Recv (uint32_t maxSize, uint32_t flags)
845 {
846  NS_LOG_FUNCTION (this << maxSize << flags);
847  if (m_deliveryQueue.empty () )
848  {
850  return 0;
851  }
852  Ptr<Packet> p = m_deliveryQueue.front ();
853  if (p->GetSize () <= maxSize)
854  {
855  m_deliveryQueue.pop ();
856  m_rxAvailable -= p->GetSize ();
857  }
858  else
859  {
860  p = 0;
861  }
862  return p;
863 }
864 
866 UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
867  Address &fromAddress)
868 {
869  NS_LOG_FUNCTION (this << maxSize << flags);
870  Ptr<Packet> packet = Recv (maxSize, flags);
871  if (packet != 0)
872  {
873  SocketAddressTag tag;
874  bool found;
875  found = packet->PeekPacketTag (tag);
876  NS_ASSERT (found);
877  fromAddress = tag.GetAddress ();
878  }
879  return packet;
880 }
881 
882 int
884 {
886  if (m_endPoint != 0)
887  {
889  }
890  else if (m_endPoint6 != 0)
891  {
893  }
894  else
895  { // It is possible to call this method on a socket without a name
896  // in which case, behavior is unspecified
897  // Should this return an InetSocketAddress or an Inet6SocketAddress?
898  address = InetSocketAddress (Ipv4Address::GetZero (), 0);
899  }
900  return 0;
901 }
902 
903 int
904 UdpSocketImpl::MulticastJoinGroup (uint32_t interface, const Address &groupAddress)
905 {
906  NS_LOG_FUNCTION (interface << groupAddress);
907  /*
908  1) sanity check interface
909  2) sanity check that it has not been called yet on this interface/group
910  3) determine address family of groupAddress
911  4) locally store a list of (interface, groupAddress)
912  5) call ipv4->MulticastJoinGroup () or Ipv6->MulticastJoinGroup ()
913  */
914  return 0;
915 }
916 
917 int
918 UdpSocketImpl::MulticastLeaveGroup (uint32_t interface, const Address &groupAddress)
919 {
920  NS_LOG_FUNCTION (interface << groupAddress);
921  /*
922  1) sanity check interface
923  2) determine address family of groupAddress
924  3) delete from local list of (interface, groupAddress); raise a LOG_WARN
925  if not already present (but return 0)
926  5) call ipv4->MulticastLeaveGroup () or Ipv6->MulticastLeaveGroup ()
927  */
928  return 0;
929 }
930 
931 void
933 {
934  NS_LOG_FUNCTION (netdevice);
935 
936  Socket::BindToNetDevice (netdevice); // Includes sanity check
937  if (m_endPoint == 0)
938  {
939  if (Bind () == -1)
940  {
941  NS_ASSERT (m_endPoint == 0);
942  return;
943  }
944  NS_ASSERT (m_endPoint != 0);
945  }
946  m_endPoint->BindToNetDevice (netdevice);
947 
948  if (m_endPoint6 == 0)
949  {
950  if (Bind6 () == -1)
951  {
952  NS_ASSERT (m_endPoint6 == 0);
953  return;
954  }
955  NS_ASSERT (m_endPoint6 != 0);
956  }
957  m_endPoint6->BindToNetDevice (netdevice);
958  return;
959 }
960 
961 void
963  Ptr<Ipv4Interface> incomingInterface)
964 {
965  NS_LOG_FUNCTION (this << packet << header << port);
966 
967  if (m_shutdownRecv)
968  {
969  return;
970  }
971 
972  // Should check via getsockopt ()..
973  if (IsRecvPktInfo ())
974  {
975  Ipv4PacketInfoTag tag;
976  packet->RemovePacketTag (tag);
977  tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
978  packet->AddPacketTag (tag);
979  }
980 
981  //Check only version 4 options
982  if (IsIpRecvTos ())
983  {
984  SocketIpTosTag ipTosTag;
985  ipTosTag.SetTos (header.GetTos ());
986  packet->AddPacketTag (ipTosTag);
987  }
988 
989  if (IsIpRecvTtl ())
990  {
991  SocketIpTtlTag ipTtlTag;
992  ipTtlTag.SetTtl (header.GetTtl ());
993  packet->AddPacketTag (ipTtlTag);
994  }
995 
996  if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
997  {
999  SocketAddressTag tag;
1000  tag.SetAddress (address);
1001  packet->AddPacketTag (tag);
1002  m_deliveryQueue.push (packet);
1003  m_rxAvailable += packet->GetSize ();
1004  NotifyDataRecv ();
1005  }
1006  else
1007  {
1008  // In general, this case should not occur unless the
1009  // receiving application reads data from this socket slowly
1010  // in comparison to the arrival rate
1011  //
1012  // drop and trace packet
1013  NS_LOG_WARN ("No receive buffer space available. Drop.");
1014  m_dropTrace (packet);
1015  }
1016 }
1017 
1018 void
1019 UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
1020 {
1021  NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << port);
1022 
1023  if (m_shutdownRecv)
1024  {
1025  return;
1026  }
1027 
1028  // Should check via getsockopt ()..
1029  if (IsRecvPktInfo ())
1030  {
1031  Ipv6PacketInfoTag tag;
1032  packet->RemovePacketTag (tag);
1033  tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
1034  packet->AddPacketTag (tag);
1035  }
1036 
1037  //Check only version 6 options
1038  if (IsIpv6RecvTclass ())
1039  {
1040  SocketIpv6TclassTag ipTclassTag;
1041  ipTclassTag.SetTclass (header.GetTrafficClass ());
1042  packet->AddPacketTag (ipTclassTag);
1043  }
1044 
1045  if (IsIpv6RecvHopLimit ())
1046  {
1047  SocketIpv6HopLimitTag ipHopLimitTag;
1048  ipHopLimitTag.SetHopLimit (header.GetHopLimit ());
1049  packet->AddPacketTag (ipHopLimitTag);
1050  }
1051 
1052  if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
1053  {
1055  SocketAddressTag tag;
1056  tag.SetAddress (address);
1057  packet->AddPacketTag (tag);
1058  m_deliveryQueue.push (packet);
1059  m_rxAvailable += packet->GetSize ();
1060  NotifyDataRecv ();
1061  }
1062  else
1063  {
1064  // In general, this case should not occur unless the
1065  // receiving application reads data from this socket slowly
1066  // in comparison to the arrival rate
1067  //
1068  // drop and trace packet
1069  NS_LOG_WARN ("No receive buffer space available. Drop.");
1070  m_dropTrace (packet);
1071  }
1072 }
1073 
1074 void
1075 UdpSocketImpl::ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl,
1076  uint8_t icmpType, uint8_t icmpCode,
1077  uint32_t icmpInfo)
1078 {
1079  NS_LOG_FUNCTION (this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
1080  (uint32_t)icmpCode << icmpInfo);
1081  if (!m_icmpCallback.IsNull ())
1082  {
1083  m_icmpCallback (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
1084  }
1085 }
1086 
1087 void
1088 UdpSocketImpl::ForwardIcmp6 (Ipv6Address icmpSource, uint8_t icmpTtl,
1089  uint8_t icmpType, uint8_t icmpCode,
1090  uint32_t icmpInfo)
1091 {
1092  NS_LOG_FUNCTION (this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
1093  (uint32_t)icmpCode << icmpInfo);
1094  if (!m_icmpCallback6.IsNull ())
1095  {
1096  m_icmpCallback6 (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
1097  }
1098 }
1099 
1100 void
1102 {
1103  m_rcvBufSize = size;
1104 }
1105 
1106 uint32_t
1108 {
1109  return m_rcvBufSize;
1110 }
1111 
1112 void
1114 {
1115  m_ipMulticastTtl = ipTtl;
1116 }
1117 
1118 uint8_t
1120 {
1121  return m_ipMulticastTtl;
1122 }
1123 
1124 void
1126 {
1127  m_ipMulticastIf = ipIf;
1128 }
1129 
1130 int32_t
1132 {
1133  return m_ipMulticastIf;
1134 }
1135 
1136 void
1138 {
1139  m_ipMulticastLoop = loop;
1140 }
1141 
1142 bool
1144 {
1145  return m_ipMulticastLoop;
1146 }
1147 
1148 void
1150 {
1151  m_mtuDiscover = discover;
1152 }
1153 bool
1155 {
1156  return m_mtuDiscover;
1157 }
1158 
1159 bool
1161 {
1162  m_allowBroadcast = allowBroadcast;
1163  return true;
1164 }
1165 
1166 bool
1168 {
1169  return m_allowBroadcast;
1170 }
1171 
1172 
1173 } // namespace ns3
static bool IsMatchingType(const Address &address)
If the Address matches the type.
void SetSource(Ipv4Address source)
Definition: ipv4-header.cc:285
Ipv6Address GetLocalAddress()
Get the local address.
(abstract) base class of all UdpSockets
Definition: udp-socket.h:46
uint8_t GetTrafficClass(void) const
Get the "Traffic class" field.
Definition: ipv6-header.cc:51
bool m_shutdownSend
Send no longer allowed.
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition: socket.cc:822
static const uint32_t MAX_IPV4_UDP_DATAGRAM_SIZE
Maximum UDP datagram size.
static Ipv4Mask GetOnes(void)
Ipv6Address GetIpv6(void) const
Get the IPv6 address.
virtual bool GetAllowBroadcast() const
Query whether broadcast datagram transmissions are allowed.
bool IsManualIpTtl(void) const
Checks if the socket has a specific IPv4 TTL set.
Definition: socket.cc:383
Introspection did not find any typical Config paths.
Definition: ipv6-header.h:33
an Inet address class
Ipv4Address GetIpv4(void) const
void SetDestination(Ipv4Address destination)
Definition: ipv4-header.cc:298
static Ipv4Address GetAny(void)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void Destroy(void)
Kill this socket by zeroing its attributes (IPv4)
bool IsIpv6RecvHopLimit(void) const
Ask if the socket is currently passing information about IPv6 Hop Limit up the stack.
Definition: socket.cc:508
Ptr< UdpL4Protocol > m_udp
the associated UDP L4 protocol
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
virtual bool GetIpMulticastLoop(void) const
Get the IP multicast loop capability.
Ipv4Mask GetMask(void) const
Get the network mask.
virtual uint8_t GetIpTtl(void) const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:471
Ipv4EndPoint * m_endPoint
the IPv4 endpoint
uint8_t GetIpTos(void) const
Query the value of IP Type of Service of this socket.
Definition: socket.cc:404
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer...
Definition: socket.h:1047
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
enum SocketErrno m_errno
Socket error code.
virtual void SetIpMulticastIf(int32_t ipIf)
Set the IP multicast interface.
Ipv4Address GetLocal(void) const
Get the local address.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:455
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:80
bool m_allowBroadcast
Allow send broadcast packets.
void NotifyDataRecv(void)
Notify through the callback (if set) that some data have been received.
Definition: socket.cc:305
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:226
void SetRxCallback(Callback< void, Ptr< Packet >, Ipv4Header, uint16_t, Ptr< Ipv4Interface > > callback)
Set the reception callback.
Ptr< Packet > Recv(void)
Read a single packet from the socket.
Definition: socket.cc:175
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback.
std::queue< Ptr< Packet > > m_deliveryQueue
Queue for incoming packets.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:822
void SetAddress(Address addr)
Set the tag's address.
Definition: socket.cc:523
Ipv4Address GetDestination(void) const
Definition: ipv4-header.cc:304
virtual int Close(void)
Close a socket.
#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
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
virtual uint8_t GetIpMulticastTtl(void) const
Get the IP multicast TTL.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:786
void SetNextHeader(uint8_t next)
Set the "Next header" field.
Definition: ipv6-header.cc:76
bool IsManualIpTos(void) const
Checks if the socket has a specific IPv4 ToS set.
Definition: socket.cc:371
uint32_t m_rxAvailable
Number of available bytes to be received.
bool IsMulticast(void) const
void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
virtual uint8_t GetIpv6HopLimit(void) const
Query the value of IP Hop Limit field of this socket.
Definition: socket.cc:496
Ipv4Address GetSource(void) const
Definition: ipv4-header.cc:291
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
SocketType
Enumeration of the possible socket types.
Definition: socket.h:104
void SetProtocol(uint8_t num)
Definition: ipv4-header.cc:278
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:765
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
Definition: socket.h:999
virtual void SetRcvBufSize(uint32_t size)
Set the receiving buffer size.
bool IsRecvPktInfo() const
Get status indicating whether enable/disable packet information to socket.
Definition: socket.cc:364
A sockets interface to UDP.
bool m_connected
Connection established.
Ipv4Address GetSubnetDirectedBroadcast(Ipv4Mask const &mask) const
Generate subnet-directed broadcast address corresponding to mask.
void ForwardIcmp6(Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
Called by the L3 protocol when it received an ICMPv6 packet to pass on to TCP.
uint16_t port
Definition: dsdv-manet.cc:44
a polymophic address class
Definition: address.h:90
virtual int Bind(void)
Allocate a local IPv4 endpoint for this socket.
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback.
AttributeValue implementation for Callback.
Definition: callback.h:1871
void ForwardUp(Ptr< Packet > packet, Ipv4Header header, uint16_t port, Ptr< Ipv4Interface > incomingInterface)
Called by the L3 protocol when it received a packet to pass on to TCP.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
virtual enum SocketErrno GetErrno(void) const
Get last error number.
Ptr< NetDevice > GetOutputDevice(void) const
Definition: ipv4-route.cc:84
bool IsIpRecvTos(void) const
Ask if the socket is currently passing information about IP Type of Service up the stack...
Definition: socket.cc:416
Packet header for IPv4.
Definition: ipv4-header.h:31
virtual int ShutdownRecv(void)
virtual int GetSockName(Address &address) const
Get socket address.
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:844
void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
virtual int MulticastLeaveGroup(uint32_t interfaceIndex, const Address &groupAddress)
Corresponds to socket option MCAST_LEAVE_GROUP.
int DoSendTo(Ptr< Packet > p, const Address &daddr)
Send a packet to a specific destination.
void ForwardIcmp(Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
Called by the L3 protocol when it received an ICMP packet to pass on to TCP.
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback6
ICMPv6 callback.
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:584
int DoSend(Ptr< Packet > p)
Send a packet.
uint16_t GetLocalPort()
Get the local port.
void SetNode(Ptr< Node > node)
Set the associated node.
virtual uint32_t GetRcvBufSize(void) const
Get the receiving buffer size.
virtual uint32_t GetRxAvailable(void) const
Return number of bytes which can be returned from one or multiple calls to Recv.
virtual int Bind6(void)
Allocate a local IPv6 endpoint for this socket.
UdpSocketImpl()
Create an unbound udp socket.
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
virtual int MulticastJoinGroup(uint32_t interfaceIndex, const Address &groupAddress)
Corresponds to socket option MCAST_JOIN_GROUP.
Ptr< const AttributeAccessor > MakeCallbackAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: callback.h:1913
Ipv4Address GetLocalAddress(void)
Get the local address.
bool IsBroadcast(void) const
uint8_t m_ipMulticastTtl
Multicast TTL.
Address m_defaultAddress
Default address.
virtual enum SocketType GetSocketType(void) const
An Inet6 address class.
This class implements a tag that carries an address of a packet across the socket interface...
Definition: socket.h:951
virtual void SetMtuDiscover(bool discover)
Set the MTU discover capability.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1480
virtual int32_t GetIpMulticastIf(void) const
Get the IP multicast interface.
bool IsManualIpv6Tclass(void) const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:377
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:285
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
Ipv4Address GetSource(void) const
Definition: ipv4-route.cc:56
void Destroy6(void)
Kill this socket by zeroing its attributes (IPv6)
static bool IsMatchingType(const Address &address)
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
int FinishBind(void)
Finish the binding process.
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition: socket.cc:645
static TypeId GetTypeId(void)
Get the type ID.
void NotifyConnectionSucceeded(void)
Notify through the callback (if set) that the connection has been established.
Definition: socket.cc:217
Access to the Ipv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
bool IsManualIpv6HopLimit(void) const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition: socket.cc:389
virtual void SetIpMulticastLoop(bool loop)
Set the IP multicast loop capability.
uint8_t GetHopLimit(void) const
Get the "Hop limit" field (TTL).
Definition: ipv6-header.cc:91
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host.
bool m_shutdownRecv
Receive no longer allowed.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Ptr< Node > m_node
the associated node
void SetIcmpCallback(Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
Set the ICMP callback.
indicates whether the socket has IPV6_TCLASS set.
Definition: socket.h:1192
uint8_t GetIpv6Tclass(void) const
Query the value of IPv6 Traffic Class field of this socket.
Definition: socket.cc:446
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
static Ipv4Address GetZero(void)
bool IsIpv6RecvTclass(void) const
Ask if the socket is currently passing information about IPv6 Traffic Class up the stack...
Definition: socket.cc:458
Ptr< const AttributeChecker > MakeCallbackChecker(void)
Definition: callback.cc:75
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: socket.cc:330
This class implements Linux struct pktinfo in order to deliver ancillary information to the socket in...
virtual int ShutdownSend(void)
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:90
void SetSourceAddress(Ipv6Address src)
Set the "Source address" field.
Definition: ipv6-header.cc:96
bool IsIpRecvTtl(void) const
Ask if the socket is currently passing information about IP_TTL up the stack.
Definition: socket.cc:483
void Disable(void)
Disables the DF (Don't Fragment) flag.
Definition: socket.cc:706
Describes an IPv6 address.
Definition: ipv6-address.h:47
void ForwardUp6(Ptr< Packet > packet, Ipv6Header header, uint16_t port, Ptr< Ipv6Interface > incomingInterface)
Called by the L3 protocol when it received a packet to pass on to TCP.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
virtual uint32_t GetTxAvailable(void) const
Returns the number of bytes which can be sent in a single call to Send.
Ipv4Address GetBroadcast(void) const
Get the broadcast address.
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:914
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed.
a class to store IPv4 address information on an interface
uint32_t m_rcvBufSize
Receive buffer size.
uint16_t GetLocalPort(void)
Get the local port.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:228
Ptr< NetDevice > GetDevice(void) const
Address GetAddress(void) const
Get the tag's address.
Definition: socket.cc:530
void SetRxEnabled(bool enabled)
Enable or Disable the endpoint Rx capability.
void SetUdp(Ptr< UdpL4Protocol > udp)
Set the associated UDP L4 protocol.
bool m_ipMulticastLoop
Allow multicast loop.
virtual int Listen(void)
Listen for incoming connections.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:829
Ipv6Address GetSourceAddress(void) const
Get the "Source address" field.
Definition: ipv6-header.cc:101
indicates whether packets should be sent out with the DF (Don't Fragment) flag set.
Definition: socket.h:1095
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
uint16_t m_defaultPort
Default port.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &address)
Send data to a specified peer.
Ipv6EndPoint * m_endPoint6
the IPv6 endpoint
void SetRxCallback(Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > > callback)
Set the reception callback.
static bool IsMatchingType(const Address &addr)
If the address match.
void Enable(void)
Enables the DF (Don't Fragment) flag.
Definition: socket.cc:700
uint16_t GetPort(void) const
Get the port.
void DeallocateEndPoint(void)
Deallocate m_endPoint and m_endPoint6.
Ipv4Address GetIpv4MappedAddress() const
Return the Ipv4 address.
int32_t m_ipMulticastIf
Multicast Interface.
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_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:220
uint16_t GetPort(void) const
uint8_t GetTtl(void) const
Definition: ipv4-header.cc:265
uint8_t GetTos(void) const
Definition: ipv4-header.cc:194
This class implements a tag that carries socket ancillary data to the socket interface.
static Ipv4Address ConvertFrom(const Address &address)
void SetRxEnabled(bool enabled)
Enable or Disable the endpoint Rx capability.
tuple address
Definition: first.py:37
TracedCallback< Ptr< const Packet > > m_dropTrace
Trace for dropped packets.
indicates whether the socket has IP_TOS set.
Definition: socket.h:1145
void SetIcmpCallback(Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
Set the ICMP callback.
bool IsIpv4MappedAddress() const
If the address is an IPv4-mapped address.
a unique identifier for an interface.
Definition: type-id.h:58
static const uint8_t PROT_NUMBER
protocol number (0x11)
bool m_mtuDiscover
Allow MTU discovery.
void SetDestinationAddress(Ipv6Address dst)
Set the "Destination address" field.
Definition: ipv6-header.cc:106
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
void SetRecvIf(uint32_t ifindex)
Set the tag's receiving interface.
static bool IsMatchingType(const Address &address)
Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback
ICMP callback.
Ipv6Address GetDestinationAddress(void) const
Get the "Destination address" field.
Definition: ipv6-header.cc:111
static Ipv6Address ConvertFrom(const Address &address)
Convert the Address object into an Ipv6Address ones.
virtual bool GetMtuDiscover(void) const
Get the MTU discover capability.
virtual void SetIpMulticastTtl(uint8_t ipTtl)
Set the IP multicast TTL.
virtual Ptr< Node > GetNode(void) const
Return the node this socket is associated with.
void SetRecvIf(uint32_t ifindex)
Set the tag's receiving interface.