21 #ifndef IPV4_L3_PROTOCOL_H
22 #define IPV4_L3_PROTOCOL_H
28 #include "ns3/ipv4-address.h"
30 #include "ns3/net-device.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"
45 class Ipv4RoutingTableEntry;
49 class Ipv4RawSocketImpl;
51 class Icmpv4L4Protocol;
80 static TypeId GetTypeId (
void);
81 static const uint16_t PROT_NUMBER;
196 bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
198 Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope);
201 void SetMetric (uint32_t i, uint16_t metric);
203 uint16_t
GetMtu (uint32_t i)
const;
204 bool IsUp (uint32_t i)
const;
205 void SetUp (uint32_t i);
226 virtual void SetIpForward (
bool forward);
227 virtual bool GetIpForward (
void)
const;
228 virtual void SetWeakEsModel (
bool model);
229 virtual bool GetWeakEsModel (
void)
const;
235 uint16_t payloadSize,
259 void SetupLoopback (
void);
293 typedef std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
294 typedef std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
295 typedef std::list<Ptr<IpL4Protocol> > L4List_t;
299 L4List_t m_protocols;
300 Ipv4InterfaceList m_interfaces;
301 uint8_t m_defaultTos;
302 uint8_t m_defaultTtl;
303 uint16_t m_identification;
318 SocketList m_sockets;
376 typedef std::map< std::pair<uint64_t, uint32_t>,
Ptr<Fragments> > MapFragments_t;
377 typedef std::map< std::pair<uint64_t, uint32_t>,
EventId > MapFragmentsTimers_t;
383 Time m_fragmentExpirationTimeout;
384 MapFragmentsTimers_t m_fragmentsTimers;
void SetDefaultTtl(uint8_t ttl)
Ptr< Packet > GetPacket() const
Get the entire packet.
virtual void NotifyNewAggregate()
a class to represent an Ipv4 address mask
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
std::list< std::pair< Ptr< Packet >, uint16_t > > m_fragments
The current fragments.
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...
uint32_t AddInterface(Ptr< NetDevice > device)
a polymophic address class
Ipv4InterfaceAddress GetAddress(uint32_t interfaceIndex, uint32_t addressIndex) const
DropReason
Reason why a packet has been dropped.
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.
Ptr< Icmpv4L4Protocol > GetIcmp(void) const
Get ICMPv4 protocol.
bool IsEntire() const
If all fragments have been added.
void SetMetric(uint32_t i, uint16_t metric)
virtual void DoDispose(void)
Ptr< Socket > CreateRawSocket(void)
Creates a raw socket.
void Send(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)
bool IsUp(uint32_t i) const
MapFragments_t m_fragments
The hash of fragmented packets.
void SendWithHeader(Ptr< Packet > packet, Ipv4Header ipHeader, Ptr< Ipv4Route > route)
A Set of Fragment belonging to the same packet (src, dst, identification and proto) ...
bool RemoveAddress(uint32_t interfaceIndex, uint32_t addressIndex)
void AddFragment(Ptr< Packet > fragment, uint16_t fragmentOffset, bool moreFragment)
Add a fragment.
Access to the Ipv4 forwarding table, interfaces, and configuration.
void SetForwarding(uint32_t i, bool val)
Implement the Ipv4 layer.
int32_t GetInterfaceForAddress(Ipv4Address addr) const
Return the interface number of the interface that has been assigned the specified IP address...
void DoFragmentation(Ptr< Packet > packet, uint32_t outIfaceMtu, std::list< Ptr< Packet > > &listFragments)
Fragment a packet.
Ptr< NetDevice > GetNetDevice(uint32_t i)
bool ProcessFragment(Ptr< Packet > &packet, Ipv4Header &ipHeader, uint32_t iif)
Process a packet fragment.
void Remove(Ptr< IpL4Protocol > protocol)
Ipv4 addresses are stored in host order in this class.
a class to store IPv4 address information on an interface
an identifier for simulation events.
void DeleteRawSocket(Ptr< Socket > socket)
Deletes a particular raw socket.
bool AddAddress(uint32_t i, Ipv4InterfaceAddress address)
void Insert(Ptr< IpL4Protocol > protocol)
uint32_t GetNAddresses(uint32_t interface) const
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)
uint32_t GetNInterfaces(void) const
Ptr< IpL4Protocol > GetProtocol(int protocolNumber) const
uint16_t GetMetric(uint32_t i) const
Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(void) const
Get the routing protocol to be used by this Ipv4 stack.
A template-based reference counting class.
a unique identifier for an interface.
void HandleFragmentsTimeout(std::pair< uint64_t, uint32_t > key, Ipv4Header &ipHeader, uint32_t iif)
Process the timeout for packet fragments.
bool m_moreFragment
True if other fragments will be sent.
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.