A Discrete-Event Network Simulator
API
ipv4-l3-protocol.h
Go to the documentation of this file.
1 // -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
2 //
3 // Copyright (c) 2006 Georgia Tech Research Corporation
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: George F. Riley<riley@ece.gatech.edu>
19 //
20 
21 #ifndef IPV4_L3_PROTOCOL_H
22 #define IPV4_L3_PROTOCOL_H
23 
24 #include <list>
25 #include <map>
26 #include <vector>
27 #include <stdint.h>
28 #include "ns3/ipv4-address.h"
29 #include "ns3/ptr.h"
30 #include "ns3/net-device.h"
31 #include "ns3/ipv4.h"
32 #include "ns3/traced-callback.h"
33 #include "ns3/ipv4-header.h"
34 #include "ns3/ipv4-routing-protocol.h"
35 #include "ns3/nstime.h"
36 #include "ns3/simulator.h"
37 
39 
40 namespace ns3 {
41 
42 class Packet;
43 class NetDevice;
44 class Ipv4Interface;
45 class Ipv4Address;
46 class Ipv4Header;
47 class Ipv4RoutingTableEntry;
48 class Ipv4Route;
49 class Node;
50 class Socket;
51 class Ipv4RawSocketImpl;
52 class IpL4Protocol;
53 class Icmpv4L4Protocol;
54 
80 class Ipv4L3Protocol : public Ipv4
81 {
82 public:
87  static TypeId GetTypeId (void);
88  static const uint16_t PROT_NUMBER;
89 
91  virtual ~Ipv4L3Protocol ();
92 
97  enum DropReason
98  {
106  };
107 
112  void SetNode (Ptr<Node> node);
113 
114  // functions defined in base class Ipv4
115 
116  void SetRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol);
118 
120  void DeleteRawSocket (Ptr<Socket> socket);
121 
122  virtual void Insert (Ptr<IpL4Protocol> protocol);
123  virtual void Insert (Ptr<IpL4Protocol> protocol, uint32_t interfaceIndex);
124 
125  virtual void Remove (Ptr<IpL4Protocol> protocol);
126  virtual void Remove (Ptr<IpL4Protocol> protocol, uint32_t interfaceIndex);
127 
128  virtual Ptr<IpL4Protocol> GetProtocol (int protocolNumber) const;
129  virtual Ptr<IpL4Protocol> GetProtocol (int protocolNumber, int32_t interfaceIndex) const;
130 
131  virtual Ipv4Address SourceAddressSelection (uint32_t interface, Ipv4Address dest);
132 
139  void SetDefaultTtl (uint8_t ttl);
140 
154  void Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
155  const Address &to, NetDevice::PacketType packetType);
156 
167  void Send (Ptr<Packet> packet, Ipv4Address source,
168  Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route);
177  void SendWithHeader (Ptr<Packet> packet, Ipv4Header ipHeader, Ptr<Ipv4Route> route);
178 
179  uint32_t AddInterface (Ptr<NetDevice> device);
185  Ptr<Ipv4Interface> GetInterface (uint32_t i) const;
186  uint32_t GetNInterfaces (void) const;
187 
188  int32_t GetInterfaceForAddress (Ipv4Address addr) const;
189  int32_t GetInterfaceForPrefix (Ipv4Address addr, Ipv4Mask mask) const;
190  int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const;
191  bool IsDestinationAddress (Ipv4Address address, uint32_t iif) const;
192 
193  bool AddAddress (uint32_t i, Ipv4InterfaceAddress address);
194  Ipv4InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
195  uint32_t GetNAddresses (uint32_t interface) const;
196  bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
197  bool RemoveAddress (uint32_t interface, Ipv4Address address);
200 
201 
202  void SetMetric (uint32_t i, uint16_t metric);
203  uint16_t GetMetric (uint32_t i) const;
204  uint16_t GetMtu (uint32_t i) const;
205  bool IsUp (uint32_t i) const;
206  void SetUp (uint32_t i);
207  void SetDown (uint32_t i);
208  bool IsForwarding (uint32_t i) const;
209  void SetForwarding (uint32_t i, bool val);
210 
211  Ptr<NetDevice> GetNetDevice (uint32_t i);
212 
223  bool IsUnicast (Ipv4Address ad) const;
224 
232  typedef void (* SentTracedCallback)
233  (const Ipv4Header & header, Ptr<const Packet> packet, uint32_t interface);
234 
245  typedef void (* TxRxTracedCallback)
246  (Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
247 
259  typedef void (* DropTracedCallback)
260  (const Ipv4Header & header, Ptr<const Packet> packet,
261  DropReason reason, Ptr<Ipv4> ipv4,
262  uint32_t interface);
263 
264 protected:
265 
266  virtual void DoDispose (void);
271  virtual void NotifyNewAggregate ();
272 private:
277  friend class ::Ipv4L3ProtocolTestCase;
278 
285 
293 
294  // class Ipv4 attributes
295  virtual void SetIpForward (bool forward);
296  virtual bool GetIpForward (void) const;
297  virtual void SetWeakEsModel (bool model);
298  virtual bool GetWeakEsModel (void) const;
299 
306  void DecreaseIdentification (Ipv4Address source,
307  Ipv4Address destination,
308  uint8_t protocol);
309 
322  Ipv4Address source,
323  Ipv4Address destination,
324  uint8_t protocol,
325  uint16_t payloadSize,
326  uint8_t ttl,
327  uint8_t tos,
328  bool mayFragment);
329 
336  void
338  Ptr<Packet> packet,
339  Ipv4Header const &ipHeader);
340 
347  void
348  IpForward (Ptr<Ipv4Route> rtentry,
350  const Ipv4Header &header);
351 
358  void
361  const Ipv4Header &header);
362 
369  void LocalDeliver (Ptr<const Packet> p, Ipv4Header const&ip, uint32_t iif);
370 
377  void RouteInputError (Ptr<const Packet> p, const Ipv4Header & ipHeader, Socket::SocketErrno sockErrno);
378 
384  uint32_t AddIpv4Interface (Ptr<Ipv4Interface> interface);
385 
389  void SetupLoopback (void);
390 
395  Ptr<Icmpv4L4Protocol> GetIcmp (void) const;
396 
403  bool IsUnicast (Ipv4Address ad, Ipv4Mask interfaceMask) const;
404 
408  typedef std::pair<Ptr<Packet>, Ipv4Header> Ipv4PayloadHeaderPair;
409 
417  void DoFragmentation (Ptr<Packet> packet, const Ipv4Header& ipv4Header, uint32_t outIfaceMtu, std::list<Ipv4PayloadHeaderPair>& listFragments);
418 
426  bool ProcessFragment (Ptr<Packet>& packet, Ipv4Header & ipHeader, uint32_t iif);
427 
438  void CallTxTrace (const Ipv4Header & ipHeader, Ptr<Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
439 
443  typedef std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
447  typedef std::map<Ptr<const NetDevice>, uint32_t > Ipv4InterfaceReverseContainer;
451  typedef std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
452 
456  typedef std::pair<int, int32_t> L4ListKey_t;
457 
461  typedef std::map<L4ListKey_t, Ptr<IpL4Protocol> > L4List_t;
462 
463  bool m_ipForward;
468  uint8_t m_defaultTtl;
469  std::map<std::pair<uint64_t, uint8_t>, uint16_t> m_identification;
471 
480 
481  // The following two traces pass a packet with an IP header
490  // <ip-header, payload, reason, ifindex> (ifindex not valid if reason is DROP_NO_ROUTE)
495 
497 
499 
501  typedef std::pair<uint64_t, uint32_t> FragmentKey_t;
502 
504  typedef std::list< std::tuple <Time, FragmentKey_t, Ipv4Header, uint32_t > > FragmentsTimeoutsList_t;
506  typedef std::list< std::tuple <Time, FragmentKey_t, Ipv4Header, uint32_t > >::iterator FragmentsTimeoutsListI_t;
507 
514  void HandleFragmentsTimeout (FragmentKey_t key, Ipv4Header & ipHeader, uint32_t iif);
515 
523  FragmentsTimeoutsListI_t SetTimeout (FragmentKey_t key, Ipv4Header ipHeader, uint32_t iif);
524 
528  void HandleTimeout (void);
529 
531 
533 
537  class Fragments : public SimpleRefCount<Fragments>
538  {
539  public:
543  Fragments ();
544 
548  ~Fragments ();
549 
556  void AddFragment (Ptr<Packet> fragment, uint16_t fragmentOffset, bool moreFragment);
557 
562  bool IsEntire () const;
563 
568  Ptr<Packet> GetPacket () const;
569 
574  Ptr<Packet> GetPartialPacket () const;
575 
581 
587 
588  private:
593 
597  std::list<std::pair<Ptr<Packet>, uint16_t> > m_fragments;
598 
603  };
604 
606  typedef std::map< FragmentKey_t, Ptr<Fragments> > MapFragments_t;
607 
610 
613  typedef std::tuple <uint64_t, uint8_t, Ipv4Address, Ipv4Address> DupTuple_t;
615  typedef std::map<DupTuple_t, Time> DupMap_t;
616 
623  bool UpdateDuplicate (Ptr<const Packet> p, const Ipv4Header &header);
627  void RemoveDuplicates (void);
628 
629  bool m_enableDpd;
634 };
635 
636 } // Namespace ns3
637 
638 #endif /* IPV4_L3_PROTOCOL_H */
ns3::Ipv4L3Protocol::HandleTimeout
void HandleTimeout(void)
Handles a fragmented packet timeout.
Definition: ipv4-l3-protocol.cc:1865
ns3::Ipv4L3Protocol::m_localDeliverTrace
TracedCallback< const Ipv4Header &, Ptr< const Packet >, uint32_t > m_localDeliverTrace
Trace of locally delivered packets.
Definition: ipv4-l3-protocol.h:479
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::Ipv4Header
Packet header for IPv4.
Definition: ipv4-header.h:34
ns3::Ipv4L3Protocol::m_fragmentExpirationTimeout
Time m_fragmentExpirationTimeout
Expiration timeout.
Definition: ipv4-l3-protocol.h:609
ns3::Ipv4L3Protocol::Fragments::~Fragments
~Fragments()
Destructor.
Definition: ipv4-l3-protocol.cc:1575
ns3::Ipv4L3Protocol::m_interfaces
Ipv4InterfaceList m_interfaces
List of IPv4 interfaces.
Definition: ipv4-l3-protocol.h:466
ns3::Ipv4L3Protocol::Ipv4L3Protocol
Ipv4L3Protocol(const Ipv4L3Protocol &)
Copy constructor.
ns3::Ipv4L3Protocol::FragmentsTimeoutsListI_t
std::list< std::tuple< Time, FragmentKey_t, Ipv4Header, uint32_t > >::iterator FragmentsTimeoutsListI_t
Container Iterator for fragment timeouts..
Definition: ipv4-l3-protocol.h:506
ns3::Ipv4L3Protocol::operator=
Ipv4L3Protocol & operator=(const Ipv4L3Protocol &)
Copy constructor.
ns3::Ipv4L3Protocol::Fragments
A Set of Fragment belonging to the same packet (src, dst, identification and proto)
Definition: ipv4-l3-protocol.h:538
ns3::Ipv4L3Protocol::DROP_NO_ROUTE
@ DROP_NO_ROUTE
No route to host.
Definition: ipv4-l3-protocol.h:100
ns3::Ipv4L3Protocol::DROP_DUPLICATE
@ DROP_DUPLICATE
Duplicate packet received.
Definition: ipv4-l3-protocol.h:105
ns3::Ipv4L3Protocol::m_ipForward
bool m_ipForward
Forwarding packets (i.e.
Definition: ipv4-l3-protocol.h:463
ns3::Ipv4L3Protocol::CreateRawSocket
Ptr< Socket > CreateRawSocket(void)
Creates a raw socket.
Definition: ipv4-l3-protocol.cc:247
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::Ipv4L3Protocol::GetIpForward
virtual bool GetIpForward(void) const
Get the IP forwarding state.
Definition: ipv4-l3-protocol.cc:1409
ns3::Socket::SocketErrno
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
ns3::Ipv4L3Protocol::SetIpForward
virtual void SetIpForward(bool forward)
Set or unset the IP forwarding state.
Definition: ipv4-l3-protocol.cc:1398
ns3::Ipv4L3Protocol::BuildHeader
Ipv4Header BuildHeader(Ipv4Address source, Ipv4Address destination, uint8_t protocol, uint16_t payloadSize, uint8_t ttl, uint8_t tos, bool mayFragment)
Construct an IPv4 header.
Definition: ipv4-l3-protocol.cc:916
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ipv4L3Protocol::RemoveAddress
bool RemoveAddress(uint32_t interfaceIndex, uint32_t addressIndex)
Remove the address at addressIndex on named interface.
Definition: ipv4-l3-protocol.cc:1184
ns3::Ipv4L3Protocol::m_unicastForwardTrace
TracedCallback< const Ipv4Header &, Ptr< const Packet >, uint32_t > m_unicastForwardTrace
Trace of unicast forwarded packets.
Definition: ipv4-l3-protocol.h:475
ns3::Ipv4L3Protocol::SetWeakEsModel
virtual void SetWeakEsModel(bool model)
Set or unset the Weak Es Model.
Definition: ipv4-l3-protocol.cc:1416
ns3::Ipv4L3Protocol::SetForwarding
void SetForwarding(uint32_t i, bool val)
Definition: ipv4-l3-protocol.cc:1383
ns3::Ipv4L3Protocol::Ipv4L3Protocol
Ipv4L3Protocol()
Definition: ipv4-l3-protocol.cc:132
ns3::Ipv4L3Protocol::SetRoutingProtocol
void SetRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol)
Register a new routing protocol to be used by this Ipv4 stack.
Definition: ipv4-l3-protocol.cc:291
ns3::Ipv4L3Protocol::L4List_t
std::map< L4ListKey_t, Ptr< IpL4Protocol > > L4List_t
Container of the IPv4 L4 instances.
Definition: ipv4-l3-protocol.h:461
ns3::Ipv4L3Protocol::IpMulticastForward
void IpMulticastForward(Ptr< Ipv4MulticastRoute > mrtentry, Ptr< const Packet > p, const Ipv4Header &header)
Forward a multicast packet.
Definition: ipv4-l3-protocol.cc:1017
ns3::Ipv4L3Protocol::NotifyNewAggregate
virtual void NotifyNewAggregate()
This function will notify other components connected to the node that a new stack member is now conne...
Definition: ipv4-l3-protocol.cc:274
ns3::Ipv4L3Protocol::GetProtocol
virtual Ptr< IpL4Protocol > GetProtocol(int protocolNumber) const
Definition: ipv4-l3-protocol.cc:202
ns3::Ipv4L3Protocol::DROP_TTL_EXPIRED
@ DROP_TTL_EXPIRED
Packet TTL has expired.
Definition: ipv4-l3-protocol.h:99
ns3::Ipv4L3Protocol::MapFragments_t
std::map< FragmentKey_t, Ptr< Fragments > > MapFragments_t
Container of fragments, stored as pairs(src+dst addr, src+dst port) / fragment.
Definition: ipv4-l3-protocol.h:606
ns3::Ipv4L3Protocol::Fragments::GetPacket
Ptr< Packet > GetPacket() const
Get the entire packet.
Definition: ipv4-l3-protocol.cc:1634
ns3::Ipv4L3Protocol::DupTuple_t
std::tuple< uint64_t, uint8_t, Ipv4Address, Ipv4Address > DupTuple_t
IETF RFC 6621, Section 6.2 de-duplication w/o IPSec RFC 6621 recommended duplicate packet tuple: {IPV...
Definition: ipv4-l3-protocol.h:613
ns3::Ipv4L3Protocol::GetNAddresses
uint32_t GetNAddresses(uint32_t interface) const
Definition: ipv4-l3-protocol.cc:1176
ns3::Ipv4L3Protocol::DoFragmentation
void DoFragmentation(Ptr< Packet > packet, const Ipv4Header &ipv4Header, uint32_t outIfaceMtu, std::list< Ipv4PayloadHeaderPair > &listFragments)
Fragment a packet.
Definition: ipv4-l3-protocol.cc:1440
ns3::Ipv4L3Protocol::GetInterface
Ptr< Ipv4Interface > GetInterface(uint32_t i) const
Get an interface.
Definition: ipv4-l3-protocol.cc:429
ns3::Ipv4L3Protocol::SetMetric
void SetMetric(uint32_t i, uint16_t metric)
Definition: ipv4-l3-protocol.cc:1304
ns3::SimpleRefCount
A template-based reference counting class.
Definition: simple-ref-count.h:74
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
Ipv4L3ProtocolTestCase
IPv4 Test.
Definition: ipv4-test.cc:42
ns3::Ipv4L3Protocol::m_node
Ptr< Node > m_node
Node attached to stack.
Definition: ipv4-l3-protocol.h:470
ns3::Ipv4L3Protocol::Fragments::GetPartialPacket
Ptr< Packet > GetPartialPacket() const
Get the complete part of the packet.
Definition: ipv4-l3-protocol.cc:1672
ns3::Ipv4L3Protocol::FragmentKey_t
std::pair< uint64_t, uint32_t > FragmentKey_t
Key identifying a fragmented packet.
Definition: ipv4-l3-protocol.h:501
ns3::Ipv4L3Protocol::m_expire
Time m_expire
duplicate entry expiration delay
Definition: ipv4-l3-protocol.h:631
ns3::Ipv4L3Protocol::m_sendOutgoingTrace
TracedCallback< const Ipv4Header &, Ptr< const Packet >, uint32_t > m_sendOutgoingTrace
Trace of sent packets.
Definition: ipv4-l3-protocol.h:473
ns3::Ipv4L3Protocol::Ipv4PayloadHeaderPair
std::pair< Ptr< Packet >, Ipv4Header > Ipv4PayloadHeaderPair
Pair of a packet and an Ipv4 header.
Definition: ipv4-l3-protocol.h:408
ns3::Ipv4L3Protocol::HandleFragmentsTimeout
void HandleFragmentsTimeout(FragmentKey_t key, Ipv4Header &ipHeader, uint32_t iif)
Process the timeout for packet fragments.
Definition: ipv4-l3-protocol.cc:1721
ns3::Ipv4L3Protocol::DropReason
DropReason
Reason why a packet has been dropped.
Definition: ipv4-l3-protocol.h:98
ns3::Ipv4L3Protocol::DROP_FRAGMENT_TIMEOUT
@ DROP_FRAGMENT_TIMEOUT
Fragment timeout exceeded.
Definition: ipv4-l3-protocol.h:104
ns3::Ipv4L3Protocol::m_txTrace
TracedCallback< Ptr< const Packet >, Ptr< Ipv4 >, uint32_t > m_txTrace
Trace of transmitted packets.
Definition: ipv4-l3-protocol.h:485
ns3::Ipv4L3Protocol::Receive
void Receive(Ptr< NetDevice > device, Ptr< const Packet > p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
Lower layer calls this method after calling L3Demux::Lookup The ARP subclass needs to know from which...
Definition: ipv4-l3-protocol.cc:570
ns3::Ipv4L3Protocol::RouteInputError
void RouteInputError(Ptr< const Packet > p, const Ipv4Header &ipHeader, Socket::SocketErrno sockErrno)
Fallback when no route is found.
Definition: ipv4-l3-protocol.cc:1430
ns3::Ipv4L3Protocol::m_dropTrace
TracedCallback< const Ipv4Header &, Ptr< const Packet >, DropReason, Ptr< Ipv4 >, uint32_t > m_dropTrace
Trace of dropped packets.
Definition: ipv4-l3-protocol.h:494
ns3::Ipv4L3Protocol::m_timeoutEvent
EventId m_timeoutEvent
Event for the next scheduled timeout.
Definition: ipv4-l3-protocol.h:532
ns3::Ipv4L3Protocol::Fragments::IsEntire
bool IsEntire() const
If all fragments have been added.
Definition: ipv4-l3-protocol.cc:1604
ns3::Ipv4L3Protocol::m_reverseInterfacesContainer
Ipv4InterfaceReverseContainer m_reverseInterfacesContainer
Container of NetDevice / Interface index associations.
Definition: ipv4-l3-protocol.h:467
ns3::Ipv4L3Protocol::Fragments::SetTimeoutIter
void SetTimeoutIter(FragmentsTimeoutsListI_t iter)
Set the Timeout iterator.
Definition: ipv4-l3-protocol.cc:1707
ns3::Ipv4L3Protocol::IsUp
bool IsUp(uint32_t i) const
Definition: ipv4-l3-protocol.cc:1328
ns3::Ipv4L3Protocol::FragmentsTimeoutsList_t
std::list< std::tuple< Time, FragmentKey_t, Ipv4Header, uint32_t > > FragmentsTimeoutsList_t
Container for fragment timeouts.
Definition: ipv4-l3-protocol.h:504
ns3::Ipv4L3Protocol::SendWithHeader
void SendWithHeader(Ptr< Packet > packet, Ipv4Header ipHeader, Ptr< Ipv4Route > route)
Definition: ipv4-l3-protocol.cc:728
ns3::Ipv4L3Protocol::GetInterfaceForPrefix
int32_t GetInterfaceForPrefix(Ipv4Address addr, Ipv4Mask mask) const
Return the interface number of first interface found that has an Ipv4 address within the prefix speci...
Definition: ipv4-l3-protocol.cc:469
ns3::Ipv4L3Protocol::AddAddress
bool AddAddress(uint32_t i, Ipv4InterfaceAddress address)
Definition: ipv4-l3-protocol.cc:1155
ns3::Ipv4
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:77
ns3::Ipv4L3Protocol::~Ipv4L3Protocol
virtual ~Ipv4L3Protocol()
Definition: ipv4-l3-protocol.cc:137
ns3::Ptr< Node >
ns3::Ipv4L3Protocol::Ipv4InterfaceList
std::vector< Ptr< Ipv4Interface > > Ipv4InterfaceList
Container of the IPv4 Interfaces.
Definition: ipv4-l3-protocol.h:443
ns3::Ipv4L3Protocol::SelectSourceAddress
Ipv4Address SelectSourceAddress(Ptr< const NetDevice > device, Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope)
Return the first primary source address with scope less than or equal to the requested scope,...
Definition: ipv4-l3-protocol.cc:1251
ns3::Ipv4L3Protocol::m_weakEsModel
bool m_weakEsModel
Weak ES model state.
Definition: ipv4-l3-protocol.h:464
ns3::Ipv4L3Protocol::CallTxTrace
void CallTxTrace(const Ipv4Header &ipHeader, Ptr< Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
Make a copy of the packet, add the header and invoke the TX trace callback.
Definition: ipv4-l3-protocol.cc:741
ns3::Ipv4L3Protocol::m_timeoutEventList
FragmentsTimeoutsList_t m_timeoutEventList
Timeout "events" container.
Definition: ipv4-l3-protocol.h:530
ns3::Ipv4L3Protocol::m_routingProtocol
Ptr< Ipv4RoutingProtocol > m_routingProtocol
Routing protocol associated with the stack.
Definition: ipv4-l3-protocol.h:496
ns3::Ipv4L3Protocol::SocketList
std::list< Ptr< Ipv4RawSocketImpl > > SocketList
Container of the IPv4 Raw Sockets.
Definition: ipv4-l3-protocol.h:451
ns3::Ipv4L3Protocol::LocalDeliver
void LocalDeliver(Ptr< const Packet > p, Ipv4Header const &ip, uint32_t iif)
Deliver a packet.
Definition: ipv4-l3-protocol.cc:1092
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::Ipv4L3Protocol::Fragments::m_timeoutIter
FragmentsTimeoutsListI_t m_timeoutIter
Timeout iterator to "event" handler.
Definition: ipv4-l3-protocol.h:602
ns3::Ipv4InterfaceAddress
a class to store IPv4 address information on an interface
Definition: ipv4-interface-address.h:44
ns3::Ipv4L3Protocol::GetInterfaceForDevice
int32_t GetInterfaceForDevice(Ptr< const NetDevice > device) const
Definition: ipv4-l3-protocol.cc:492
ns3::Ipv4L3Protocol::GetRoutingProtocol
Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(void) const
Get the routing protocol to be used by this Ipv4 stack.
Definition: ipv4-l3-protocol.cc:300
ns3::Ipv4L3Protocol::DecreaseIdentification
void DecreaseIdentification(Ipv4Address source, Ipv4Address destination, uint8_t protocol)
Decrease the identification value for a dropped or recursed packet.
Definition: ipv4-l3-protocol.cc:904
ns3::Ipv4L3Protocol::m_sockets
SocketList m_sockets
List of IPv4 raw sockets.
Definition: ipv4-l3-protocol.h:498
ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e
InterfaceAddressScope_e
Address scope.
Definition: ipv4-interface-address.h:50
ns3::Ipv4L3Protocol::L4ListKey_t
std::pair< int, int32_t > L4ListKey_t
Container of the IPv4 L4 keys: protocol number, interface index.
Definition: ipv4-l3-protocol.h:456
first.address
address
Definition: first.py:44
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::Ipv4L3Protocol::DeleteRawSocket
void DeleteRawSocket(Ptr< Socket > socket)
Deletes a particular raw socket.
Definition: ipv4-l3-protocol.cc:256
ns3::Ipv4L3Protocol::m_rxTrace
TracedCallback< Ptr< const Packet >, Ptr< Ipv4 >, uint32_t > m_rxTrace
Trace of received packets.
Definition: ipv4-l3-protocol.h:489
ns3::Ipv4L3Protocol::Fragments::m_moreFragment
bool m_moreFragment
True if other fragments will be sent.
Definition: ipv4-l3-protocol.h:592
ns3::Ipv4L3Protocol::SourceAddressSelection
virtual Ipv4Address SourceAddressSelection(uint32_t interface, Ipv4Address dest)
Choose the source address to use with destination address.
Definition: ipv4-l3-protocol.cc:1224
ns3::Ipv4L3Protocol::DROP_BAD_CHECKSUM
@ DROP_BAD_CHECKSUM
Bad checksum.
Definition: ipv4-l3-protocol.h:101
ns3::Ipv4L3Protocol::m_dups
DupMap_t m_dups
map of packet duplicate tuples to expiry event
Definition: ipv4-l3-protocol.h:630
ns3::Ipv4L3Protocol::m_multicastForwardTrace
TracedCallback< const Ipv4Header &, Ptr< const Packet >, uint32_t > m_multicastForwardTrace
Trace of multicast forwarded packets.
Definition: ipv4-l3-protocol.h:477
ns3::Ipv4L3Protocol::PROT_NUMBER
static const uint16_t PROT_NUMBER
Protocol number (0x0800)
Definition: ipv4-l3-protocol.h:88
ns3::Ipv4L3Protocol::m_enableDpd
bool m_enableDpd
Enable multicast duplicate packet detection.
Definition: ipv4-l3-protocol.h:629
ns3::Ipv4L3Protocol::IpForward
void IpForward(Ptr< Ipv4Route > rtentry, Ptr< const Packet > p, const Ipv4Header &header)
Forward a packet.
Definition: ipv4-l3-protocol.cc:1054
ns3::Ipv4L3Protocol::IsDestinationAddress
bool IsDestinationAddress(Ipv4Address address, uint32_t iif) const
Determine whether address and interface corresponding to received packet can be accepted for local de...
Definition: ipv4-l3-protocol.cc:507
ns3::Ipv4L3Protocol::m_purge
Time m_purge
time between purging expired duplicate entries
Definition: ipv4-l3-protocol.h:632
ns3::Ipv4L3Protocol::IsUnicast
bool IsUnicast(Ipv4Address ad) const
Check if an IPv4 address is unicast according to the node.
Definition: ipv4-l3-protocol.cc:692
ns3::Ipv4L3Protocol::AddInterface
uint32_t AddInterface(Ptr< NetDevice > device)
Definition: ipv4-l3-protocol.cc:391
ns3::Ipv4L3Protocol::GetNInterfaces
uint32_t GetNInterfaces(void) const
Definition: ipv4-l3-protocol.cc:440
ns3::Ipv4L3Protocol::Ipv4InterfaceReverseContainer
std::map< Ptr< const NetDevice >, uint32_t > Ipv4InterfaceReverseContainer
Container of NetDevices registered to IPv4 and their interface indexes.
Definition: ipv4-l3-protocol.h:447
ns3::Ipv4L3Protocol::DROP_ROUTE_ERROR
@ DROP_ROUTE_ERROR
Route error.
Definition: ipv4-l3-protocol.h:103
ns3::Ipv4L3Protocol::AddIpv4Interface
uint32_t AddIpv4Interface(Ptr< Ipv4Interface > interface)
Add an IPv4 interface to the stack.
Definition: ipv4-l3-protocol.cc:419
ns3::Ipv4L3Protocol::m_identification
std::map< std::pair< uint64_t, uint8_t >, uint16_t > m_identification
Identification (for each {src, dst, proto} tuple)
Definition: ipv4-l3-protocol.h:469
ns3::Ipv4L3Protocol::SetNode
void SetNode(Ptr< Node > node)
Set node associated with this stack.
Definition: ipv4-l3-protocol.cc:238
ns3::Ipv4L3Protocol::Fragments::GetTimeoutIter
FragmentsTimeoutsListI_t GetTimeoutIter()
Get the Timeout iterator.
Definition: ipv4-l3-protocol.cc:1714
ns3::Ipv4L3Protocol::SetDefaultTtl
void SetDefaultTtl(uint8_t ttl)
Definition: ipv4-l3-protocol.cc:384
ns3::Ipv4L3Protocol::m_cleanDpd
EventId m_cleanDpd
event to cleanup expired duplicate entries
Definition: ipv4-l3-protocol.h:633
ns3::Ipv4L3Protocol::DROP_INTERFACE_DOWN
@ DROP_INTERFACE_DOWN
Interface is down so can not send packet.
Definition: ipv4-l3-protocol.h:102
ns3::Ipv4L3Protocol::ProcessFragment
bool ProcessFragment(Ptr< Packet > &packet, Ipv4Header &ipHeader, uint32_t iif)
Process a packet fragment.
Definition: ipv4-l3-protocol.cc:1524
ns3::Ipv4L3Protocol::TxRxTracedCallback
void(* TxRxTracedCallback)(Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
TracedCallback signature for packet transmission or reception events.
Definition: ipv4-l3-protocol.h:246
ns3::Ipv4L3Protocol::SendRealOut
void SendRealOut(Ptr< Ipv4Route > route, Ptr< Packet > packet, Ipv4Header const &ipHeader)
Send packet with route.
Definition: ipv4-l3-protocol.cc:963
ns3::Ipv4L3Protocol::Fragments::AddFragment
void AddFragment(Ptr< Packet > fragment, uint16_t fragmentOffset, bool moreFragment)
Add a fragment.
Definition: ipv4-l3-protocol.cc:1581
ns3::Ipv4L3Protocol::RemoveDuplicates
void RemoveDuplicates(void)
Remove expired duplicates packet entry.
Definition: ipv4-l3-protocol.cc:1814
ns3::Ipv4L3Protocol::SetDown
void SetDown(uint32_t i)
Definition: ipv4-l3-protocol.cc:1361
ns3::Ipv4L3Protocol::IsForwarding
bool IsForwarding(uint32_t i) const
Definition: ipv4-l3-protocol.cc:1374
ns3::Ipv4L3Protocol::GetMtu
uint16_t GetMtu(uint32_t i) const
Definition: ipv4-l3-protocol.cc:1320
ns3::Ipv4L3Protocol::GetMetric
uint16_t GetMetric(uint32_t i) const
Definition: ipv4-l3-protocol.cc:1312
ns3::Ipv4L3Protocol::UpdateDuplicate
bool UpdateDuplicate(Ptr< const Packet > p, const Ipv4Header &header)
Registers duplicate entry, return false if new.
Definition: ipv4-l3-protocol.cc:1743
ns3::Ipv4L3Protocol::Remove
virtual void Remove(Ptr< IpL4Protocol > protocol)
Definition: ipv4-l3-protocol.cc:168
ns3::Ipv4L3Protocol
Implement the IPv4 layer.
Definition: ipv4-l3-protocol.h:81
ns3::Ipv4L3Protocol::m_defaultTtl
uint8_t m_defaultTtl
Default TTL.
Definition: ipv4-l3-protocol.h:468
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:256
ns3::Ipv4L3Protocol::GetIcmp
Ptr< Icmpv4L4Protocol > GetIcmp(void) const
Get ICMPv4 protocol.
Definition: ipv4-l3-protocol.cc:677
ns3::Ipv4L3Protocol::GetNetDevice
Ptr< NetDevice > GetNetDevice(uint32_t i)
Definition: ipv4-l3-protocol.cc:1391
ns3::Ipv4L3Protocol::DropTracedCallback
void(* DropTracedCallback)(const Ipv4Header &header, Ptr< const Packet > packet, DropReason reason, Ptr< Ipv4 > ipv4, uint32_t interface)
TracedCallback signature for packet drop events.
Definition: ipv4-l3-protocol.h:260
ns3::Ipv4L3Protocol::GetInterfaceForAddress
int32_t GetInterfaceForAddress(Ipv4Address addr) const
Return the interface number of the interface that has been assigned the specified IP address.
Definition: ipv4-l3-protocol.cc:447
ns3::Ipv4L3Protocol::GetWeakEsModel
virtual bool GetWeakEsModel(void) const
Get the Weak Es Model status.
Definition: ipv4-l3-protocol.cc:1423
ns3::NetDevice::PacketType
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:297
ns3::Ipv4L3Protocol::SetTimeout
FragmentsTimeoutsListI_t SetTimeout(FragmentKey_t key, Ipv4Header ipHeader, uint32_t iif)
Set a new timeout "event" for a fragmented packet.
Definition: ipv4-l3-protocol.cc:1849
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::Ipv4L3Protocol::SetupLoopback
void SetupLoopback(void)
Setup loopback interface.
Definition: ipv4-l3-protocol.cc:349
ns3::Ipv4L3Protocol::DupMap_t
std::map< DupTuple_t, Time > DupMap_t
Maps packet duplicate tuple to expiration time.
Definition: ipv4-l3-protocol.h:615
ns3::Ipv4L3Protocol::m_protocols
L4List_t m_protocols
List of transport protocol.
Definition: ipv4-l3-protocol.h:465
ns3::Ipv4L3Protocol::m_fragments
MapFragments_t m_fragments
Fragmented packets.
Definition: ipv4-l3-protocol.h:608
ns3::Ipv4L3Protocol::GetAddress
Ipv4InterfaceAddress GetAddress(uint32_t interfaceIndex, uint32_t addressIndex) const
Because addresses can be removed, the addressIndex is not guaranteed to be static across calls to thi...
Definition: ipv4-l3-protocol.cc:1168
ns3::Ipv4L3Protocol::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: ipv4-l3-protocol.cc:56
ns3::Ipv4L3Protocol::SetUp
void SetUp(uint32_t i)
Definition: ipv4-l3-protocol.cc:1336
ns3::Ipv4L3Protocol::SentTracedCallback
void(* SentTracedCallback)(const Ipv4Header &header, Ptr< const Packet > packet, uint32_t interface)
TracedCallback signature for packet send, forward, or local deliver events.
Definition: ipv4-l3-protocol.h:233
ns3::Ipv4L3Protocol::Send
void Send(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)
Definition: ipv4-l3-protocol.cc:750
ns3::Ipv4L3Protocol::Fragments::Fragments
Fragments()
Constructor.
Definition: ipv4-l3-protocol.cc:1569
ns3::Ipv4L3Protocol::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: ipv4-l3-protocol.cc:307
ns3::Ipv4L3Protocol::Insert
virtual void Insert(Ptr< IpL4Protocol > protocol)
Definition: ipv4-l3-protocol.cc:143
ns3::Ipv4L3Protocol::Fragments::m_fragments
std::list< std::pair< Ptr< Packet >, uint16_t > > m_fragments
The current fragments.
Definition: ipv4-l3-protocol.h:597