checkudpheader.hh

来自「COPE the first practical network coding 」· HH 代码 · 共 92 行

HH
92
字号
#ifndef CLICK_CHECKUDPHEADER_HH#define CLICK_CHECKUDPHEADER_HH#include <click/element.hh>#include <click/atomic.hh>CLICK_DECLS/*=cCheckUDPHeader([I<KEYWORDS>])=s UDP, checkingchecks UDP header on UDP/IP packets=dExpects UDP/IP packets as input. Checks that the UDP header length andchecksum fields are valid. Pushes invalid packets out on output 1, unlessoutput 1 was unused; if so, drops invalid packets.Prints a message to the console the first time it encounters an incorrectpacket (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 CheckUDPHeader 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 CheckUDPHeader has seen.=h drop_details read-onlyReturns a text file showing how many erroneous packets CheckUDPHeader hasseen, subdivided by error. Only available if the DETAILS keyword argument wastrue.=a CheckIPHeader, CheckTCPHeader, CheckICMPHeader, MarkIPHeader */class CheckUDPHeader : public Element { public:  CheckUDPHeader();  ~CheckUDPHeader();    const char *class_name() const		{ return "CheckUDPHeader"; }  const char *processing() const		{ return "a/ah"; }    void notify_noutputs(int);  int configure(Vector<String> &, ErrorHandler *);  void add_handlers();  Packet *simple_action(Packet *);  /* inline Packet *smaction(Packet *);     void push(int, Packet *p);     Packet *pull(int); */ private:  bool _verbose : 1;  atomic_uint32_t _drops;  atomic_uint32_t *_reason_drops;  enum Reason {    NOT_UDP,    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 + -
显示快捷键?