📄 icmprewriter.hh
字号:
/* -*- c-basic-offset: 2 -*- */#ifndef CLICK_ICMPREWRITER_HH#define CLICK_ICMPREWRITER_HH#include <click/element.hh>#include <clicknet/udp.h>#include <clicknet/icmp.h>#include "elements/ip/iprw.hh"#include "elements/icmp/icmppingrewriter.hh"CLICK_DECLS/*=cICMPRewriter(MAPS)=s ICMPrewrites ICMP packets based on IP rewriter mappings=dRewrites ICMP error packets by changing their source and/or destinationaddresses and some of their payloads. It checks MAPS, a space-separated listof IPRewriter-like elements, to see how to rewrite. This lets source quenches,redirects, TTL-expired messages, and so forth pass through a NAT gateway.ICMP error packets are sent in response to normal IP packets, and include asmall portion of the relevant IP packet data. If the IP packet had been sentthrough IPRewriter, ICMPPingRewriter, or a similar element, then the ICMPpacket will be in response to the rewritten address. ICMPRewriter takes suchICMP error packets and checks a list of IPRewriters for a relevant mapping. Ifa mapping is found, ICMPRewriter will rewrite the ICMP packet so it appearslike a response to the original packet and emit the result on output 0.ICMPRewriter may have one or two outputs. If it has one, then anynon-rewritten ICMP error packets, and any ICMP packets that are not errors,are dropped. If it has two, then these kinds of packets are emitted on output1.=nICMPRewriter supports the following ICMP types: destination unreachable, timeexceeded, parameter problem, source quench, and redirect.MAPS elements may have element class IPAddrRewriter, IPRewriter, TCPRewriter,ICMPPingRewriter, or other related classes.=aIPAddrRewriter, IPRewriter, ICMPPingRewriter, TCPRewriter */class ICMPRewriter : public Element { public: ICMPRewriter(); ~ICMPRewriter(); const char *class_name() const { return "ICMPRewriter"; } const char *processing() const { return AGNOSTIC; } void notify_noutputs(int); int configure(Vector<String> &, ErrorHandler *); Packet *simple_action(Packet *); protected: Vector<IPRw *> _maps; Vector<ICMPPingRewriter *> _ping_maps; void rewrite_packet(WritablePacket *, click_ip *, click_udp *, const IPFlowID &, IPRw::Mapping *); void rewrite_ping_packet(WritablePacket *, click_ip *, click_icmp_echo *, const IPFlowID &, ICMPPingRewriter::Mapping *); };CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -