📄 ipprint.hh
字号:
#ifndef CLICK_IPPRINT_HH#define CLICK_IPPRINT_HH#include <click/element.hh>CLICK_DECLS/*=cIPPrint([TAG, I<KEYWORDS>])=s IP, debuggingpretty-prints IP packets=dExpects IP packets as input. Should be placed downstream of a CheckIPHeader or equivalent element.Prints out IP packets in a human-readable tcpdump-like format, preceded bythe TAG text.Keyword arguments are:=over 8=item CONTENTSDetermines whether the packet data is printed. It may be `false' (do not printpacket data), `hex' (print packet data in hexadecimal), or `ascii' (printpacket data in plaintext). Default is `false'.=item PAYLOADLike CONTENTS, but prints only the packet payload, rather than the entirepacket. Specify at most one of CONTENTS and PAYLOAD.=item NBYTESIf CONTENTS is `hex' or `ascii', then NBYTES determines the number of bytes todump. Default is 1500.=item IDBoolean. Determines whether to print each packet's IP ID field. Default isfalse.=item TTLBoolean. Determines whether to print each packet's IP TOS field. Default isfalse.=item TOSBoolean. Determines whether to print each packet's IP TOS field. Default isfalse.=item LENGTHBoolean. Determines whether to print each packet's IP length field. Default isfalse.=item TIMESTAMPBoolean. Determines whether to print each packet's timestamp in seconds since1970. Default is true.=item AGGREGATEBoolean. Determines whether to print each packet's aggregate annotation.Default is false.=item PAINTBoolean. Determines whether to print each packet's paint annotation. Default is false.=item SWAPBoolean. Determines whether to swap bytes before printing the valuesof ICMP sequence and ID numbers. Default is false. The RFC does notrequire these two-byte values to be sent in any particular byte order.For example, OpenBSD/i386 writes ping (ICMP echo) sequence numbers innetwork byte order, while Linux/i386 writes them in host byte order(often little-endian).=item OUTFILEString. Only available at user level. PrintV<> information to the file specifiedby OUTFILE instead of standard error.=back=a Print, CheckIPHeader */class IPPrint : public Element { public: IPPrint(); ~IPPrint(); const char *class_name() const { return "IPPrint"; } const char *processing() const { return AGNOSTIC; } int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); Packet *simple_action(Packet *); private: bool _swap; String _label; unsigned _bytes; // Number of bytes to dump bool _print_id : 1; // Print IP ID? bool _print_timestamp : 1; bool _print_paint : 1; bool _print_tos : 1; bool _print_ttl : 1; bool _print_len : 1; bool _print_aggregate : 1; bool _payload : 1; // '_contents' refers to payload unsigned _contents : 2; // Whether to dump packet contents#if CLICK_USERLEVEL String _outfilename; FILE *_outfile;#endif ErrorHandler *_errh; void tcp_line(StringAccum &, const Packet *, int transport_len) const; void udp_line(StringAccum &, const Packet *, int transport_len) const; void icmp_line(StringAccum &, const Packet *, int transport_len) const; };CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -