gridproxy.hh

来自「COPE the first practical network coding 」· HH 代码 · 共 77 行

HH
77
字号
#ifndef CLICK_GRID_PROXY_HH#define CLICK_GRID_PROXY_HH#include <click/element.hh>#include <click/ipaddress.hh>#include <click/glue.hh>#include <click/atomic.hh>#include <click/hashmap.hh>#include <clicknet/ip.h>CLICK_DECLS/* * =c * GridProxy(IP) * =d * a simple mobile-ip proxy * Input 0: ipip packets from a gateway * Input 1: ip packets for a mobile host * Output 0: ip packets for the outside world * Output 1: ipip packets for current "gateway" machine * * GridProxy tracks the last gateway a host sent an ip packet * through and when it receives packets for that host, it sends * then to the gateway it was last heard through using an  * ipip tunnel. */class GridProxy : public Element {   class DstInfo {  public:    IPAddress _ip;    timeval _last_updated;    IPAddress _gw;    DstInfo() {_ip = IPAddress(0); _last_updated.tv_sec = 0; _gw = IPAddress(0); }    DstInfo(IPAddress ip, IPAddress gw, timeval now) {      _ip = ip;      _last_updated = now;      _gw = gw;    }  };  typedef HashMap<IPAddress, DstInfo> ProxyMap;  ProxyMap _map;    click_ip _iph;  uatomic32_t _id;#if HAVE_FAST_CHECKSUM && FAST_CHECKSUM_ALIGNED  bool _aligned;#endif    void reverse_mapping(Packet *p_in);  void forward_mapping(Packet *p_in);  public:    GridProxy();    ~GridProxy();    const char *class_name() const { return "GridProxy"; }    const char *processing() const { return PUSH; }    int configure(Vector<String> &, ErrorHandler *);    int initialize(ErrorHandler *);    void add_handlers();    void cleanup(CleanupStage);    void push(int, Packet *);    static String static_print_stats(Element *e, void *);  String print_stats();    };#include <click/hashmap.cc>CLICK_ENDDECLS#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?