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

📄 recpheader.hh

📁 COPE the first practical network coding scheme which is developped on click
💻 HH
字号:
/* Header to ack encoded packet, implemented in the style of srcr packets */#ifndef CLICK_ENC_RECP_HH#define CLICK_ENC_RECP_HH#include <clicknet/ip.h>// packet formatCLICK_SIZE_PACKED_STRUCTURE(struct click_enc_recp {,  uint8_t    _nentries;              // length of this header in terms of number of ack entries  uint16_t _et_next;                  // Ethtype of the next packet    /* neighbour id */  /* highest magic_seq */  uint32_t    _src;  uint16_t   _id;  uint8_t _bmap;  // all methods below adapted from srpacket.hh  void set_entry(int entry_index, uint32_t src_id, uint16_t id_start, uint8_t bmap) {    uint8_t *ndx = (uint8_t *) (this+1);    ndx += (entry_index - 1) * 7;    uint32_t *src = (uint32_t*)ndx;    src[0] = src_id;        uint16_t *id = (uint16_t *)(ndx + 4);     id[0] = htons(id_start);    ndx[6] = bmap;  }  uint32_t get_entry_src(int entry_index) {    uint8_t *ndx = (uint8_t *) (this+1);    ndx += (entry_index - 1) * 7;    uint32_t *src = (uint32_t*)ndx;    return src[0];  }  uint16_t get_entry_id(int entry_index) {    uint8_t *ndx = (uint8_t *) (this+1);    ndx += (entry_index - 1) * 7;        uint16_t *id = (uint16_t *)(ndx + 4);     return ntohs(id[0]);  }  uint8_t get_entry_bmap(int entry_index) {    uint8_t *ndx = (uint8_t *) (this+1);    ndx += (entry_index - 1) * 7;    return ndx[6];  }  void set_nentries(int n) {    _nentries = n;  }  static size_t get_hlen(int nentries) {    return sizeof(struct click_enc_recp) + sizeof(uint32_t) * nentries + sizeof(uint16_t) * nentries + sizeof(uint8_t) * nentries - 7;  }  size_t nentries() {    return _nentries;  }});#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -