20 #ifndef IPV4_CLICK_ROUTING_H
21 #define IPV4_CLICK_ROUTING_H
23 #include "ns3/ipv4-routing-protocol.h"
25 #include "ns3/object.h"
26 #include "ns3/packet.h"
32 #include <sys/types.h>
34 class ClickTrivialTest;
35 class ClickIfidFromNameTest;
36 class ClickIpMacAddressFromNameTest;
51 class UniformRandomVariable;
63 friend class ::ClickTrivialTest;
64 friend class ::ClickIfidFromNameTest;
65 friend class ::ClickIpMacAddressFromNameTest;
84 void SetClickFile(std::string clickfile);
90 void SetDefines(std::map<std::string, std::string> defines);
96 void SetNodeName(std::string name);
102 void SetClickRoutingTableElement(std::string name);
110 std::string ReadHandler(std::string elementName, std::string handlerName);
119 int WriteHandler(std::string elementName, std::string handlerName, std::string writeString);
125 void SetPromisc(
int ifid);
134 static std::map<simclick_node_t*, Ptr<Ipv4ClickRouting>> m_clickInstanceFromSimNode;
151 std::map<std::string, std::string> GetDefines();
158 int GetInterfaceId(
const char* ifname);
165 std::string GetIpAddressFromInterfaceId(
int ifid);
172 std::string GetIpPrefixFromInterfaceId(
int ifid);
179 std::string GetMacAddressFromInterfaceId(
int ifid);
185 std::string GetNodeName();
191 bool IsInterfaceReady(
int ifid);
204 void AddSimNodeToClickMapping();
209 struct timeval GetTimevalFromNow() const;
214 void RunClickEvent();
221 void HandleScheduleFromClick(
const struct timeval* when);
230 void HandlePacketFromClick(
int ifid,
int type,
const unsigned char*
data,
int len);
239 void SendPacketToClick(
int ifid,
int type,
const unsigned char*
data,
int len);
277 std::string m_clickFile;
278 std::map<std::string, std::string> m_defines;
279 std::string m_nodeName;
280 std::string m_clickRoutingTableElement;
282 std::map<std::string, uint32_t> m_ifaceIdFromName;
283 std::map<std::string, Address> m_ifaceMacFromName;
284 std::map<std::string, Ipv4Address> m_ifaceAddrFromName;
285 bool m_clickInitialised;
286 bool m_nonDefaultName;
Ipv4 addresses are stored in host order in this class.
Class to allow a node to use Click for external routing.
a class to store IPv4 address information on an interface
Abstract base class for IPv4 routing protocols.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)=0
Route an input packet (to be forwarded or locally delivered)
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const =0
Print the Routing Table entries.
virtual void NotifyInterfaceDown(uint32_t interface)=0
virtual Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)=0
Query routing cache for an existing route, for an outbound packet.
virtual void NotifyInterfaceUp(uint32_t interface)=0
static TypeId GetTypeId()
Get the type ID.
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual void SetIpv4(Ptr< Ipv4 > ipv4)=0
virtual void DoInitialize()
Initialize() implementation.
virtual void DoDispose()
Destructor implementation.
SocketErrno
Enumeration of the possible errors returned by a socket.
Unit
The unit to use to interpret a number representing time.
a unique identifier for an interface.
static void Send(Ptr< NetDevice > dev, int level, std::string emuMode)
struct simclick_node simclick_node_t
Every class exported by the ns3 library is enclosed in the ns3 namespace.