📄 timefilter.hh
字号:
// -*- mode: c++; c-basic-offset: 4 -*-#ifndef CLICK_TIMEFILTER_HH#define CLICK_TIMEFILTER_HH#include <click/element.hh>CLICK_DECLSclass HandlerCall;/*=cTimeFilter(I<keywords START, START_AFTER, START_DELAY, END, END_AFTER, END_DELAY, INTERVAL, STOP, END_CALL>)=s timestampsfilter packets by timestamp=dTimeFilter passes packets through only if they lie within a timestamp range.You can specify that range absolutely or relative to the first timestampTimeFilter sees.Keyword arguments are:=over 8=item STARTI<T> is absolute time in seconds since the epoch. Output packets withtimestamps at least I<T>.=item START_AFTERI<T> is relative time in seconds (or use suffixes like `ms', `hr'). Outputpackets with timestamps at least I<T> seconds after the first packet seen.=item START_DELAYI<T> is relative time. Output packets with timestamps at least I<T> secondsafter initialize time.=item ENDI<T> is absolute time. Output packets with timestamps up to I<T>.=item END_AFTERI<T> is relative time. Output packets with timestamps up to I<T> seconds afterthe first packet seen.=item END_DELAYI<T> is relative time. Output packets with timestamps up to I<T> seconds afterinitialize time.=item INTERVALI<T> is relative time. Output packets for I<T> seconds after the start time,as specified by START or START_AFTER.=item STOPBoolean. If true, stop the driver once the end time is exceeded. Default isfalse.=item END_CALLSpecifies a write handler to call when the first packet after END is seen.The variable "$t" in the write handler argument is expanded to the packet'stimestamp. STOP and END_CALL are mutually exclusive.=backSupply at most one of START, START_AFTER, and START_DELAY, and at most one ofEND, END_AFTER, END_DELAY, and INTERVAL.=h start rwReturns or sets the START time. If you used START_AFTER or START_DELAY, thenthis handler returns garbage until a packet has passed.=h end rwReturns or sets the END time. If you used START_AFTER or START_DELAY, thenthis handler returns garbage until a packet has passed.=h interval rwReturns or sets the INTERVAL. Setting INTERVAL leaves the current START as isand adjusts END.=h extend_interval wTakes a timestamp. Extends the LAST time by that amount. If extend_intervalis called from an END_CALL handler, then the triggering packet is not dropped.=aSetTimestamp */class TimeFilter : public Element { public: TimeFilter(); ~TimeFilter(); const char *class_name() const { return "TimeFilter"; } const char *port_count() const { return PORTS_1_1X2; } const char *processing() const { return PROCESSING_A_AH; } int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void add_handlers(); Packet *simple_action(Packet *); private: Timestamp _first; Timestamp _last; bool _ready : 1; bool _first_relative : 1; bool _first_init_relative : 1; bool _last_relative : 1; bool _last_init_relative : 1; bool _last_interval : 1; bool _last_h_ready : 1; HandlerCall *_last_h; void first_packet(const Timestamp &); Packet *kill(Packet *); enum { h_start, h_end, h_interval, h_extend_interval }; static String read_handler(Element *, void *); static int write_handler(const String &, Element *, void*, ErrorHandler *);};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -