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;
virtual void SetIpv4(Ptr< Ipv4 > ipv4)=0
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual void NotifyInterfaceUp(uint32_t interface)=0
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
SocketErrno
Enumeration of the possible errors returned by a socket.
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
Class to allow a node to use Click for external routing.
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) const =0
Print the Routing Table entries.
Ipv4 addresses are stored in host order in this class.
a class to store IPv4 address information on an interface
Abstract base class for IPv4 routing protocols.
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.
static TypeId GetTypeId(void)
Get the type ID.
a unique identifier for an interface.
virtual void NotifyInterfaceDown(uint32_t interface)=0
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.