📄 aggregateipaddrpair.hh
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_AGGREGATEIPADDRPAIR_HH#define CLICK_AGGREGATEIPADDRPAIR_HH#include <click/element.hh>#include <click/hashtable.hh>#include "aggregatenotifier.hh"CLICK_DECLS/*=cAggregateIPAddrPair(I<KEYWORDS>)=s ipmeasuresets aggregate annotation based on IP source/destination address pair=dAggregateIPAddrPair sets the aggregate annotation on every passing packet to aflow number based on its IP address pair. Packets with the samesource-destination address pair are assigned the same aggregate number, as arereply packets (with source and destination addresses switched). The paintannotation is set to 0 or 1 to indicate which direction the packet was headed.Flow numbers are assigned sequentially, starting from 1. Different flows getdifferent numbers. Paint annotations are set to 0 or 1, depending on whetherpackets are on the forward or reverse subflow. (The first packet seen on eachflow gets paint color 0; reply packets get paint color 1.)Keywords are:=over 8=item TIMEOUTThe timeout for active address pairs, in seconds. Default is no timeout(address pairs never expire). If a timeout is specified, then informationabout an address pair is forgotten after that timeout passes; if the addresspair occurs again later, it will get a new aggregate annotation.=item REAPThe garbage collection interval. Default is 20 minutes of packet time.=backAggregateIPAddrPair is an AggregateNotifier, so AggregateListeners can requestnotifications when new aggregates are created and old ones are deleted.=h clear write-onlyClears all flow information. Future packets will get new aggregate annotationvalues.=aAggregateIPFlows, AggregateCounter, AggregateIP*/class AggregateIPAddrPair : public Element, public AggregateNotifier { public: AggregateIPAddrPair(); ~AggregateIPAddrPair(); const char *class_name() const { return "AggregateIPAddrPair"; } const char *port_count() const { return PORTS_1_1X2; } const char *processing() const { return PROCESSING_A_AH; } void *cast(const char *); int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void add_handlers(); Packet *simple_action(Packet *); struct HostPair { uint32_t a; uint32_t b; HostPair() : a(0), b(0) { } HostPair(uint32_t aa, uint32_t bb) { aa > bb ? (a = bb, b = aa) : (a = aa, b = bb); } inline hashcode_t hashcode() const; }; private: struct FlowInfo { Timestamp last_timestamp; uint32_t aggregate; bool reverse; FlowInfo() : aggregate(0) { } }; typedef HashTable<HostPair, FlowInfo> Map; Map _map; unsigned _active_sec; unsigned _gc_sec; int _timeout; unsigned _gc_interval; bool _timestamp_warning; uint32_t _next; void reap(); static int write_handler(const String &, Element *, void *, ErrorHandler *);};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -