checkicmpheader.hh

来自「Click is a modular router toolkit. To us」· HH 代码 · 共 87 行

HH
87
字号
#ifndef CLICK_CHECKICMPHEADER_HH#define CLICK_CHECKICMPHEADER_HH#include <click/element.hh>#include <click/atomic.hh>CLICK_DECLS/*=cCheckICMPHeader([I<KEYWORDS>])=s icmpchecks ICMP header on ICMP packets=dExpects ICMP packets as input. Checks that the packet's length is sensibleand that its checksum field is valid. Pushes invalid packets out on output1, unless output 1 was unused; if so, drops invalid packets.Prints a message to the console the first time it encounters an incorrect IPpacket (but see VERBOSE below).Keyword arguments are:=over 5=item VERBOSEBoolean. If it is true, then a message will be printed for every erroneouspacket, rather than just the first. False by default.=item DETAILSBoolean. If it is true, then CheckICMPHeader will maintain detailed counts ofhow many packets were dropped for each possible reason, accessible through theC<drop_details> handler. False by default.=back=h drops read-onlyReturns the number of incorrect packets CheckICMPHeader has seen.=h drop_details read-onlyReturns a text file showing how many erroneous packets CheckICMPHeader has seen,subdivided by error. Only available if the DETAILS keyword argument was true.=a CheckIPHeader, CheckTCPHeader, CheckUDPHeader, MarkIPHeader */class CheckICMPHeader : public Element { public:  CheckICMPHeader();  ~CheckICMPHeader();  const char *class_name() const		{ return "CheckICMPHeader"; }  const char *port_count() const		{ return PORTS_1_1X2; }  const char *processing() const		{ return PROCESSING_A_AH; }  int configure(Vector<String> &, ErrorHandler *);  void add_handlers();  Packet *simple_action(Packet *); private:  bool _verbose : 1;  atomic_uint32_t _drops;  atomic_uint32_t *_reason_drops;  enum Reason {    NOT_ICMP,    BAD_LENGTH,    BAD_CHECKSUM,    NREASONS  };  static const char *reason_texts[NREASONS];  Packet *drop(Reason, Packet *);  static String read_handler(Element *, void *);};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

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