A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 NS_LOG_COMPONENT_DEFINE ("UdpSocketImpl");
43 
44 namespace ns3 {
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  .AddConstructor<UdpSocketImpl> ()
60  .AddTraceSource ("Drop", "Drop UDP packet due to receive buffer overflow",
62  .AddAttribute ("IcmpCallback", "Callback invoked whenever an icmp error is received on this socket.",
63  CallbackValue (),
64  MakeCallbackAccessor (&UdpSocketImpl::m_icmpCallback),
65  MakeCallbackChecker ())
66  .AddAttribute ("IcmpCallback6", "Callback invoked whenever an icmpv6 error is received on this socket.",
67  CallbackValue (),
68  MakeCallbackAccessor (&UdpSocketImpl::m_icmpCallback6),
69  MakeCallbackChecker ())
70  ;
71  return tid;
72 }
73 
75  : m_endPoint (0),
76  m_endPoint6 (0),
77  m_node (0),
78  m_udp (0),
79  m_errno (ERROR_NOTERROR),
80  m_shutdownSend (false),
81  m_shutdownRecv (false),
82  m_connected (false),
83  m_rxAvailable (0)
84 {
86  m_allowBroadcast = false;
87 }
88 
90 {
92 
94  m_node = 0;
100  if (m_endPoint != 0)
101  {
102  NS_ASSERT (m_udp != 0);
111  NS_ASSERT (m_endPoint != 0);
112  m_udp->DeAllocate (m_endPoint);
113  NS_ASSERT (m_endPoint == 0);
114  }
115  if (m_endPoint6 != 0)
116  {
117  NS_ASSERT (m_udp != 0);
126  NS_ASSERT (m_endPoint6 != 0);
127  m_udp->DeAllocate (m_endPoint6);
128  NS_ASSERT (m_endPoint6 == 0);
129  }
130  m_udp = 0;
131 }
132 
133 void
135 {
137  m_node = node;
138 
139 }
140 void
142 {
144  m_udp = udp;
145 }
146 
147 
150 {
152  return m_errno;
153 }
154 
157 {
158  return NS3_SOCK_DGRAM;
159 }
160 
161 Ptr<Node>
163 {
165  return m_node;
166 }
167 
168 void
170 {
172  m_endPoint = 0;
173 }
174 
175 void
177 {
179  m_endPoint6 = 0;
180 }
181 
182 /* Deallocate the end point and cancel all the timers */
183 void
185 {
186  if (m_endPoint != 0)
187  {
188  m_endPoint->SetDestroyCallback (MakeNullCallback<void> ());
189  m_udp->DeAllocate (m_endPoint);
190  m_endPoint = 0;
191  }
192  if (m_endPoint6 != 0)
193  {
194  m_endPoint6->SetDestroyCallback (MakeNullCallback<void> ());
195  m_udp->DeAllocate (m_endPoint6);
196  m_endPoint6 = 0;
197  }
198 }
199 
200 
201 int
203 {
205  bool done = false;
206  if (m_endPoint != 0)
207  {
211  done = true;
212  }
213  if (m_endPoint6 != 0)
214  {
218  done = true;
219  }
220  if (done)
221  {
222  return 0;
223  }
224  return -1;
225 }
226 
227 int
229 {
231  m_endPoint = m_udp->Allocate ();
232  return FinishBind ();
233 }
234 
235 int
237 {
239  m_endPoint6 = m_udp->Allocate6 ();
240  return FinishBind ();
241 }
242 
243 int
245 {
246  NS_LOG_FUNCTION (this << address);
247 
248  if (InetSocketAddress::IsMatchingType (address))
249  {
250  NS_ASSERT_MSG (m_endPoint == 0, "Endpoint already allocated (maybe you used BindToNetDevice before Bind).");
251 
253  Ipv4Address ipv4 = transport.GetIpv4 ();
254  uint16_t port = transport.GetPort ();
255  if (ipv4 == Ipv4Address::GetAny () && port == 0)
256  {
257  m_endPoint = m_udp->Allocate ();
258  }
259  else if (ipv4 == Ipv4Address::GetAny () && port != 0)
260  {
261  m_endPoint = m_udp->Allocate (port);
262  }
263  else if (ipv4 != Ipv4Address::GetAny () && port == 0)
264  {
265  m_endPoint = m_udp->Allocate (ipv4);
266  }
267  else if (ipv4 != Ipv4Address::GetAny () && port != 0)
268  {
269  m_endPoint = m_udp->Allocate (ipv4, port);
270  }
271  if (0 == m_endPoint)
272  {
274  return -1;
275  }
276  }
277  else if (Inet6SocketAddress::IsMatchingType (address))
278  {
279  NS_ASSERT_MSG (m_endPoint == 0, "Endpoint already allocated (maybe you used BindToNetDevice before Bind).");
280 
282  Ipv6Address ipv6 = transport.GetIpv6 ();
283  uint16_t port = transport.GetPort ();
284  if (ipv6 == Ipv6Address::GetAny () && port == 0)
285  {
286  m_endPoint6 = m_udp->Allocate6 ();
287  }
288  else if (ipv6 == Ipv6Address::GetAny () && port != 0)
289  {
290  m_endPoint6 = m_udp->Allocate6 (port);
291  }
292  else if (ipv6 != Ipv6Address::GetAny () && port == 0)
293  {
294  m_endPoint6 = m_udp->Allocate6 (ipv6);
295  }
296  else if (ipv6 != Ipv6Address::GetAny () && port != 0)
297  {
298  m_endPoint6 = m_udp->Allocate6 (ipv6, port);
299  }
300  if (0 == m_endPoint6)
301  {
303  return -1;
304  }
305  }
306  else
307  {
308  NS_LOG_ERROR ("Not IsMatchingType");
310  return -1;
311  }
312 
313  return FinishBind ();
314 }
315 
316 int
318 {
320  m_shutdownSend = true;
321  return 0;
322 }
323 
324 int
326 {
328  m_shutdownRecv = true;
329  return 0;
330 }
331 
332 int
334 {
336  if (m_shutdownRecv == true && m_shutdownSend == true)
337  {
339  return -1;
340  }
341  m_shutdownRecv = true;
342  m_shutdownSend = true;
344  return 0;
345 }
346 
347 int
349 {
350  NS_LOG_FUNCTION (this << address);
351  if (InetSocketAddress::IsMatchingType(address) == true)
352  {
354  m_defaultAddress = Address(transport.GetIpv4 ());
355  m_defaultPort = transport.GetPort ();
356  m_connected = true;
358  }
359  else if (Inet6SocketAddress::IsMatchingType(address) == true)
360  {
362  m_defaultAddress = Address(transport.GetIpv6 ());
363  m_defaultPort = transport.GetPort ();
364  m_connected = true;
366  }
367  else
368  {
369  return -1;
370  }
371 
372  return 0;
373 }
374 
375 int
377 {
379  return -1;
380 }
381 
382 int
383 UdpSocketImpl::Send (Ptr<Packet> p, uint32_t flags)
384 {
385  NS_LOG_FUNCTION (this << p << flags);
386 
387  if (!m_connected)
388  {
390  return -1;
391  }
392 
393  return DoSend (p);
394 }
395 
396 int
398 {
399  NS_LOG_FUNCTION (this << p);
401  {
402  if (Bind () == -1)
403  {
404  NS_ASSERT (m_endPoint == 0);
405  return -1;
406  }
407  NS_ASSERT (m_endPoint != 0);
408  }
410  {
411  if (Bind6 () == -1)
412  {
413  NS_ASSERT (m_endPoint6 == 0);
414  return -1;
415  }
416  NS_ASSERT (m_endPoint6 != 0);
417  }
418  if (m_shutdownSend)
419  {
421  return -1;
422  }
423 
424  return DoSendTo (p, (const Address)m_defaultAddress);
425 }
426 
427 int
429 {
430  NS_LOG_FUNCTION (this << p << address);
431 
432  if (!m_connected)
433  {
434  NS_LOG_LOGIC ("Not connected");
435  if (InetSocketAddress::IsMatchingType(address) == true)
436  {
438  Ipv4Address ipv4 = transport.GetIpv4 ();
439  uint16_t port = transport.GetPort ();
440  return DoSendTo (p, ipv4, port);
441  }
442  else if (Inet6SocketAddress::IsMatchingType(address) == true)
443  {
445  Ipv6Address ipv6 = transport.GetIpv6 ();
446  uint16_t port = transport.GetPort ();
447  return DoSendTo (p, ipv6, port);
448  }
449  else
450  {
451  return -1;
452  }
453  }
454  else
455  {
456  // connected UDP socket must use default addresses
457  NS_LOG_LOGIC ("Connected");
459  {
461  }
463  {
465  }
466  }
468  return(-1);
469 }
470 
471 int
473 {
474  NS_LOG_FUNCTION (this << p << dest << port);
475  if (m_boundnetdevice)
476  {
477  NS_LOG_LOGIC ("Bound interface number " << m_boundnetdevice->GetIfIndex ());
478  }
479  if (m_endPoint == 0)
480  {
481  if (Bind () == -1)
482  {
483  NS_ASSERT (m_endPoint == 0);
484  return -1;
485  }
486  NS_ASSERT (m_endPoint != 0);
487  }
488  if (m_shutdownSend)
489  {
491  return -1;
492  }
493 
494  if (p->GetSize () > GetTxAvailable () )
495  {
497  return -1;
498  }
499 
500  if (IsManualIpTos ())
501  {
502  SocketIpTosTag ipTosTag;
503  ipTosTag.SetTos (GetIpTos ());
504  p->AddPacketTag (ipTosTag);
505  }
506 
507  Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
508 
509  // Locally override the IP TTL for this socket
510  // We cannot directly modify the TTL at this stage, so we set a Packet tag
511  // The destination can be either multicast, unicast/anycast, or
512  // either all-hosts broadcast or limited (subnet-directed) broadcast.
513  // For the latter two broadcast types, the TTL will later be set to one
514  // irrespective of what is set in these socket options. So, this tagging
515  // may end up setting the TTL of a limited broadcast packet to be
516  // the same as a unicast, but it will be fixed further down the stack
517  if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
518  {
519  SocketIpTtlTag tag;
520  tag.SetTtl (m_ipMulticastTtl);
521  p->AddPacketTag (tag);
522  }
523  else if (IsManualIpTtl () && GetIpTtl () != 0 && !dest.IsMulticast () && !dest.IsBroadcast ())
524  {
525  SocketIpTtlTag tag;
526  tag.SetTtl (GetIpTtl ());
527  p->AddPacketTag (tag);
528  }
529  {
531  bool found = p->RemovePacketTag (tag);
532  if (!found)
533  {
534  if (m_mtuDiscover)
535  {
536  tag.Enable ();
537  }
538  else
539  {
540  tag.Disable ();
541  }
542  p->AddPacketTag (tag);
543  }
544  }
545  //
546  // If dest is set to the limited broadcast address (all ones),
547  // convert it to send a copy of the packet out of every
548  // interface as a subnet-directed broadcast.
549  // Exception: if the interface has a /32 address, there is no
550  // valid subnet-directed broadcast, so send it as limited broadcast
551  // Note also that some systems will only send limited broadcast packets
552  // out of the "default" interface; here we send it out all interfaces
553  //
554  if (dest.IsBroadcast ())
555  {
556  if (!m_allowBroadcast)
557  {
559  return -1;
560  }
561  NS_LOG_LOGIC ("Limited broadcast start.");
562  for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ )
563  {
564  // Get the primary address
565  Ipv4InterfaceAddress iaddr = ipv4->GetAddress (i, 0);
566  Ipv4Address addri = iaddr.GetLocal ();
567  if (addri == Ipv4Address ("127.0.0.1"))
568  continue;
569  // Check if interface-bound socket
570  if (m_boundnetdevice)
571  {
572  if (ipv4->GetNetDevice (i) != m_boundnetdevice)
573  continue;
574  }
575  Ipv4Mask maski = iaddr.GetMask ();
576  if (maski == Ipv4Mask::GetOnes ())
577  {
578  // if the network mask is 255.255.255.255, do not convert dest
579  NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << dest
580  << " (mask is " << maski << ")");
581  m_udp->Send (p->Copy (), addri, dest,
583  NotifyDataSent (p->GetSize ());
585  }
586  else
587  {
588  // Convert to subnet-directed broadcast
589  Ipv4Address bcast = addri.GetSubnetDirectedBroadcast (maski);
590  NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << bcast
591  << " (mask is " << maski << ")");
592  m_udp->Send (p->Copy (), addri, bcast,
594  NotifyDataSent (p->GetSize ());
596  }
597  }
598  NS_LOG_LOGIC ("Limited broadcast end.");
599  return p->GetSize ();
600  }
602  {
603  m_udp->Send (p->Copy (), m_endPoint->GetLocalAddress (), dest,
604  m_endPoint->GetLocalPort (), port, 0);
605  NotifyDataSent (p->GetSize ());
607  return p->GetSize ();
608  }
609  else if (ipv4->GetRoutingProtocol () != 0)
610  {
611  Ipv4Header header;
612  header.SetDestination (dest);
614  Socket::SocketErrno errno_;
615  Ptr<Ipv4Route> route;
616  Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a specific device
617  // TBD-- we could cache the route and just check its validity
618  route = ipv4->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_);
619  if (route != 0)
620  {
621  NS_LOG_LOGIC ("Route exists");
622  if (!m_allowBroadcast)
623  {
624  uint32_t outputIfIndex = ipv4->GetInterfaceForDevice (route->GetOutputDevice ());
625  uint32_t ifNAddr = ipv4->GetNAddresses (outputIfIndex);
626  for (uint32_t addrI = 0; addrI < ifNAddr; ++addrI)
627  {
628  Ipv4InterfaceAddress ifAddr = ipv4->GetAddress (outputIfIndex, addrI);
629  if (dest == ifAddr.GetBroadcast ())
630  {
632  return -1;
633  }
634  }
635  }
636 
637  header.SetSource (route->GetSource ());
638  m_udp->Send (p->Copy (), header.GetSource (), header.GetDestination (),
639  m_endPoint->GetLocalPort (), port, route);
640  NotifyDataSent (p->GetSize ());
641  return p->GetSize ();
642  }
643  else
644  {
645  NS_LOG_LOGIC ("No route to destination");
646  NS_LOG_ERROR (errno_);
647  m_errno = errno_;
648  return -1;
649  }
650  }
651  else
652  {
653  NS_LOG_ERROR ("ERROR_NOROUTETOHOST");
655  return -1;
656  }
657 
658  return 0;
659 }
660 
661 int
663 {
664  NS_LOG_FUNCTION (this << p << dest << port);
665 
666  if (dest.IsIpv4MappedAddress ())
667  {
668  return (DoSendTo(p, dest.GetIpv4MappedAddress (), port));
669  }
670  if (m_boundnetdevice)
671  {
672  NS_LOG_LOGIC ("Bound interface number " << m_boundnetdevice->GetIfIndex ());
673  }
674  if (m_endPoint6 == 0)
675  {
676  if (Bind6 () == -1)
677  {
678  NS_ASSERT (m_endPoint6 == 0);
679  return -1;
680  }
681  NS_ASSERT (m_endPoint6 != 0);
682  }
683  if (m_shutdownSend)
684  {
686  return -1;
687  }
688 
689  if (p->GetSize () > GetTxAvailable () )
690  {
692  return -1;
693  }
694 
695  if (IsManualIpv6Tclass ())
696  {
697  SocketIpv6TclassTag ipTclassTag;
698  ipTclassTag.SetTclass (GetIpv6Tclass ());
699  p->AddPacketTag (ipTclassTag);
700  }
701 
702  Ptr<Ipv6> ipv6 = m_node->GetObject<Ipv6> ();
703 
704  // Locally override the IP TTL for this socket
705  // We cannot directly modify the TTL at this stage, so we set a Packet tag
706  // The destination can be either multicast, unicast/anycast, or
707  // either all-hosts broadcast or limited (subnet-directed) broadcast.
708  // For the latter two broadcast types, the TTL will later be set to one
709  // irrespective of what is set in these socket options. So, this tagging
710  // may end up setting the TTL of a limited broadcast packet to be
711  // the same as a unicast, but it will be fixed further down the stack
712  if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
713  {
716  p->AddPacketTag (tag);
717  }
718  else if (IsManualIpv6HopLimit () && GetIpv6HopLimit () != 0 && !dest.IsMulticast ())
719  {
721  tag.SetHopLimit (GetIpv6HopLimit ());
722  p->AddPacketTag (tag);
723  }
724  // There is no analgous to an IPv4 broadcast address in IPv6.
725  // Instead, we use a set of link-local, site-local, and global
726  // multicast addresses. The Ipv6 routing layers should all
727  // provide an interface-specific route to these addresses such
728  // that we can treat these multicast addresses as "not broadcast"
729 
731  {
732  m_udp->Send (p->Copy (), m_endPoint6->GetLocalAddress (), dest,
733  m_endPoint6->GetLocalPort (), port, 0);
734  NotifyDataSent (p->GetSize ());
736  return p->GetSize ();
737  }
738  else if (ipv6->GetRoutingProtocol () != 0)
739  {
740  Ipv6Header header;
741  header.SetDestinationAddress (dest);
743  Socket::SocketErrno errno_;
744  Ptr<Ipv6Route> route;
745  Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a specific device
746  // TBD-- we could cache the route and just check its validity
747  route = ipv6->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_);
748  if (route != 0)
749  {
750  NS_LOG_LOGIC ("Route exists");
751  header.SetSourceAddress (route->GetSource ());
752  m_udp->Send (p->Copy (), header.GetSourceAddress (), header.GetDestinationAddress (),
753  m_endPoint6->GetLocalPort (), port, route);
754  NotifyDataSent (p->GetSize ());
755  return p->GetSize ();
756  }
757  else
758  {
759  NS_LOG_LOGIC ("No route to destination");
760  NS_LOG_ERROR (errno_);
761  m_errno = errno_;
762  return -1;
763  }
764  }
765  else
766  {
767  NS_LOG_ERROR ("ERROR_NOROUTETOHOST");
769  return -1;
770  }
771 
772  return 0;
773 }
774 
775 
776 // maximum message size for UDP broadcast is limited by MTU
777 // size of underlying link; we are not checking that now.
778 // \todo Check MTU size of underlying link
779 uint32_t
781 {
783  // No finite send buffer is modelled, but we must respect
784  // the maximum size of an IP datagram (65535 bytes - headers).
786 }
787 
788 int
790 {
791  NS_LOG_FUNCTION (this << p << flags << address);
792  if (InetSocketAddress::IsMatchingType (address))
793  {
794  if (IsManualIpTos ())
795  {
796  SocketIpTosTag ipTosTag;
797  ipTosTag.SetTos (GetIpTos ());
798  p->AddPacketTag (ipTosTag);
799  }
800 
802  Ipv4Address ipv4 = transport.GetIpv4 ();
803  uint16_t port = transport.GetPort ();
804  return DoSendTo (p, ipv4, port);
805  }
806  else if (Inet6SocketAddress::IsMatchingType (address))
807  {
808  if (IsManualIpv6Tclass ())
809  {
810  SocketIpv6TclassTag ipTclassTag;
811  ipTclassTag.SetTclass (GetIpv6Tclass ());
812  p->AddPacketTag (ipTclassTag);
813  }
814 
816  Ipv6Address ipv6 = transport.GetIpv6 ();
817  uint16_t port = transport.GetPort ();
818  return DoSendTo (p, ipv6, port);
819  }
820  return -1;
821 }
822 
823 uint32_t
825 {
827  // We separately maintain this state to avoid walking the queue
828  // every time this might be called
829  return m_rxAvailable;
830 }
831 
833 UdpSocketImpl::Recv (uint32_t maxSize, uint32_t flags)
834 {
835  NS_LOG_FUNCTION (this << maxSize << flags);
836  if (m_deliveryQueue.empty () )
837  {
839  return 0;
840  }
841  Ptr<Packet> p = m_deliveryQueue.front ();
842  if (p->GetSize () <= maxSize)
843  {
844  m_deliveryQueue.pop ();
845  m_rxAvailable -= p->GetSize ();
846  }
847  else
848  {
849  p = 0;
850  }
851  return p;
852 }
853 
855 UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
856  Address &fromAddress)
857 {
858  NS_LOG_FUNCTION (this << maxSize << flags);
859  Ptr<Packet> packet = Recv (maxSize, flags);
860  if (packet != 0)
861  {
862  SocketAddressTag tag;
863  bool found;
864  found = packet->PeekPacketTag (tag);
865  NS_ASSERT (found);
866  fromAddress = tag.GetAddress ();
867  }
868  return packet;
869 }
870 
871 int
873 {
875  if (m_endPoint != 0)
876  {
878  }
879  else if (m_endPoint6 != 0)
880  {
882  }
883  else
884  { // It is possible to call this method on a socket without a name
885  // in which case, behavior is unspecified
886  // Should this return an InetSocketAddress or an Inet6SocketAddress?
887  address = InetSocketAddress (Ipv4Address::GetZero (), 0);
888  }
889  return 0;
890 }
891 
892 int
893 UdpSocketImpl::MulticastJoinGroup (uint32_t interface, const Address &groupAddress)
894 {
895  NS_LOG_FUNCTION (interface << groupAddress);
896  /*
897  1) sanity check interface
898  2) sanity check that it has not been called yet on this interface/group
899  3) determine address family of groupAddress
900  4) locally store a list of (interface, groupAddress)
901  5) call ipv4->MulticastJoinGroup () or Ipv6->MulticastJoinGroup ()
902  */
903  return 0;
904 }
905 
906 int
907 UdpSocketImpl::MulticastLeaveGroup (uint32_t interface, const Address &groupAddress)
908 {
909  NS_LOG_FUNCTION (interface << groupAddress);
910  /*
911  1) sanity check interface
912  2) determine address family of groupAddress
913  3) delete from local list of (interface, groupAddress); raise a LOG_WARN
914  if not already present (but return 0)
915  5) call ipv4->MulticastLeaveGroup () or Ipv6->MulticastLeaveGroup ()
916  */
917  return 0;
918 }
919 
920 void
922 {
923  NS_LOG_FUNCTION (netdevice);
924 
925  Socket::BindToNetDevice (netdevice); // Includes sanity check
926  if (m_endPoint == 0)
927  {
928  if (Bind () == -1)
929  {
930  NS_ASSERT (m_endPoint == 0);
931  return;
932  }
933  NS_ASSERT (m_endPoint != 0);
934  }
935  m_endPoint->BindToNetDevice (netdevice);
936 
937  if (m_endPoint6 == 0)
938  {
939  if (Bind6 () == -1)
940  {
941  NS_ASSERT (m_endPoint6 == 0);
942  return;
943  }
944  NS_ASSERT (m_endPoint6 != 0);
945  }
946  m_endPoint6->BindToNetDevice (netdevice);
947  return;
948 }
949 
950 void
952  Ptr<Ipv4Interface> incomingInterface)
953 {
954  NS_LOG_FUNCTION (this << packet << header << port);
955 
956  if (m_shutdownRecv)
957  {
958  return;
959  }
960 
961  // Should check via getsockopt ()..
962  if (IsRecvPktInfo ())
963  {
964  Ipv4PacketInfoTag tag;
965  packet->RemovePacketTag (tag);
966  tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
967  packet->AddPacketTag (tag);
968  }
969 
970  //Check only version 4 options
971  if (IsIpRecvTos ())
972  {
973  SocketIpTosTag ipTosTag;
974  ipTosTag.SetTos (header.GetTos ());
975  packet->AddPacketTag (ipTosTag);
976  }
977 
978  if (IsIpRecvTtl ())
979  {
980  SocketIpTtlTag ipTtlTag;
981  ipTtlTag.SetTtl (header.GetTtl ());
982  packet->AddPacketTag (ipTtlTag);
983  }
984 
985  if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
986  {
988  SocketAddressTag tag;
989  tag.SetAddress (address);
990  packet->AddPacketTag (tag);
991  m_deliveryQueue.push (packet);
992  m_rxAvailable += packet->GetSize ();
993  NotifyDataRecv ();
994  }
995  else
996  {
997  // In general, this case should not occur unless the
998  // receiving application reads data from this socket slowly
999  // in comparison to the arrival rate
1000  //
1001  // drop and trace packet
1002  NS_LOG_WARN ("No receive buffer space available. Drop.");
1003  m_dropTrace (packet);
1004  }
1005 }
1006 
1007 void
1008 UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
1009 {
1010  NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << port);
1011 
1012  if (m_shutdownRecv)
1013  {
1014  return;
1015  }
1016 
1017  // Should check via getsockopt ()..
1018  if (IsRecvPktInfo ())
1019  {
1020  Ipv6PacketInfoTag tag;
1021  packet->RemovePacketTag (tag);
1022  tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
1023  packet->AddPacketTag (tag);
1024  }
1025 
1026  //Check only version 6 options
1027  if (IsIpv6RecvTclass ())
1028  {
1029  SocketIpv6TclassTag ipTclassTag;
1030  ipTclassTag.SetTclass (header.GetTrafficClass ());
1031  packet->AddPacketTag (ipTclassTag);
1032  }
1033 
1034  if (IsIpv6RecvHopLimit ())
1035  {
1036  SocketIpv6HopLimitTag ipHopLimitTag;
1037  ipHopLimitTag.SetHopLimit (header.GetHopLimit ());
1038  packet->AddPacketTag (ipHopLimitTag);
1039  }
1040 
1041  if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
1042  {
1044  SocketAddressTag tag;
1045  tag.SetAddress (address);
1046  packet->AddPacketTag (tag);
1047  m_deliveryQueue.push (packet);
1048  m_rxAvailable += packet->GetSize ();
1049  NotifyDataRecv ();
1050  }
1051  else
1052  {
1053  // In general, this case should not occur unless the
1054  // receiving application reads data from this socket slowly
1055  // in comparison to the arrival rate
1056  //
1057  // drop and trace packet
1058  NS_LOG_WARN ("No receive buffer space available. Drop.");
1059  m_dropTrace (packet);
1060  }
1061 }
1062 
1063 void
1064 UdpSocketImpl::ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl,
1065  uint8_t icmpType, uint8_t icmpCode,
1066  uint32_t icmpInfo)
1067 {
1068  NS_LOG_FUNCTION (this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
1069  (uint32_t)icmpCode << icmpInfo);
1070  if (!m_icmpCallback.IsNull ())
1071  {
1072  m_icmpCallback (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
1073  }
1074 }
1075 
1076 void
1077 UdpSocketImpl::ForwardIcmp6 (Ipv6Address icmpSource, uint8_t icmpTtl,
1078  uint8_t icmpType, uint8_t icmpCode,
1079  uint32_t icmpInfo)
1080 {
1081  NS_LOG_FUNCTION (this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
1082  (uint32_t)icmpCode << icmpInfo);
1083  if (!m_icmpCallback6.IsNull ())
1084  {
1085  m_icmpCallback6 (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
1086  }
1087 }
1088 
1089 void
1091 {
1092  m_rcvBufSize = size;
1093 }
1094 
1095 uint32_t
1097 {
1098  return m_rcvBufSize;
1099 }
1100 
1101 void
1103 {
1104  m_ipMulticastTtl = ipTtl;
1105 }
1106 
1107 uint8_t
1109 {
1110  return m_ipMulticastTtl;
1111 }
1112 
1113 void
1115 {
1116  m_ipMulticastIf = ipIf;
1117 }
1118 
1119 int32_t
1121 {
1122  return m_ipMulticastIf;
1123 }
1124 
1125 void
1127 {
1128  m_ipMulticastLoop = loop;
1129 }
1130 
1131 bool
1133 {
1134  return m_ipMulticastLoop;
1135 }
1136 
1137 void
1139 {
1140  m_mtuDiscover = discover;
1141 }
1142 bool
1144 {
1145  return m_mtuDiscover;
1146 }
1147 
1148 bool
1150 {
1151  m_allowBroadcast = allowBroadcast;
1152  return true;
1153 }
1154 
1155 bool
1157 {
1158  return m_allowBroadcast;
1159 }
1160 
1161 
1162 } // 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:816
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:382
Doxygen 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:507
Ptr< UdpL4Protocol > m_udp
the associated UDP L4 protocol
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:470
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:403
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 the class in the ns-3 factory.
Definition: object-base.h:38
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.
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:304
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:222
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:174
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:841
void SetAddress(Address addr)
Set the tag's address.
Definition: socket.cc:522
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:61
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:170
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:744
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:370
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:495
Ipv4Address GetSource(void) const
Definition: ipv4-header.cc:291
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
void SetProtocol(uint8_t num)
Definition: ipv4-header.cc:278
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:760
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
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
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:363
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:86
virtual int Bind(void)
Allocate a local IPv4 endpoint for this socket.
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback.
AttributeValue form of a Callback.
Definition: callback.h:1678
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.
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:415
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:863
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:582
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.
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:1283
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:376
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:284
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:233
int FinishBind(void)
Finish the binding process.
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition: socket.cc:642
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:216
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:388
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.
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
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:445
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:457
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: socket.cc:329
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:84
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:482
void Disable(void)
Disables the DF (Don't Fragment) flag.
Definition: socket.cc:702
Describes an IPv6 address.
Definition: ipv6-address.h:46
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:38
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:203
Ptr< NetDevice > GetDevice(void) const
Address GetAddress(void) const
Get the tag's address.
Definition: socket.cc:529
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:848
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:696
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:193
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)
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
Ptr< T > GetObject(void) const
Definition: object.h:362
void SetIcmpCallback(Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
Set the ICMP callback.
SocketType
Enumeration of the possible socket types.
Definition: socket.h:104
bool IsIpv4MappedAddress() const
If the address is an IPv4-mapped address.
a unique identifier for an interface.
Definition: type-id.h:49
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:294
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
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.