📄 aggregatefirst.hh
字号:
#ifndef CLICK_AGGREGATEFIRST_HH#define CLICK_AGGREGATEFIRST_HH#include <click/element.hh>#include "aggregatenotifier.hh"CLICK_DECLS/*=cAggregateFirst([I<KEYWORDS>])=s analysislets through first packet per aggregate annotation=dAggregateFirst forwards only the first packet with a given aggregateannotation value. Second and subsequent packets with that aggregate annotationare emitted on the second output, if it exists, or dropped if it does not.Keyword arguments are:=over 8=item NOTIFIERThe name of an AggregateNotifier element, like AggregateIPFlows. If given,then AggregateFirst will prune information about old aggregates. This can savesignificant memory on long traces.=back=nAggregateLast forwards the last packet with a given aggregate annotationvalue, and additionally annotates the packet with the observed packet and bytecounts. It takes significantly more memory, however.Only available in user-level processes.=aAggregateLast, AggregateIP, AggregateIPFlows, AggregateCounter, AggregateFilter */class AggregateFirst : public Element, public AggregateListener { public: AggregateFirst(); ~AggregateFirst(); const char *class_name() const { return "AggregateFirst"; } const char *processing() const { return "a/ah"; } void notify_noutputs(int); int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); inline Packet *smaction(Packet *); void push(int, Packet *); Packet *pull(int); void aggregate_notify(uint32_t, AggregateEvent, const Packet *); private: enum { ROW_BITS = 10, ROW_SHIFT = 0, NROW = 1<<ROW_BITS, ROW_MASK = NROW - 1, COL_BITS = 16, COL_SHIFT = ROW_BITS, NCOL = 1<<COL_BITS, COL_MASK = NCOL - 1, PLANE_BITS = 32 - ROW_BITS - COL_BITS, PLANE_SHIFT = COL_SHIFT + COL_BITS, NPLANE = 1<<PLANE_BITS, PLANE_MASK = NPLANE - 1 }; uint32_t **_kills[NPLANE]; AggregateNotifier *_agg_notifier; uint32_t *_counts[NPLANE]; uint32_t *create_row(uint32_t agg); inline uint32_t *row(uint32_t agg); };inline uint32_t *AggregateFirst::row(uint32_t agg){ if (uint32_t **p = _kills[(agg >> PLANE_SHIFT) & PLANE_MASK]) if (uint32_t *c = p[(agg >> COL_SHIFT) & COL_MASK]) return c; return create_row(agg);}CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -