21 #include "ns3/packet.h"
23 #include "ns3/callback.h"
24 #include "ns3/ipv4-address.h"
25 #include "ns3/ipv4-route.h"
27 #include "ns3/socket.h"
28 #include "ns3/net-device.h"
29 #include "ns3/uinteger.h"
30 #include "ns3/trace-source-accessor.h"
31 #include "ns3/object-vector.h"
32 #include "ns3/ipv4-header.h"
33 #include "ns3/boolean.h"
34 #include "ns3/ipv4-routing-table-entry.h"
57 .AddConstructor<Ipv4L3Protocol> ()
58 .AddAttribute (
"DefaultTos",
"The TOS value set by default on all outgoing packets generated on this node.",
61 MakeUintegerChecker<uint8_t> ())
62 .AddAttribute (
"DefaultTtl",
"The TTL value set by default on all outgoing packets generated on this node.",
65 MakeUintegerChecker<uint8_t> ())
66 .AddAttribute (
"FragmentExpirationTimeout",
67 "When this timeout expires, the fragments will be cleared from the buffer.",
71 .AddTraceSource (
"Tx",
"Send ipv4 packet to outgoing interface.",
73 .AddTraceSource (
"Rx",
"Receive ipv4 packet from incoming interface.",
75 .AddTraceSource (
"Drop",
"Drop ipv4 packet",
77 .AddAttribute (
"InterfaceList",
"The set of Ipv4 interfaces associated to this Ipv4 stack.",
80 MakeObjectVectorChecker<Ipv4Interface> ())
82 .AddTraceSource (
"SendOutgoing",
"A newly-generated packet by this node is about to be queued for transmission",
84 .AddTraceSource (
"UnicastForward",
"A unicast IPv4 packet was received by this node and is being forwarded to another node",
86 .AddTraceSource (
"LocalDeliver",
"An IPv4 packet was received by/for this node, and it is being forward up the stack",
94 : m_identification (0)
117 if ((*i)->GetProtocolNumber () == protocolNumber)
226 if (it->second.IsRunning ())
228 it->second.Cancel ();
255 device = CreateObject<LoopbackNetDevice> ();
258 interface->SetDevice (device);
259 interface->SetNode (
m_node);
261 interface->AddAddress (ifaceAddr);
292 interface->SetNode (
m_node);
293 interface->SetDevice (device);
330 int32_t
interface = 0;
331 for (Ipv4InterfaceList::const_iterator i =
m_interfaces.begin ();
335 for (uint32_t j = 0; j < (*i)->GetNAddresses (); j++)
337 if ((*i)->GetAddress (j).GetLocal () ==
address)
353 int32_t
interface = 0;
354 for (Ipv4InterfaceList::const_iterator i =
m_interfaces.begin ();
358 for (uint32_t j = 0; j < (*i)->GetNAddresses (); j++)
360 if ((*i)->GetAddress (j).GetLocal ().CombineMask (mask) == address.
CombineMask (mask))
375 int32_t
interface = 0;
376 for (Ipv4InterfaceList::const_iterator i =
m_interfaces.begin ();
380 if ((*i)->GetDevice () == device)
399 NS_LOG_LOGIC (
"For me (destination " << address <<
" match)");
412 if (MulticastCheckGroup (iif, address ))
431 if (j == uint32_t (iif))
continue;
437 NS_LOG_LOGIC (
"For me (destination " << address <<
" match) on another interface");
443 NS_LOG_LOGIC (
"For me (interface broadcast address on another interface)");
456 NS_LOG_FUNCTION (
this << device << p << protocol << from << to << packetType);
458 NS_LOG_LOGIC (
"Packet from " << from <<
" received on node " <<
461 uint32_t
interface = 0;
465 for (Ipv4InterfaceList::const_iterator i =
m_interfaces.begin ();
470 if (ipv4Interface->
GetDevice () == device)
472 if (ipv4Interface->
IsUp ())
479 NS_LOG_LOGIC (
"Dropping received packet -- interface is down");
481 packet->RemoveHeader (ipHeader);
493 packet->RemoveHeader (ipHeader);
498 packet->RemoveAtEnd (packet->GetSize () - ipHeader.
GetPayloadSize ());
503 NS_LOG_LOGIC (
"Dropping received packet -- checksum not ok");
512 socket->
ForwardUp (packet, ipHeader, ipv4Interface);
523 NS_LOG_WARN (
"No route found for forwarding packet. Drop.");
570 NS_LOG_FUNCTION (
this << packet << source << destination << uint32_t (protocol) << route);
573 bool mayFragment =
true;
600 NS_LOG_LOGIC (
"Ipv4L3Protocol::Send case 1: limited broadcast");
601 ipHeader =
BuildHeader (source, destination, protocol, packet->
GetSize (), ttl, tos, mayFragment);
602 uint32_t ifaceIndex = 0;
603 for (Ipv4InterfaceList::iterator ifaceIter =
m_interfaces.begin ();
604 ifaceIter !=
m_interfaces.end (); ifaceIter++, ifaceIndex++)
614 outInterface->
Send (packetCopy, destination);
620 uint32_t ifaceIndex = 0;
621 for (Ipv4InterfaceList::iterator ifaceIter =
m_interfaces.begin ();
622 ifaceIter !=
m_interfaces.end (); ifaceIter++, ifaceIndex++)
633 ipHeader =
BuildHeader (source, destination, protocol, packet->
GetSize (), ttl, tos, mayFragment);
636 packetCopy->AddHeader (ipHeader);
638 outInterface->
Send (packetCopy, destination);
648 NS_LOG_LOGIC (
"Ipv4L3Protocol::Send case 3: passed in with route");
649 ipHeader =
BuildHeader (source, destination, protocol, packet->
GetSize (), ttl, tos, mayFragment);
662 NS_FATAL_ERROR (
"Ipv4L3Protocol::Send case 4: This case not yet implemented");
665 NS_LOG_LOGIC (
"Ipv4L3Protocol::Send case 5: passed in with no route " << destination);
668 ipHeader =
BuildHeader (source, destination, protocol, packet->
GetSize (), ttl, tos, mayFragment);
676 NS_LOG_ERROR (
"Ipv4L3Protocol::Send: m_routingProtocol == 0");
699 uint16_t payloadSize,
704 NS_LOG_FUNCTION (
this << source << destination << (uint16_t)protocol << payloadSize << (uint16_t)ttl << (uint16_t)tos << mayFragment);
712 if (mayFragment ==
true)
746 int32_t
interface = GetInterfaceForDevice (outDev);
749 NS_LOG_LOGIC (
"Send via NetDevice ifIndex " << outDev->GetIfIndex () <<
" ipv4InterfaceIndex " << interface);
753 if (outInterface->IsUp ())
756 if ( packet->
GetSize () > outInterface->GetDevice ()->GetMtu () )
758 std::list<Ptr<Packet> > listFragments;
759 DoFragmentation (packet, outInterface->GetDevice ()->GetMtu (), listFragments);
760 for (
std::list<
Ptr<Packet> >::iterator it = listFragments.begin (); it != listFragments.end (); it++ )
763 outInterface->Send (*it, route->
GetGateway ());
769 outInterface->Send (packet, route->
GetGateway ());
782 if (outInterface->IsUp ())
785 if ( packet->
GetSize () > outInterface->GetDevice ()->GetMtu () )
787 std::list<Ptr<Packet> > listFragments;
788 DoFragmentation (packet, outInterface->GetDevice ()->GetMtu (), listFragments);
789 for (
std::list<
Ptr<Packet> >::iterator it = listFragments.begin (); it != listFragments.end (); it++ )
819 std::map<uint32_t, uint32_t> ttlMap = mrtentry->GetOutputTtlMap ();
820 std::map<uint32_t, uint32_t>::iterator mapIter;
822 for (mapIter = ttlMap.begin (); mapIter != ttlMap.end (); mapIter++)
824 uint32_t interfaceId = mapIter->first;
836 NS_LOG_LOGIC (
"Forward multicast via interface " << interfaceId);
857 ipHeader.SetTtl (ipHeader.GetTtl () - 1);
858 if (ipHeader.GetTtl () == 0)
862 ipHeader.GetDestination ().IsBroadcast () ==
false &&
863 ipHeader.GetDestination ().IsMulticast () ==
false)
866 icmp->SendTimeExceededTtl (ipHeader, packet);
885 NS_LOG_LOGIC (
"Received a fragment, processing " << *p );
886 bool isPacketComplete;
888 if ( isPacketComplete ==
false)
892 NS_LOG_LOGIC (
"Got last fragment, Packet is complete " << *p );
921 bool subnetDirected =
false;
928 subnetDirected =
true;
931 if (subnetDirected ==
false)
933 GetIcmp ()->SendDestUnreachPort (ipHeader, copy);
944 bool retVal = interface->
AddAddress (address);
1025 if (iaddr.
GetScope () > scope)
continue;
1056 NS_LOG_WARN (
"Could not find source address for " << dst <<
" and scope "
1057 << scope <<
", returning 0");
1082 return interface->
GetDevice ()->GetMtu ();
1090 return interface->
IsUp ();
1103 if (interface->GetDevice ()->GetMtu () >= 68)
1105 interface->
SetUp ();
1114 NS_LOG_LOGIC (
"Interface " <<
int(i) <<
" is set to be down for IPv4. Reason: not respecting minimum IPv4 MTU (68 octects)");
1136 NS_LOG_LOGIC (
"Forwarding state: " << interface->IsForwarding ());
1137 return interface->IsForwarding ();
1162 (*i)->SetForwarding (forward);
1191 NS_LOG_LOGIC (
"Route input failure-- dropping packet to " << ipHeader <<
" with errno " << sockErrno);
1211 "IPv4 fragmentation implementation only works without option headers." );
1213 uint16_t offset = 0;
1214 bool moreFragment =
true;
1215 uint16_t originalOffset = 0;
1216 bool alreadyFragmented =
false;
1217 uint32_t currentFragmentablePartSize = 0;
1221 alreadyFragmented =
true;
1228 uint32_t fragmentSize = (outIfaceMtu - ipv4Header.
GetSerializedSize () ) & ~uint32_t (0x7);
1230 NS_LOG_LOGIC (
"Fragmenting - Target Size: " << fragmentSize );
1236 if (p->
GetSize () > offset + fragmentSize )
1238 moreFragment =
true;
1239 currentFragmentablePartSize = fragmentSize;
1244 moreFragment =
false;
1245 currentFragmentablePartSize = p->
GetSize () - offset;
1246 if (alreadyFragmented)
1256 NS_LOG_LOGIC (
"Fragment creation - " << offset <<
", " << currentFragmentablePartSize );
1270 NS_LOG_LOGIC (
"New fragment Header " << fragmentHeader);
1273 std::ostringstream oss;
1274 fragment->
Print (oss);
1278 listFragments.push_back (fragment);
1280 offset += currentFragmentablePartSize;
1283 while (moreFragment);
1295 std::pair<uint64_t, uint32_t> key;
1299 key.first = addressCombination;
1300 key.second = idProto;
1304 MapFragments_t::iterator it =
m_fragments.find (key);
1307 fragments = Create<Fragments> ();
1308 m_fragments.insert (std::make_pair (key, fragments));
1311 key, ipHeader, iif);
1315 fragments = it->second;
1340 : m_moreFragment (0)
1355 std::list<std::pair<Ptr<Packet>, uint16_t> >::iterator it;
1359 if (it->second > fragmentOffset)
1367 m_moreFragment = moreFragment;
1378 bool ret = !m_moreFragment &&
m_fragments.size () > 0;
1382 uint16_t lastEndOffset = 0;
1387 NS_LOG_LOGIC (
"Checking overlaps " << lastEndOffset <<
" - " << it->second );
1389 if (lastEndOffset < it->second)
1395 uint16_t fragmentEnd = it->first->GetSize () + it->second;
1396 lastEndOffset = std::max ( lastEndOffset, fragmentEnd );
1408 std::list<std::pair<Ptr<Packet>, uint16_t> >::const_iterator it =
m_fragments.begin ();
1411 uint16_t lastEndOffset = p->
GetSize ();
1416 if ( lastEndOffset > it->second )
1422 uint32_t newStart = lastEndOffset - it->second;
1423 if ( it->first->GetSize () > newStart )
1425 uint32_t newSize = it->first->GetSize () - newStart;
1426 Ptr<Packet> tempFragment = it->first->CreateFragment (newStart, newSize);
1435 lastEndOffset = p->
GetSize ();
1446 std::list<std::pair<Ptr<Packet>, uint16_t> >::const_iterator it =
m_fragments.begin ();
1449 uint16_t lastEndOffset = 0;
1458 if ( lastEndOffset > it->second )
1460 uint32_t newStart = lastEndOffset - it->second;
1461 uint32_t newSize = it->first->GetSize () - newStart;
1462 Ptr<Packet> tempFragment = it->first->CreateFragment (newStart, newSize);
1465 else if ( lastEndOffset == it->second )
1470 lastEndOffset = p->
GetSize ();
1481 MapFragments_t::iterator it =
m_fragments.find (key);
1482 Ptr<Packet> packet = it->second->GetPartialPacket ();
1488 icmp->SendTimeExceededTtl (ipHeader, packet);
void SetDown(void)
Disable this interface.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
bool m_weakEsModel
Weak ES model state.
void SetForwarding(bool val)
InterfaceAddressScope_e
Address scope.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberContainer)
void SetDefaultTtl(uint8_t ttl)
virtual void SetIpForward(bool forward)
Set or unset the IP forwarding state.
void Receive(Ptr< NetDevice > device, Ptr< const Packet > p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
Receive a packet.
Ptr< Packet > GetPacket() const
Get the entire packet.
static Ipv4Address GetAny(void)
#define NS_LOG_FUNCTION(parameters)
virtual void NotifyNewAggregate()
This function will notify other components connected to the node that a new stack member is now conne...
Time m_fragmentExpirationTimeout
Expiration timeout.
Ipv4Mask GetMask(void) const
Get the network mask.
Ipv4Address GetLocal(void) const
Get the local address.
uint8_t GetTos(void) const
Get the tag's TOS.
TracedCallback< const Ipv4Header &, Ptr< const Packet >, uint32_t > m_sendOutgoingTrace
Trace of sent packets.
a class to represent an Ipv4 address mask
void Send(Ptr< Packet > p, Ipv4Address dest)
static bool ChecksumEnabled(void)
bool IsLocalMulticast(void) const
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual bool GetWeakEsModel(void) const
Get the Weak Es Model status.
void SetNode(Ptr< Node > node)
Set the node associated with this socket.
uint32_t GetSize(void) const
bool IsMulticast(void) const
Ipv4Address CombineMask(Ipv4Mask const &mask) const
Combine this address with a network mask.
Fragment timeout exceeded.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
int32_t GetInterfaceForDevice(Ptr< const NetDevice > device) const
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...
bool AddAddress(Ipv4InterfaceAddress address)
uint32_t AddInterface(Ptr< NetDevice > device)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
TracedCallback< const Ipv4Header &, Ptr< const Packet >, DropReason, Ptr< Ipv4 >, uint32_t > m_dropTrace
Trace of dropped packets.
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
void Print(std::ostream &os) const
SocketErrno
Enumeration of the possible errors returned by a socket.
Ptr< Ipv4RoutingProtocol > m_routingProtocol
Routing protocol associated with the stack.
uint8_t m_defaultTos
Default TOS.
#define NS_FATAL_ERROR(msg)
fatal error handling
L4List_t m_protocols
List of transport protocol.
a polymophic address class
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...
void SetSource(Ipv4Address src)
Ptr< T > CreateObject(void)
bool IsSubnetDirectedBroadcast(Ipv4Mask const &mask) const
Generate subnet-directed broadcast address corresponding to mask.
Ptr< NetDevice > GetOutputDevice(void) const
Ipv4InterfaceList m_interfaces
List of IPv4 interfaces.
bool IsDestinationAddress(Ipv4Address address, uint32_t iif) const
Determine whether address and interface corresponding to received packet can be accepted for local de...
Ptr< Packet > GetPartialPacket() const
Get the complete part of the packet.
TracedCallback< Ptr< const Packet >, Ptr< Ipv4 >, uint32_t > m_rxTrace
Trace of received packets.
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
void SetupLoopback(void)
Setup loopback interface.
hold objects of type ns3::Time
Ptr< Icmpv4L4Protocol > GetIcmp(void) const
Get ICMPv4 protocol.
uint32_t Get(void) const
Get the host-order 32-bit IP address.
void SetGateway(Ipv4Address gw)
TracedCallback< Ptr< const Packet >, Ptr< Ipv4 >, uint32_t > m_txTrace
Trace of transmitted packets.
Hold an unsigned integer type.
TracedCallback< const Ipv4Header &, Ptr< const Packet >, uint32_t > m_localDeliverTrace
Trace of locally delivered packets.
bool IsEntire() const
If all fragments have been added.
void SetMetric(uint32_t i, uint16_t metric)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
bool IsBroadcast(void) const
T * PeekPointer(const Ptr< T > &p)
Ptr< NetDevice > GetDevice(uint32_t index) const
Ptr< Socket > CreateRawSocket(void)
Creates a raw socket.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual enum RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)=0
Called from lower-level layers to send the packet up in the stack.
void Send(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)
static TypeId GetTypeId(void)
Get the type ID.
bool IsUp(uint32_t i) const
MapFragments_t m_fragments
Fragmented packets.
void SendWithHeader(Ptr< Packet > packet, Ipv4Header ipHeader, Ptr< Ipv4Route > route)
void IpForward(Ptr< Ipv4Route > rtentry, Ptr< const Packet > p, const Ipv4Header &header)
Forward a packet.
#define NS_LOG_LOGIC(msg)
Ipv4Address GetGateway(void) const
bool RemoveAddress(uint32_t interfaceIndex, uint32_t addressIndex)
Remove the address at addressIndex on named interface.
bool IsSecondary(void) const
Check if the address is a secondary address.
void AddFragment(Ptr< Packet > fragment, uint16_t fragmentOffset, bool moreFragment)
Add a fragment.
Ipv4InterfaceAddress GetAddress(uint32_t index) const
virtual void NotifyNewAggregate(void)
This method is invoked whenever two sets of objects are aggregated together.
Access to the Ipv4 forwarding table, interfaces, and configuration.
bool m_ipForward
Forwarding packets (i.e.
uint32_t GetNDevices(void) const
void SetForwarding(uint32_t i, bool val)
Ptr< Packet > Copy(void) const
NS_LOG_COMPONENT_DEFINE("Ipv4L3Protocol")
static const uint16_t PROT_NUMBER
ARP protocol number (0x0806)
int32_t GetInterfaceForAddress(Ipv4Address addr) const
Return the interface number of the interface that has been assigned the specified IP address...
bool IsEqual(const Ipv4Address &other) const
Comparison operation between two Ipv4Addresses.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
uint16_t m_identification
Identification.
void DoFragmentation(Ptr< Packet > packet, uint32_t outIfaceMtu, std::list< Ptr< Packet > > &listFragments)
Fragment a packet.
Ptr< Node > m_node
Node attached to stack.
void RouteInputError(Ptr< const Packet > p, const Ipv4Header &ipHeader, Socket::SocketErrno sockErrno)
Fallback when no route is found.
Ipv4Header BuildHeader(Ipv4Address source, Ipv4Address destination, uint8_t protocol, uint16_t payloadSize, uint8_t ttl, uint8_t tos, bool mayFragment)
Construct an IPv4 header.
void SendRealOut(Ptr< Ipv4Route > route, Ptr< Packet > packet, Ipv4Header const &ipHeader)
Send packet with route.
static Time Now(void)
Return the "current simulation time".
void SetOutputDevice(Ptr< NetDevice > outputDevice)
Equivalent in Linux to dst_entry.dev.
static Ipv4Address GetLoopback(void)
static Ipv4Mask GetLoopback(void)
void RegisterProtocolHandler(ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false)
Ptr< NetDevice > GetNetDevice(uint32_t i)
uint16_t GetMetric(void) const
#define NS_ASSERT_MSG(condition, message)
bool ProcessFragment(Ptr< Packet > &packet, Ipv4Header &ipHeader, uint32_t iif)
Process a packet fragment.
uint32_t AddIpv4Interface(Ptr< Ipv4Interface > interface)
Add an IPv4 interface to the stack.
void Remove(Ptr< IpL4Protocol > protocol)
Ipv4 addresses are stored in host order in this class.
Ipv4Address GetBroadcast(void) const
Get the broadcast address.
virtual void SetWeakEsModel(bool model)
Set or unset the Weak Es Model.
void SetNode(Ptr< Node > node)
Set node associated with this stack.
uint32_t AddDevice(Ptr< NetDevice > device)
uint32_t GetId(void) const
a class to store IPv4 address information on an interface
SocketList m_sockets
List of IPv4 raw sockets.
void DeleteRawSocket(Ptr< Socket > socket)
Deletes a particular raw socket.
bool AddAddress(uint32_t i, Ipv4InterfaceAddress address)
Ptr< NetDevice > GetDevice(void) const
Ptr< Ipv4Interface > GetInterface(uint32_t i) const
Get an interface.
static uint16_t GetStaticProtocolNumber(void)
Get the protocol number.
void Insert(Ptr< IpL4Protocol > protocol)
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
void LocalDeliver(Ptr< const Packet > p, Ipv4Header const &ip, uint32_t iif)
Deliver a packet.
void IpMulticastForward(Ptr< Ipv4MulticastRoute > mrtentry, Ptr< const Packet > p, const Ipv4Header &header)
Forward a multicast packet.
uint32_t GetNAddresses(uint32_t interface) const
MapFragmentsTimers_t m_fragmentsTimers
Expiration events.
uint16_t GetMtu(uint32_t i) const
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...
bool ForwardUp(Ptr< const Packet > p, Ipv4Header ipHeader, Ptr< Ipv4Interface > incomingInterface)
Forward up to receive method.
Ipv4InterfaceAddress::InterfaceAddressScope_e GetScope(void) const
Get address scope.
uint8_t m_defaultTtl
Default TTL.
uint32_t GetNInterfaces(void) const
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Ptr< IpL4Protocol > GetProtocol(int protocolNumber) const
Interface is down so can not send packet.
void SetMetric(uint16_t metric)
#define NS_LOG_ERROR(msg)
bool IsUnicast(Ipv4Address ad, Ipv4Mask interfaceMask) const
Check if an IPv4 address is unicast.
uint8_t GetTtl(void) const
Get the tag's TTL.
PacketType
Packet types are used as they are in Linux.
TracedCallback< const Ipv4Header &, Ptr< const Packet >, uint32_t > m_unicastForwardTrace
Trace of unicast forwarded packets.
contain a set of ns3::Object pointers.
uint16_t GetMetric(uint32_t i) const
Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(void) const
Get the routing protocol to be used by this Ipv4 stack.
indicates whether the socket has IP_TOS set.
Ptr< T > GetObject(void) const
uint32_t GetNAddresses(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
virtual ~Ipv4L3Protocol()
void HandleFragmentsTimeout(std::pair< uint64_t, uint32_t > key, Ipv4Header &ipHeader, uint32_t iif)
Process the timeout for packet fragments.
virtual bool GetIpForward(void) const
Get the IP forwarding state.
void AddHeader(const Header &header)
Add header to this packet.
static const uint8_t PROT_NUMBER
ICMP protocol number (0x1)
static const uint16_t PROT_NUMBER
Protocol number (0x0800)
void SetDestination(Ipv4Address dest)
bool IsUp(void) const
These are IP interface states and may be distinct from NetDevice states, such as found in real implem...
void SetUp(void)
Enable this interface.
bool IsForwarding(uint32_t i) const
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...
void SetRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol)
Register a new routing protocol to be used by this Ipv4 stack.