⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 storeipaddress.hh

📁 Click is a modular router toolkit. To use it you ll need to know how to compile and install the sof
💻 HH
字号:
#ifndef CLICK_STOREIPADDRESS_HH#define CLICK_STOREIPADDRESS_HH#include <click/element.hh>#include <click/ipaddress.hh>CLICK_DECLS/*=cStoreIPAddress(OFFSET)StoreIPAddress(ADDR, OFFSET)=s ipstores IP address in packet=dThe one-argument form writes the destination IP address annotation into thepacket at offset OFFSET, usually an integer. But if the annotation is zero, itdoesn't change the packet.The two-argument form writes IP address ADDR into the packet at offsetOFFSET. ADDR can be zero.The OFFSET argument may be the special string 'src' or 'dst'.  In this case,incoming packets must be IP packets.  StoreIPAddress writes the address intoeither the source or destination field of the IP packet header, as specified,and incrementally updates the IP checksum (and, if appropriate, the TCP/UDPchecksum) to account for the change.If OFFSET is out of range, the packet is dropped or emitted on optional output1.=nUnless you use a special OFFSET of 'src' or 'dst', this element doesn'trecalculate any checksums.  If you store the address into an existing IPpacket, the packet's checksum will need to be set -- for example, withSetIPChecksum. And don't forget that you might need to recalculate TCP and UDPchecksums as well. Here's a useful compound element:  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  }=a SetIPChecksum, SetTCPChecksum, SetUDPChecksum, IPAddrPairRewriter,IPAddrRewriter*/class StoreIPAddress : public Element { public:    StoreIPAddress();    ~StoreIPAddress();    const char *class_name() const		{ return "StoreIPAddress"; }    const char *port_count() const		{ return PORTS_1_1X2; }    const char *processing() const		{ return PROCESSING_A_AH; }    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 + -