A Discrete-Event Network Simulator
API
virtual-udp-l4-protocol.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005 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: Miralem Mehic <miralem.mehic@ieee.org> after Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include "ns3/log.h"
22 #include "ns3/assert.h"
23 #include "ns3/packet.h"
24 #include "ns3/node.h"
25 #include "ns3/boolean.h"
26 #include "ns3/object-vector.h"
27 #include "ns3/ipv6.h"
28 #include "ns3/ipv4-route.h"
29 #include "ns3/ipv6-route.h"
30 #include "ns3/ipv6-header.h"
31 
33 #include "udp-header.h"
35 #include "ipv4-end-point-demux.h"
36 #include "ipv4-end-point.h"
37 #include "ipv6-end-point-demux.h"
38 #include "ipv6-end-point.h"
39 #include "ipv4-l3-protocol.h"
41 #include "ipv6-l3-protocol.h"
42 #include "virtual-udp-socket-impl.h"
44 
45 namespace ns3 {
46 
47 NS_LOG_COMPONENT_DEFINE ("VirtualUdpL4Protocol");
48 
49 NS_OBJECT_ENSURE_REGISTERED (VirtualUdpL4Protocol);
50 
51 /* see http://www.iana.org/assignments/protocol-numbers */
52 const uint8_t VirtualUdpL4Protocol::PROT_NUMBER = 17;
53 
54 TypeId
56 {
57  static TypeId tid = TypeId ("ns3::VirtualUdpL4Protocol")
59  .SetGroupName ("Internet")
60  .AddConstructor<VirtualUdpL4Protocol> ()
61  .AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
64  MakeObjectVectorChecker<VirtualUdpSocketImpl> ())
65  ;
66  return tid;
67 }
68 
71 {
73 }
74 
76 {
78 }
79 
80 void
82 {
83  m_node = node;
84 }
85 
86 /*
87  * This method is called by AddAgregate and completes the aggregation
88  * by setting the node in the udp stack and link it to the ipv4 object
89  * present in the node along with the socket factory
90  */
91 void
93 {
94  NS_LOG_FUNCTION (this);
95  Ptr<Node> node = this->GetObject<Node> ();
96  Ptr<Ipv4> ipv4 = this->GetObject<VirtualIpv4L3Protocol> ();
97  Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
98 
99  if (m_node == 0)
100  {
101  if ((node != 0) && (ipv4 != 0 || ipv6 != 0))
102  {
103  this->SetNode (node);
104  Ptr<VirtualUdpSocketFactoryImpl> udpFactory = CreateObject<VirtualUdpSocketFactoryImpl> ();
105  udpFactory->SetUdp (this);
106  node->AggregateObject (udpFactory);
107  }
108  }
109 
110  // We set at least one of our 2 down targets to the IPv4/IPv6 send
111  // functions. Since these functions have different prototypes, we
112  // need to keep track of whether we are connected to an IPv4 or
113  // IPv6 lower layer and call the appropriate one.
114 
115  if (ipv4 != 0 && m_downTarget.IsNull())
116  {
117  ipv4->Insert (this);
118  this->SetDownTarget (MakeCallback (&Ipv4::Send, ipv4));
119  }
120  if (ipv6 != 0 && m_downTarget6.IsNull())
121  {
122  ipv6->Insert (this);
123  this->SetDownTarget6 (MakeCallback (&Ipv6::Send, ipv6));
124  }
126 }
127 
128 int
130 {
131  return PROT_NUMBER;
132 }
133 
134 
135 void
137 {
139  for (std::vector<Ptr<VirtualUdpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
140  {
141  *i = 0;
142  }
143  m_sockets.clear ();
144 
145  if (m_endPoints != 0)
146  {
147  delete m_endPoints;
148  m_endPoints = 0;
149  }
150  if (m_endPoints6 != 0)
151  {
152  delete m_endPoints6;
153  m_endPoints6 = 0;
154  }
155  m_node = 0;
158 /*
159  = MakeNullCallback<void,Ptr<Packet>, Ipv4Address, Ipv4Address, uint8_t, Ptr<Ipv4Route> > ();
160 */
162 }
163 
166 {
168  Ptr<VirtualUdpSocketImpl> socket = CreateObject<VirtualUdpSocketImpl> ();
169  socket->SetNode (m_node);
170  socket->SetUdp (this);
171  m_sockets.push_back (socket);
172  return socket;
173 }
174 
175 Ipv4EndPoint *
177 {
178  NS_LOG_FUNCTION (this);
179  return m_endPoints->Allocate ();
180 }
181 
182 Ipv4EndPoint *
184 {
185  NS_LOG_FUNCTION (this << address);
186  return m_endPoints->Allocate (address);
187 }
188 
189 Ipv4EndPoint *
191 {
192  NS_LOG_FUNCTION (this << boundNetDevice << port);
193  return m_endPoints->Allocate (boundNetDevice, port);
194 }
195 
196 Ipv4EndPoint *
198 {
199  NS_LOG_FUNCTION (this << boundNetDevice << address << port);
200  return m_endPoints->Allocate (boundNetDevice, address, port);
201 }
202 Ipv4EndPoint *
204  Ipv4Address localAddress, uint16_t localPort,
205  Ipv4Address peerAddress, uint16_t peerPort)
206 {
207  NS_LOG_FUNCTION (this << boundNetDevice << localAddress << localPort << peerAddress << peerPort);
208  return m_endPoints->Allocate (boundNetDevice,
209  localAddress, localPort,
210  peerAddress, peerPort);
211 }
212 
213 void
215 {
216  NS_LOG_FUNCTION (this << endPoint);
217  m_endPoints->DeAllocate (endPoint);
218 }
219 
220 Ipv6EndPoint *
222 {
223  NS_LOG_FUNCTION (this);
224  return m_endPoints6->Allocate ();
225 }
226 
227 Ipv6EndPoint *
229 {
230  NS_LOG_FUNCTION (this << address);
231  return m_endPoints6->Allocate (address);
232 }
233 
234 Ipv6EndPoint *
236 {
237  NS_LOG_FUNCTION (this << boundNetDevice << port);
238  return m_endPoints6->Allocate (boundNetDevice, port);
239 }
240 
241 Ipv6EndPoint *
243 {
244  NS_LOG_FUNCTION (this << boundNetDevice << address << port);
245  return m_endPoints6->Allocate (boundNetDevice, address, port);
246 }
247 Ipv6EndPoint *
249  Ipv6Address localAddress, uint16_t localPort,
250  Ipv6Address peerAddress, uint16_t peerPort)
251 {
252  NS_LOG_FUNCTION (this << boundNetDevice << localAddress << localPort << peerAddress << peerPort);
253  return m_endPoints6->Allocate (boundNetDevice,
254  localAddress, localPort,
255  peerAddress, peerPort);
256 }
257 
258 void
260 {
261  NS_LOG_FUNCTION (this << endPoint);
262  m_endPoints6->DeAllocate (endPoint);
263 }
264 
265 void
266 VirtualUdpL4Protocol::ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl,
267  uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
268  Ipv4Address payloadSource,Ipv4Address payloadDestination,
269  const uint8_t payload[8])
270 {
271  NS_LOG_FUNCTION (this << icmpSource << icmpTtl << icmpType << icmpCode << icmpInfo
272  << payloadSource << payloadDestination);
273  uint16_t src, dst;
274  src = payload[0] << 8;
275  src |= payload[1];
276  dst = payload[2] << 8;
277  dst |= payload[3];
278 
279  Ipv4EndPoint *endPoint = m_endPoints->SimpleLookup (payloadSource, src, payloadDestination, dst);
280  if (endPoint != 0)
281  {
282  endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
283  }
284  else
285  {
286  NS_LOG_DEBUG ("no endpoint found source=" << payloadSource <<
287  ", destination="<<payloadDestination<<
288  ", src=" << src << ", dst=" << dst);
289  }
290 }
291 
292 void
293 VirtualUdpL4Protocol::ReceiveIcmp (Ipv6Address icmpSource, uint8_t icmpTtl,
294  uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
295  Ipv6Address payloadSource,Ipv6Address payloadDestination,
296  const uint8_t payload[8])
297 {
298  NS_LOG_FUNCTION (this << icmpSource << icmpTtl << icmpType << icmpCode << icmpInfo
299  << payloadSource << payloadDestination);
300  uint16_t src, dst;
301  src = payload[0] << 8;
302  src |= payload[1];
303  dst = payload[2] << 8;
304  dst |= payload[3];
305 
306  Ipv6EndPoint *endPoint = m_endPoints6->SimpleLookup (payloadSource, src, payloadDestination, dst);
307  if (endPoint != 0)
308  {
309  endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
310  }
311  else
312  {
313  NS_LOG_DEBUG ("no endpoint found source=" << payloadSource <<
314  ", destination="<<payloadDestination<<
315  ", src=" << src << ", dst=" << dst);
316  }
317 }
318 
321  Ipv4Header const &header,
322  Ptr<Ipv4Interface> interface)
323 {
324  NS_LOG_FUNCTION (this << packet << header);
325  UdpHeader udpHeader;
326  if(Node::ChecksumEnabled ())
327  {
328  udpHeader.EnableChecksums ();
329  }
330 
331  udpHeader.InitializeChecksum (header.GetSource (), header.GetDestination (), PROT_NUMBER);
332 
333  // We only peek at the header for now (instead of removing it) so that it will be intact
334  // if we have to pass it to a IPv6 endpoint via:
335  //
336  // VirtualUdpL4Protocol::Receive (Ptr<Packet> packet, Ipv6Address &src, Ipv6Address &dst, ...)
337 
338  packet->PeekHeader (udpHeader);
339 
340  if(!udpHeader.IsChecksumOk ())
341  {
342  NS_LOG_INFO ("Bad checksum : dropping packet!");
344  }
345 
346  NS_LOG_DEBUG ("Looking up dst " << header.GetDestination () << " port " << udpHeader.GetDestinationPort ());
347  Ipv4EndPointDemux::EndPoints endPoints =
348  m_endPoints->Lookup (header.GetDestination (), udpHeader.GetDestinationPort (),
349  header.GetSource (), udpHeader.GetSourcePort (), interface);
350  if (endPoints.empty ())
351  {
352  if (this->GetObject<Ipv6L3Protocol> () != 0)
353  {
354  NS_LOG_LOGIC (" No Ipv4 endpoints matched on VirtualUdpL4Protocol, trying Ipv6 "<<this);
355  Ptr<Ipv6Interface> fakeInterface;
356  Ipv6Header ipv6Header;
359  ipv6Header.SetSourceAddress (src);
360  ipv6Header.SetDestinationAddress (dst);
361  return (this->Receive (packet, ipv6Header, fakeInterface));
362  }
363 
364  NS_LOG_LOGIC ("RX_ENDPOINT_UNREACH");
366  }
367 
368  packet->RemoveHeader(udpHeader);
369  for (Ipv4EndPointDemux::EndPointsI endPoint = endPoints.begin ();
370  endPoint != endPoints.end (); endPoint++)
371  {
372  (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort (),
373  interface);
374  }
375  return IpL4Protocol::RX_OK;
376 }
377 
380  Ipv6Header const &header,
381  Ptr<Ipv6Interface> interface)
382 {
383  NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << header.GetDestinationAddress ());
384  UdpHeader udpHeader;
385  if(Node::ChecksumEnabled ())
386  {
387  udpHeader.EnableChecksums ();
388  }
389 
390  udpHeader.InitializeChecksum (header.GetSourceAddress (), header.GetDestinationAddress (), PROT_NUMBER);
391 
392  packet->RemoveHeader (udpHeader);
393 
394  if(!udpHeader.IsChecksumOk () && !header.GetSourceAddress ().IsIpv4MappedAddress ())
395  {
396  NS_LOG_INFO ("Bad checksum : dropping packet!");
398  }
399 
400  NS_LOG_DEBUG ("Looking up dst " << header.GetDestinationAddress () << " port " << udpHeader.GetDestinationPort ());
401  Ipv6EndPointDemux::EndPoints endPoints =
402  m_endPoints6->Lookup (header.GetDestinationAddress (), udpHeader.GetDestinationPort (),
403  header.GetSourceAddress (), udpHeader.GetSourcePort (), interface);
404  if (endPoints.empty ())
405  {
406  NS_LOG_LOGIC ("RX_ENDPOINT_UNREACH");
408  }
409  for (Ipv6EndPointDemux::EndPointsI endPoint = endPoints.begin ();
410  endPoint != endPoints.end (); endPoint++)
411  {
412  (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort (), interface);
413  }
414  return IpL4Protocol::RX_OK;
415 }
416 
417 void
419  Ipv4Address saddr, Ipv4Address daddr,
420  uint16_t sport, uint16_t dport)
421 {
422  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport);
423 
424  UdpHeader udpHeader;
425  if(Node::ChecksumEnabled ())
426  {
427  udpHeader.EnableChecksums ();
428  udpHeader.InitializeChecksum (saddr,
429  daddr,
430  PROT_NUMBER);
431  }
432  udpHeader.SetDestinationPort (dport);
433  udpHeader.SetSourcePort (sport);
434 
435  packet->AddHeader (udpHeader);
436 
437  m_downTarget (packet, saddr, daddr, PROT_NUMBER, 0);
438 }
439 
440 void
442  Ipv4Address saddr, Ipv4Address daddr,
443  uint16_t sport, uint16_t dport, Ptr<Ipv4Route> route)
444 {
445  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport << route);
446 
447  UdpHeader udpHeader;
448  if(Node::ChecksumEnabled ())
449  {
450  udpHeader.EnableChecksums ();
451  udpHeader.InitializeChecksum (saddr,
452  daddr,
453  PROT_NUMBER);
454  }
455  udpHeader.SetDestinationPort (dport);
456  udpHeader.SetSourcePort (sport);
457 
458  packet->AddHeader (udpHeader);
459 
460  m_downTarget (packet, saddr, daddr, PROT_NUMBER, route);
461 }
462 
463 void
465  Ipv6Address saddr, Ipv6Address daddr,
466  uint16_t sport, uint16_t dport)
467 {
468  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport);
469 
470  UdpHeader udpHeader;
471  if(Node::ChecksumEnabled ())
472  {
473  udpHeader.EnableChecksums ();
474  udpHeader.InitializeChecksum (saddr,
475  daddr,
476  PROT_NUMBER);
477  }
478  udpHeader.SetDestinationPort (dport);
479  udpHeader.SetSourcePort (sport);
480 
481  packet->AddHeader (udpHeader);
482 
483  m_downTarget6 (packet, saddr, daddr, PROT_NUMBER, 0);
484 }
485 
486 void
488  Ipv6Address saddr, Ipv6Address daddr,
489  uint16_t sport, uint16_t dport, Ptr<Ipv6Route> route)
490 {
491  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport << route);
492 
493  UdpHeader udpHeader;
494  if(Node::ChecksumEnabled ())
495  {
496  udpHeader.EnableChecksums ();
497  udpHeader.InitializeChecksum (saddr,
498  daddr,
499  PROT_NUMBER);
500  }
501  udpHeader.SetDestinationPort (dport);
502  udpHeader.SetSourcePort (sport);
503 
504  packet->AddHeader (udpHeader);
505 
506  m_downTarget6 (packet, saddr, daddr, PROT_NUMBER, route);
507 }
508 
509 void
511 {
512  NS_LOG_FUNCTION (this);
513  m_downTarget = callback;
514 }
515 
518 {
519  return m_downTarget;
520 }
521 
522 void
524 {
525  NS_LOG_FUNCTION (this);
526  m_downTarget6 = callback;
527 }
528 
531 {
532  return m_downTarget6;
533 }
534 
535 } // namespace ns3
536 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
Ptr< Node > m_node
the node this stack is associated with
Ipv6EndPoint * Allocate6(void)
Allocate an IPv6 Endpoint.
Ipv4EndPointDemux * m_endPoints
A list of IPv4 end points.
Packet header for IPv6.
Definition: ipv6-header.h:34
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void InitializeChecksum(Address source, Address destination, uint8_t protocol)
Definition: udp-header.cc:75
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
std::list< Ipv6EndPoint * > EndPoints
Container of the IPv6 endpoints.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:81
EndPoints Lookup(Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport, Ptr< Ipv6Interface > incomingInterface)
lookup for a match with all the parameters.
static bool ChecksumEnabled(void)
Definition: node.cc:276
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
void SetDestinationPort(uint16_t port)
Definition: udp-header.cc:55
Ipv4Address GetDestination(void) const
Definition: ipv4-header.cc:304
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-vector.h:81
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
virtual void DoDispose(void)
Destructor implementation.
void SetSourcePort(uint16_t port)
Definition: udp-header.cc:60
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:278
Ipv4Address GetSource(void) const
Definition: ipv4-header.cc:291
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
std::list< Ipv6EndPoint * >::iterator EndPointsI
Iterator to the container of the IPv6 endpoints.
bool IsChecksumOk(void) const
Is the UDP checksum correct ?
Definition: udp-header.cc:136
uint16_t port
Definition: dsdv-manet.cc:45
virtual void SetDownTarget6(IpL4Protocol::DownTargetCallback6 cb)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
Demultiplexes packets to various transport layer endpoints.
void DeAllocate(Ipv4EndPoint *endPoint)
Remove an IPv4 Endpoint.
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
Packet header for IPv4.
Definition: ipv4-header.h:33
virtual void Send(Ptr< Packet > packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr< Ipv6Route > route)=0
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers...
std::vector< Ptr< VirtualUdpSocketImpl > > m_sockets
list of sockets
void Send(Ptr< Packet > packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport)
Send a packet via UDP (IPv4)
void EnableChecksums(void)
Enable checksum calculation for UDP.
Definition: udp-header.cc:49
Ipv6EndPoint * Allocate(void)
Allocate a Ipv6EndPoint.
virtual IpL4Protocol::DownTargetCallback6 GetDownTarget6(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
virtual IpL4Protocol::DownTargetCallback GetDownTarget(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
Ipv4EndPoint * Allocate(void)
Allocate an IPv4 Endpoint.
void DeAllocate(Ipv6EndPoint *endPoint)
Remove a end point.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:290
virtual enum IpL4Protocol::RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > interface)
Called from lower-level layers to send the packet up in the stack.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
address
Definition: first.py:37
void ForwardIcmp(Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
Forward the ICMP packet to the upper level.
Ipv6EndPoint * SimpleLookup(Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport)
Simple lookup for a four-tuple match.
uint16_t GetSourcePort(void) const
Definition: udp-header.cc:65
Implementation of the UDP protocol.
Packet header for UDP packets.
Definition: udp-header.h:39
virtual void Send(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)=0
Ipv4EndPoint * SimpleLookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport)
simple lookup for a match with all the parameters.
IpL4Protocol::DownTargetCallback m_downTarget
Callback to send packets over IPv4.
L4 Protocol abstract base class.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
EndPoints Lookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr< Ipv4Interface > incomingInterface)
lookup for a match with all the parameters.
static TypeId GetTypeId(void)
Get the type ID.
void SetSourceAddress(Ipv6Address src)
Set the "Source address" field.
Definition: ipv6-header.cc:95
Describes an IPv6 address.
Definition: ipv6-address.h:49
static const uint8_t PROT_NUMBER
protocol number (0x11)
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
IpL4Protocol::DownTargetCallback6 m_downTarget6
Callback to send packets over IPv6.
std::list< Ipv4EndPoint * > EndPoints
Container of the IPv4 endpoints.
Ipv6EndPointDemux * m_endPoints6
A list of IPv6 end points.
Demultiplexer for end points.
Ipv6Address GetSourceAddress(void) const
Get the "Source address" field.
Definition: ipv6-header.cc:100
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:270
A representation of an IPv6 endpoint/connection.
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1274
void ForwardIcmp(Ipv6Address src, uint8_t ttl, uint8_t type, uint8_t code, uint32_t info)
Forward the ICMP packet to the upper level.
std::list< Ipv4EndPoint * >::iterator EndPointsI
Iterator to the container of the IPv4 endpoints.
RxStatus
Rx status codes.
virtual void ReceiveIcmp(Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv4Address payloadSource, Ipv4Address payloadDestination, const uint8_t payload[8])
Called from lower-level layers to send the ICMP packet up in the stack.
virtual void NotifyNewAggregate(void)
Notify all Objects aggregated to this one of a new Object being aggregated.
Definition: object.cc:325
Container for a set of ns3::Object pointers.
void DeAllocate(Ipv4EndPoint *endPoint)
Remove a end point.
uint16_t GetDestinationPort(void) const
Definition: udp-header.cc:70
static Ipv6Address MakeIpv4MappedAddress(Ipv4Address addr)
Make the Ipv4-mapped IPv6 address.
bool IsIpv4MappedAddress() const
If the address is an IPv4-mapped address.
a unique identifier for an interface.
Definition: type-id.h:58
void SetDestinationAddress(Ipv6Address dst)
Set the "Destination address" field.
Definition: ipv6-header.cc:105
virtual void SetDownTarget(IpL4Protocol::DownTargetCallback cb)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
virtual int GetProtocolNumber(void) const
Returns the protocol number of this protocol.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
Ipv6Address GetDestinationAddress(void) const
Get the "Destination address" field.
Definition: ipv6-header.cc:110
A representation of an internet endpoint/connection.
void SetNode(Ptr< Node > node)
Set node associated with this stack.
Ipv4EndPoint * Allocate(void)
Allocate a Ipv4EndPoint.