📄 storeipaddress.hh
字号:
#ifndef STOREADDRESS_HH#define STOREADDRESS_HH#include <click/element.hh>#include <click/ipaddress.hh>CLICK_DECLS/*=cStoreIPAddress(OFFSET)StoreIPAddress(ADDRESS, OFFSET)=s IP, annotationsstores IP address in packet=dThe one-argument form writes the destination IP address annotation into thepacket at offset OFFSET. But if the annotation is zero, it doesn't changethe packet.The two-argument form writes ADDRESS into the packet at offset OFFSET. ADDRESScan be zero.=nThis element doesn't recalculate any checksums, so if you store the addressinto an existing IP packet, the packet's checksum will need to be set-- for example, with SetIPChecksum. And don't forget that transport protocolsmight include IP header info in their checksums: TCP and UDP do, for example.You'll need to recalculate their checksums as well. Here's a useful compoundelement: elementclass FixIPChecksums { // fix the IP checksum, and any embedded checksums that // include data from the IP header (TCP and UDP in particular) input -> SetIPChecksum -> ipc :: IPClassifier(tcp, udp, -) -> SetTCPChecksum -> output; ipc[1] -> SetUDPChecksum -> output; ipc[2] -> output }=aSetIPChecksum, SetTCPChecksum, SetUDPChecksum*/class StoreIPAddress : public Element { public: StoreIPAddress(); ~StoreIPAddress(); const char *class_name() const { return "StoreIPAddress"; } const char *processing() const { return AGNOSTIC; } int configure(Vector<String> &, ErrorHandler *); Packet *simple_action(Packet *); private: unsigned _offset; IPAddress _address; bool _use_address; };CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -