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> 40 class ClickTrivialTest;
41 class ClickIfidFromNameTest;
42 class ClickIpMacAddressFromNameTest;
51 class UniformRandomVariable;
63 friend class ::ClickTrivialTest;
64 friend class ::ClickIfidFromNameTest;
65 friend class ::ClickIpMacAddressFromNameTest;
83 void SetClickFile (std::string clickfile);
89 void SetDefines (std::map<std::string, std::string> defines);
95 void SetNodeName (std::string name);
101 void SetClickRoutingTableElement (std::string name);
109 std::string ReadHandler (std::string elementName, std::string handlerName);
118 int WriteHandler (std::string elementName, std::string handlerName, std::string writeString);
124 void SetPromisc (
int ifid);
128 simclick_node_t *m_simNode;
133 static std::map < simclick_node_t *, Ptr<Ipv4ClickRouting> > m_clickInstanceFromSimNode;
148 std::map<std::string, std::string> GetDefines (
void);
155 int GetInterfaceId (
const char *ifname);
162 std::string GetIpAddressFromInterfaceId (
int ifid);
169 std::string GetIpPrefixFromInterfaceId (
int ifid);
176 std::string GetMacAddressFromInterfaceId (
int ifid);
182 std::string GetNodeName ();
188 bool IsInterfaceReady (
int ifid);
200 void AddSimNodeToClickMapping ();
205 struct timeval GetTimevalFromNow () const;
210 void RunClickEvent ();
217 void HandleScheduleFromClick (
const struct timeval *when);
226 void HandlePacketFromClick (
int ifid,
int type,
const unsigned char *
data,
int len);
235 void SendPacketToClick (
int ifid,
int type,
const unsigned char *
data,
int len);
265 std::string m_clickFile;
266 std::map < std::string, std::string > m_defines;
267 std::string m_nodeName;
268 std::string m_clickRoutingTableElement;
271 std::map < std::string, uint32_t > m_ifaceIdFromName;
272 std::map < std::string, Address > m_ifaceMacFromName;
273 std::map < std::string, Ipv4Address > m_ifaceAddrFromName;
274 bool m_clickInitialised;
275 bool m_nonDefaultName;
virtual void DoInitialize(void)
Initialize() implementation.
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)
Destructor implementation.
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.
Unit
The unit to use to interpret a number representing time.
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)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) 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