📄 icmpsendpings.hh
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_ICMPSENDPINGS_HH#define CLICK_ICMPSENDPINGS_HH#include <click/element.hh>#include <click/timer.hh>#include <click/ipaddress.hh>CLICK_DECLS/*=cICMPPingSource(SADDR, DADDR [, I<keywords> INTERVAL, IDENTIFIER, LIMIT, DATA,ACTIVE])=s ICMP, sourcesperiodically sends ICMP echo requests=dPeriodically emits ping packets with source IP address SRC and destinationaddress DST. Advances the "sequence" field by one each time. (The sequencefield is stored in network byte order in the packet.) When its output ispull, generates a ping packet on every pull.ICMPPingSource's optional input accepts replies to the pings it sends. If yousend replies to this input, ICMPPingSource will print reply reports and keeploss and RTT statistics like the ping(1) program. You can access thosestistics with the "C<summary>" handler.Keyword arguments are:=over 8=item INTERVALAmount of time between pings, in seconds. Default is 1.=item IDENTIFIERInteger. Determines the ICMP identifier field in emitted pings. Default is0.=item LIMITInteger. The number of pings to send; but if LIMIT is negative, sends pingsforever. Default is -1.=item DATAString. Extra data in emitted pings. Default is the empty string (nothing).=item ACTIVEBoolean. Whether ICMPPingSource is active. Default is true.=item VERBOSEBoolean. Whether ICMPPingSource should print reports when echo repliesarrive. Default is true.=back=h active read/writeReturns or sets the ACTIVE argument.=h count read-onlyReports the number of packets sent so far.=h limit write-onlySets the LIMIT argument.=h interval write-onlySets the INTERVAL argument.=h reset_counts write-onlyResets all counters to zero.=h summary read-onlyReturns ping(1)-style summary information: number of packets sent andreceived, loss rate, and RTT statistics. Only available if ICMPPingSource hadan input.=h rtt_min read-onlyReturns the minimum RTT observed, or 0 if no RTTs have been observed. Onlyavailable if ICMPPingSource had an input.=h rtt_max read-onlyReturns the maximum RTT observed, or 0 if no RTTs have been observed. Onlyavailable if ICMPPingSource had an input.=h rtt_avg read-onlyReturns the average RTT observed, or 0 if no RTTs have been observed. Onlyavailable if ICMPPingSource had an input.=aICMPPingEncap, ICMPPingResponder, ICMPPingRewriter */class ICMPPingSource : public Element { public: ICMPPingSource(); ~ICMPPingSource(); const char *class_name() const { return "ICMPPingSource"; } const char *processing() const { return "h/a"; } void notify_ninputs(int); int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); void add_handlers(); void run_timer(); void push(int, Packet *); Packet* pull(int); private: struct in_addr _src; struct in_addr _dst; int _count; int _limit; uint16_t _icmp_id; int _interval; Timer _timer; String _data; bool _active; bool _verbose;#if HAVE_INT64_TYPES && !CLICK_LINUXMODULE typedef uint64_t counter_t;#else typedef uint32_t counter_t;#endif struct ReceiverInfo { int nreceived; int nduplicate; uint32_t time_min; uint32_t time_max; counter_t time_sum; counter_t time_sq_sum; Timestamp send_timestamp[65536]; }; ReceiverInfo *_receiver; Packet* make_packet(); 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 + -