📄 encodedheader.hh
字号:
/* Header for the encoded packet */#ifndef CLICK_XORED_HH#define CLICK_XORED_HH#include <clicknet/ip.h>// packet formatCLICK_SIZE_PACKED_STRUCTURE(struct click_xored {, uint16_t ether_type[2]; // the original ethertype of both packets uint16_t seq[2]; // IP seq numbers for both uint32_t prev_hop[2]; // the previous hop for either packets uint32_t src[2]; // the source IP address of both packets // note that the values in these arrays should be associative // i.e., info for the same 'source' should use the same index uint16_t short_length; // the length of the shorter packet uint16_t _cksum; uint16_t _dlen; // all methods below adapted from srpacket.hh void set_data_len(uint16_t len) { _dlen = htons(len); } size_t data_len() { return ntohs(_dlen); } // *** is this right? size_t hlen_wo_data() { return sizeof(struct click_xored); } size_t hlen_with_data() const { return len_with_data(ntohs(_dlen)); } static size_t len_with_data(int dlen) { return sizeof(struct click_xored) + dlen; } void set_checksum() { // all packets should carry data, so let's not worry about empty payloads unsigned int tlen = hlen_with_data(); /* if (_type & PT_DATA) { tlen = hlen_with_data(); } else { tlen = hlen_wo_data(); } */ _cksum = 0; _cksum = click_in_cksum((unsigned char *) this, tlen); }});#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -