📄 srforwarder.hh
字号:
#ifndef CLICK_SRForwarder_HH#define CLICK_SRForwarder_HH#include <click/element.hh>#include <click/glue.hh>#include <click/timer.hh>#include <click/ipaddress.hh>#include <click/etheraddress.hh>#include <elements/wifi/linktable.hh>#include <click/vector.hh>#include <elements/wifi/sr/path.hh>CLICK_DECLS/*=cSRForwarder(ETHERTYPE, IP, ETH, ARPTable element, LT LinkTable element [ETT element], [METRIC GridGenericMetric] )=s Wifi, Wireless RoutingForwards source-routed packets.=dDSR-inspired ad-hoc routing protocol.Input 0: packets that I receive off the wireOutput 0: Outgoing ethernet packets that I forwardOutput 1: packets that were addressed to me.Normally used in conjuction with ETT element */class SRForwarder : public Element { public: SRForwarder(); ~SRForwarder(); const char *class_name() const { return "SRForwarder"; } const char *processing() const { return PUSH; } int initialize(ErrorHandler *); int configure(Vector<String> &conf, ErrorHandler *errh); /* handler stuff */ void add_handlers(); static String static_print_stats(Element *e, void *); String print_stats(); static String static_print_routes(Element *e, void *); String print_routes(); static int static_clear(const String &arg, Element *e, void *, ErrorHandler *errh); void clear(); void push(int, Packet *); Packet *encap(Packet *, Vector<IPAddress>, int flags); IPAddress ip() { return _ip; }private: IPAddress _ip; // My IP address. EtherAddress _eth; // My ethernet address. uint16_t _et; // This protocol's ethertype // Statistics for handlers. int _datas; int _databytes; // wenjun's addition for more statistics int _rcv_pkts; int _rcv_bytes; int _pkts_to_host; int _bytes_to_host; int _fwd_pkts; int _fwd_bytes; EtherAddress _bcast; class LinkTable *_link_table; class ARPTable *_arp_table; class PathInfo { public: Path _p; int _seq; struct timeval _last_tx; void reset() { _seq = 0; } PathInfo() : _p() { reset(); } PathInfo(Path p) : _p(p) { reset(); } }; typedef HashMap<Path, PathInfo> PathTable; PathTable _paths; bool update_link(IPAddress from, IPAddress to, uint32_t seq, uint32_t age, uint32_t metric);};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -