21 #ifndef IPV4_CLICK_ROUTING_H
22 #define IPV4_CLICK_ROUTING_H
24 #include "ns3/object.h"
25 #include "ns3/packet.h"
27 #include "ns3/ipv4-routing-protocol.h"
31 #include <sys/types.h>
34 #include <click/simclick.h>
47 class UniformRandomVariable;
59 friend class ClickTrivialTest;
60 friend class ClickIfidFromNameTest;
61 friend class ClickIpMacAddressFromNameTest;
79 void SetClickFile (std::string clickfile);
85 void SetDefines (std::map<std::string, std::string> defines);
91 void SetNodeName (std::string name);
97 void SetClickRoutingTableElement (std::string name);
105 std::string ReadHandler (std::string elementName, std::string handlerName);
114 int WriteHandler (std::string elementName, std::string handlerName, std::string writeString);
120 void SetPromisc (
int ifid);
124 simclick_node_t *m_simNode;
129 static std::map < simclick_node_t *, Ptr<Ipv4ClickRouting> > m_clickInstanceFromSimNode;
144 std::map<std::string, std::string> GetDefines (
void);
151 int GetInterfaceId (
const char *ifname);
158 std::string GetIpAddressFromInterfaceId (
int ifid);
165 std::string GetIpPrefixFromInterfaceId (
int ifid);
172 std::string GetMacAddressFromInterfaceId (
int ifid);
178 std::string GetNodeName ();
184 bool IsInterfaceReady (
int ifid);
196 void AddSimNodeToClickMapping ();
201 struct timeval GetTimevalFromNow () const;
206 void RunClickEvent ();
213 void HandleScheduleFromClick (
const struct timeval *when);
222 void HandlePacketFromClick (
int ifid,
int type,
const unsigned char *
data,
int len);
231 void SendPacketToClick (
int ifid,
int type,
const unsigned char *data,
int len);
261 std::string m_clickFile;
262 std::map < std::string, std::string > m_defines;
263 std::string m_nodeName;
264 std::string m_clickRoutingTableElement;
267 std::map < std::string, uint32_t > m_ifaceIdFromName;
268 std::map < std::string, Address > m_ifaceMacFromName;
269 std::map < std::string, Ipv4Address > m_ifaceAddrFromName;
270 bool m_clickInitialised;
271 bool m_nonDefaultName;