📄 arptable.hh
字号:
#ifndef CLICK_ARPTABLE_HH#define CLICK_ARPTABLE_HH#include <click/element.hh>#include <click/ipaddress.hh>#include <click/etheraddress.hh>#include <click/bighashmap.hh>#include <click/glue.hh>CLICK_DECLS/*=cARPTable=s Wifi Tracks IP -> Ethernet mappings for other elements.=d Tracks ethernet to ip mappings for individual elements. This elementdoes not process packets.=h mappings read-onlyReturns a String with "EtherAddress IP" mappings on each line=h insert write-onlyInsert a "EtherAddress IP" pair into the table*/class ARPTable : public Element { public: ARPTable(); ~ARPTable(); const char *class_name() const { return "ARPTable"; } int configure(Vector<String> &, ErrorHandler *); void *cast(const char *n); bool can_live_reconfigure() const { return true; } void add_handlers(); void take_state(Element *e, ErrorHandler *); static String static_print_mappings(Element *e, void *); String print_mappings(); static int static_insert(const String &arg, Element *e, void *, ErrorHandler *errh); /* returns ff:ff:ff:ff:ff:ff if none is found */ EtherAddress lookup(IPAddress ip); IPAddress reverse_lookup(EtherAddress eth); int insert(IPAddress ip, EtherAddress eth); EtherAddress _bcast;private: // Poor man's ARP cache. class DstInfo { public: IPAddress _ip; EtherAddress _eth; struct timeval _when; // When we last heard from this node. DstInfo() { memset(this, 0, sizeof(*this)); } DstInfo(IPAddress ip) { memset(this, 0, sizeof(*this)); _ip = ip; } }; typedef HashMap<IPAddress, DstInfo> ATable; typedef HashMap<EtherAddress, IPAddress> RTable; typedef ATable::const_iterator ARPIter; ATable _table; RTable _rev_table;};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -