A Discrete-Event Network Simulator
API
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: 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 
32 #include "udp-l4-protocol.h"
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"
40 #include "ipv6-l3-protocol.h"
41 #include "udp-socket-impl.h"
42 
43 namespace ns3 {
44 
45 NS_LOG_COMPONENT_DEFINE ("UdpL4Protocol");
46 
47 NS_OBJECT_ENSURE_REGISTERED (UdpL4Protocol);
48 
49 /* see http://www.iana.org/assignments/protocol-numbers */
50 const uint8_t UdpL4Protocol::PROT_NUMBER = 17;
51 
52 TypeId
54 {
55  static TypeId tid = TypeId ("ns3::UdpL4Protocol")
57  .SetGroupName ("Internet")
58  .AddConstructor<UdpL4Protocol> ()
59  .AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
62  MakeObjectVectorChecker<UdpSocketImpl> ())
63  ;
64  return tid;
65 }
66 
68  : m_endPoints (new Ipv4EndPointDemux ()), m_endPoints6 (new Ipv6EndPointDemux ())
69 {
71 }
72 
74 {
76 }
77 
78 void
80 {
81  m_node = node;
82 }
83 
84 /*
85  * This method is called by AddAgregate and completes the aggregation
86  * by setting the node in the udp stack and link it to the ipv4 object
87  * present in the node along with the socket factory
88  */
89 void
91 {
92  NS_LOG_FUNCTION (this);
93  Ptr<Node> node = this->GetObject<Node> ();
94  Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
95  Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
96 
97  if (m_node == 0)
98  {
99  if ((node != 0) && (ipv4 != 0 || ipv6 != 0))
100  {
101  this->SetNode (node);
102  Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
103  udpFactory->SetUdp (this);
104  node->AggregateObject (udpFactory);
105  }
106  }
107 
108  // We set at least one of our 2 down targets to the IPv4/IPv6 send
109  // functions. Since these functions have different prototypes, we
110  // need to keep track of whether we are connected to an IPv4 or
111  // IPv6 lower layer and call the appropriate one.
112 
113  if (ipv4 != 0 && m_downTarget.IsNull())
114  {
115  ipv4->Insert (this);
116  this->SetDownTarget (MakeCallback (&Ipv4::Send, ipv4));
117  }
118  if (ipv6 != 0 && m_downTarget6.IsNull())
119  {
120  ipv6->Insert (this);
121  this->SetDownTarget6 (MakeCallback (&Ipv6::Send, ipv6));
122  }
124 }
125 
126 int
128 {
129  return PROT_NUMBER;
130 }
131 
132 
133 void
135 {
137  for (std::vector<Ptr<UdpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
138  {
139  *i = 0;
140  }
141  m_sockets.clear ();
142 
143  if (m_endPoints != 0)
144  {
145  delete m_endPoints;
146  m_endPoints = 0;
147  }
148  if (m_endPoints6 != 0)
149  {
150  delete m_endPoints6;
151  m_endPoints6 = 0;
152  }
153  m_node = 0;
156 /*
157  = MakeNullCallback<void,Ptr<Packet>, Ipv4Address, Ipv4Address, uint8_t, Ptr<Ipv4Route> > ();
158 */
160 }
161 
164 {
166  Ptr<UdpSocketImpl> socket = CreateObject<UdpSocketImpl> ();
167  socket->SetNode (m_node);
168  socket->SetUdp (this);
169  m_sockets.push_back (socket);
170  return socket;
171 }
172 
173 Ipv4EndPoint *
175 {
177  return m_endPoints->Allocate ();
178 }
179 
180 Ipv4EndPoint *
182 {
183  NS_LOG_FUNCTION (this << address);
184  return m_endPoints->Allocate (address);
185 }
186 
187 Ipv4EndPoint *
189 {
190  NS_LOG_FUNCTION (this << port);
191  return m_endPoints->Allocate (port);
192 }
193 
194 Ipv4EndPoint *
196 {
197  NS_LOG_FUNCTION (this << address << port);
198  return m_endPoints->Allocate (address, port);
199 }
200 Ipv4EndPoint *
201 UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort,
202  Ipv4Address peerAddress, uint16_t peerPort)
203 {
204  NS_LOG_FUNCTION (this << localAddress << localPort << peerAddress << peerPort);
205  return m_endPoints->Allocate (localAddress, localPort,
206  peerAddress, peerPort);
207 }
208 
209 void
211 {
212  NS_LOG_FUNCTION (this << endPoint);
213  m_endPoints->DeAllocate (endPoint);
214 }
215 
216 Ipv6EndPoint *
218 {
220  return m_endPoints6->Allocate ();
221 }
222 
223 Ipv6EndPoint *
225 {
226  NS_LOG_FUNCTION (this << address);
227  return m_endPoints6->Allocate (address);
228 }
229 
230 Ipv6EndPoint *
232 {
233  NS_LOG_FUNCTION (this << port);
234  return m_endPoints6->Allocate (port);
235 }
236 
237 Ipv6EndPoint *
239 {
240  NS_LOG_FUNCTION (this << address << port);
241  return m_endPoints6->Allocate (address, port);
242 }
243 Ipv6EndPoint *
244 UdpL4Protocol::Allocate6 (Ipv6Address localAddress, uint16_t localPort,
245  Ipv6Address peerAddress, uint16_t peerPort)
246 {
247  NS_LOG_FUNCTION (this << localAddress << localPort << peerAddress << peerPort);
248  return m_endPoints6->Allocate (localAddress, localPort,
249  peerAddress, peerPort);
250 }
251 
252 void
254 {
255  NS_LOG_FUNCTION (this << endPoint);
256  m_endPoints6->DeAllocate (endPoint);
257 }
258 
259 void
260 UdpL4Protocol::ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl,
261  uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
262  Ipv4Address payloadSource,Ipv4Address payloadDestination,
263  const uint8_t payload[8])
264 {
265  NS_LOG_FUNCTION (this << icmpSource << icmpTtl << icmpType << icmpCode << icmpInfo
266  << payloadSource << payloadDestination);
267  uint16_t src, dst;
268  src = payload[0] << 8;
269  src |= payload[1];
270  dst = payload[2] << 8;
271  dst |= payload[3];
272 
273  Ipv4EndPoint *endPoint = m_endPoints->SimpleLookup (payloadSource, src, payloadDestination, dst);
274  if (endPoint != 0)
275  {
276  endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
277  }
278  else
279  {
280  NS_LOG_DEBUG ("no endpoint found source=" << payloadSource <<
281  ", destination="<<payloadDestination<<
282  ", src=" << src << ", dst=" << dst);
283  }
284 }
285 
286 void
287 UdpL4Protocol::ReceiveIcmp (Ipv6Address icmpSource, uint8_t icmpTtl,
288  uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
289  Ipv6Address payloadSource,Ipv6Address payloadDestination,
290  const uint8_t payload[8])
291 {
292  NS_LOG_FUNCTION (this << icmpSource << icmpTtl << icmpType << icmpCode << icmpInfo
293  << payloadSource << payloadDestination);
294  uint16_t src, dst;
295  src = payload[0] << 8;
296  src |= payload[1];
297  dst = payload[2] << 8;
298  dst |= payload[3];
299 
300  Ipv6EndPoint *endPoint = m_endPoints6->SimpleLookup (payloadSource, src, payloadDestination, dst);
301  if (endPoint != 0)
302  {
303  endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
304  }
305  else
306  {
307  NS_LOG_DEBUG ("no endpoint found source=" << payloadSource <<
308  ", destination="<<payloadDestination<<
309  ", src=" << src << ", dst=" << dst);
310  }
311 }
312 
315  Ipv4Header const &header,
316  Ptr<Ipv4Interface> interface)
317 {
318  NS_LOG_FUNCTION (this << packet << header);
319  UdpHeader udpHeader;
320  if(Node::ChecksumEnabled ())
321  {
322  udpHeader.EnableChecksums ();
323  }
324 
325  udpHeader.InitializeChecksum (header.GetSource (), header.GetDestination (), PROT_NUMBER);
326 
327  // We only peek at the header for now (instead of removing it) so that it will be intact
328  // if we have to pass it to a IPv6 endpoint via:
329  //
330  // UdpL4Protocol::Receive (Ptr<Packet> packet, Ipv6Address &src, Ipv6Address &dst, ...)
331 
332  packet->PeekHeader (udpHeader);
333 
334  if(!udpHeader.IsChecksumOk ())
335  {
336  NS_LOG_INFO ("Bad checksum : dropping packet!");
338  }
339 
340  NS_LOG_DEBUG ("Looking up dst " << header.GetDestination () << " port " << udpHeader.GetDestinationPort ());
341  Ipv4EndPointDemux::EndPoints endPoints =
342  m_endPoints->Lookup (header.GetDestination (), udpHeader.GetDestinationPort (),
343  header.GetSource (), udpHeader.GetSourcePort (), interface);
344  if (endPoints.empty ())
345  {
346  if (this->GetObject<Ipv6L3Protocol> () != 0)
347  {
348  NS_LOG_LOGIC (" No Ipv4 endpoints matched on UdpL4Protocol, trying Ipv6 "<<this);
349  Ptr<Ipv6Interface> fakeInterface;
350  Ipv6Header ipv6Header;
353  ipv6Header.SetSourceAddress (src);
354  ipv6Header.SetDestinationAddress (dst);
355  return (this->Receive (packet, ipv6Header, fakeInterface));
356  }
357 
358  NS_LOG_LOGIC ("RX_ENDPOINT_UNREACH");
360  }
361 
362  packet->RemoveHeader(udpHeader);
363  for (Ipv4EndPointDemux::EndPointsI endPoint = endPoints.begin ();
364  endPoint != endPoints.end (); endPoint++)
365  {
366  (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort (),
367  interface);
368  }
369  return IpL4Protocol::RX_OK;
370 }
371 
374  Ipv6Header const &header,
375  Ptr<Ipv6Interface> interface)
376 {
377  NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << header.GetDestinationAddress ());
378  UdpHeader udpHeader;
379  if(Node::ChecksumEnabled ())
380  {
381  udpHeader.EnableChecksums ();
382  }
383 
384  udpHeader.InitializeChecksum (header.GetSourceAddress (), header.GetDestinationAddress (), PROT_NUMBER);
385 
386  packet->RemoveHeader (udpHeader);
387 
388  if(!udpHeader.IsChecksumOk () && !header.GetSourceAddress ().IsIpv4MappedAddress ())
389  {
390  NS_LOG_INFO ("Bad checksum : dropping packet!");
392  }
393 
394  NS_LOG_DEBUG ("Looking up dst " << header.GetDestinationAddress () << " port " << udpHeader.GetDestinationPort ());
395  Ipv6EndPointDemux::EndPoints endPoints =
396  m_endPoints6->Lookup (header.GetDestinationAddress (), udpHeader.GetDestinationPort (),
397  header.GetSourceAddress (), udpHeader.GetSourcePort (), interface);
398  if (endPoints.empty ())
399  {
400  NS_LOG_LOGIC ("RX_ENDPOINT_UNREACH");
402  }
403  for (Ipv6EndPointDemux::EndPointsI endPoint = endPoints.begin ();
404  endPoint != endPoints.end (); endPoint++)
405  {
406  (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort (), interface);
407  }
408  return IpL4Protocol::RX_OK;
409 }
410 
411 void
413  Ipv4Address saddr, Ipv4Address daddr,
414  uint16_t sport, uint16_t dport)
415 {
416  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport);
417 
418  UdpHeader udpHeader;
419  if(Node::ChecksumEnabled ())
420  {
421  udpHeader.EnableChecksums ();
422  udpHeader.InitializeChecksum (saddr,
423  daddr,
424  PROT_NUMBER);
425  }
426  udpHeader.SetDestinationPort (dport);
427  udpHeader.SetSourcePort (sport);
428 
429  packet->AddHeader (udpHeader);
430 
431  m_downTarget (packet, saddr, daddr, PROT_NUMBER, 0);
432 }
433 
434 void
436  Ipv4Address saddr, Ipv4Address daddr,
437  uint16_t sport, uint16_t dport, Ptr<Ipv4Route> route)
438 {
439  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport << route);
440 
441  UdpHeader udpHeader;
442  if(Node::ChecksumEnabled ())
443  {
444  udpHeader.EnableChecksums ();
445  udpHeader.InitializeChecksum (saddr,
446  daddr,
447  PROT_NUMBER);
448  }
449  udpHeader.SetDestinationPort (dport);
450  udpHeader.SetSourcePort (sport);
451 
452  packet->AddHeader (udpHeader);
453 
454  m_downTarget (packet, saddr, daddr, PROT_NUMBER, route);
455 }
456 
457 void
459  Ipv6Address saddr, Ipv6Address daddr,
460  uint16_t sport, uint16_t dport)
461 {
462  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport);
463 
464  UdpHeader udpHeader;
465  if(Node::ChecksumEnabled ())
466  {
467  udpHeader.EnableChecksums ();
468  udpHeader.InitializeChecksum (saddr,
469  daddr,
470  PROT_NUMBER);
471  }
472  udpHeader.SetDestinationPort (dport);
473  udpHeader.SetSourcePort (sport);
474 
475  packet->AddHeader (udpHeader);
476 
477  m_downTarget6 (packet, saddr, daddr, PROT_NUMBER, 0);
478 }
479 
480 void
482  Ipv6Address saddr, Ipv6Address daddr,
483  uint16_t sport, uint16_t dport, Ptr<Ipv6Route> route)
484 {
485  NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport << route);
486 
487  UdpHeader udpHeader;
488  if(Node::ChecksumEnabled ())
489  {
490  udpHeader.EnableChecksums ();
491  udpHeader.InitializeChecksum (saddr,
492  daddr,
493  PROT_NUMBER);
494  }
495  udpHeader.SetDestinationPort (dport);
496  udpHeader.SetSourcePort (sport);
497 
498  packet->AddHeader (udpHeader);
499 
500  m_downTarget6 (packet, saddr, daddr, PROT_NUMBER, route);
501 }
502 
503 void
505 {
506  NS_LOG_FUNCTION (this);
507  m_downTarget = callback;
508 }
509 
512 {
513  return m_downTarget;
514 }
515 
516 void
518 {
519  NS_LOG_FUNCTION (this);
520  m_downTarget6 = callback;
521 }
522 
525 {
526  return m_downTarget6;
527 }
528 
529 } // namespace ns3
530 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:268
Packet header for IPv6.
Definition: ipv6-header.h:34
Ptr< Socket > CreateSocket(void)
#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
virtual void DoDispose(void)
Destructor implementation.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
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:462
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.
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...
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:201
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:244
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.
Ptr< Node > m_node
the node this stack is associated with
bool IsChecksumOk(void) const
Is the UDP checksum correct ?
Definition: udp-header.cc:136
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...
RxStatus
Rx status codes.
void SetNode(Ptr< Node > node)
Set node associated with this stack.
uint16_t port
Definition: dsdv-manet.cc:44
Demultiplexes packets to various transport layer endpoints.
virtual int GetProtocolNumber(void) const
Returns the protocol number of this protocol.
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...
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.
void EnableChecksums(void)
Enable checksum calculation for UDP.
Definition: udp-header.cc:49
Ipv4EndPoint * Allocate(void)
Allocate an IPv4 Endpoint.
Ipv6EndPoint * Allocate(void)
Allocate a Ipv6EndPoint.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
static TypeId GetTypeId(void)
Get the type ID.
void DeAllocate(Ipv6EndPoint *endPoint)
Remove a end point.
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...
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:278
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
Ipv6EndPointDemux * m_endPoints6
A list of IPv6 end points.
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
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.
L4 Protocol abstract base class.
void DeAllocate(Ipv4EndPoint *endPoint)
Remove an IPv4 Endpoint.
IpL4Protocol::DownTargetCallback6 m_downTarget6
Callback to send packets over IPv6.
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...
EndPoints Lookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr< Ipv4Interface > incomingInterface)
lookup for a match with all the parameters.
void SetSourceAddress(Ipv6Address src)
Set the "Source address" field.
Definition: ipv6-header.cc:95
Describes an IPv6 address.
Definition: ipv6-address.h:48
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
std::list< Ipv4EndPoint * > EndPoints
Container of the IPv4 endpoints.
IpL4Protocol::DownTargetCallback m_downTarget
Callback to send packets over IPv4.
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
Implementation of the UDP protocol.
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:236
std::vector< Ptr< UdpSocketImpl > > m_sockets
list of sockets
A representation of an IPv6 endpoint/connection.
Ipv4EndPointDemux * m_endPoints
A list of IPv4 end points.
void Send(Ptr< Packet > packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport)
Send a packet via UDP (IPv4)
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1274
Ipv6EndPoint * Allocate6(void)
Allocate an IPv6 Endpoint.
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.
tuple address
Definition: first.py:37
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
static const uint8_t PROT_NUMBER
protocol number (0x11)
void SetDestinationAddress(Ipv6Address dst)
Set the "Destination address" field.
Definition: ipv6-header.cc:105
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:257
Ipv6Address GetDestinationAddress(void) const
Get the "Destination address" field.
Definition: ipv6-header.cc:110
A representation of an internet endpoint/connection.
Ipv4EndPoint * Allocate(void)
Allocate a Ipv4EndPoint.