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

📄 fasttcpflows.hh

📁 COPE the first practical network coding scheme which is developped on click
💻 HH
字号:
#ifndef FASTTCPFLOWS_HH#define FASTTCPFLOWS_HH/* * =c * FastTCPFlows(RATE, LIMIT, LEN, *              SETHADDR, SIPADDR, *              DETHADDR, DIPADDR, *              FLOWS, FLOWSIZE [, ACTIVE]) * =s sources * creates packets flows with static TCP/IP/Ethernet headers * =d * FastTCPFlows is a benchmark tool. At initialization time, FastTCPFlows * creates FLOWS number of fake TCP/IP packets of length LEN (min 60), with * source ethernet address SETHADDR, source IP address SIPADDR, destination * ethernet address DETHADDR, and destination IP address DIPADDR. Source and * destination ports are randomly generated. The TCP checksum is calculated. * Each time the FastTCPFlows element is called, it selects a flow, increments * the reference count on the skbuff created and returns the skbuff object w/o * copying or cloning. Therefore, the packet returned by FastTCPFlows should * not be modified. * * FastTCPFlows sents packets at RATE packets per second. It will send LIMIT * number of packets in total. Each flow is limited to FLOWSIZE number of * packets. After FLOWSIZE number of packets are sent, the sort and dst port * will be modified. FLOWSIZE must be greater than or equal to 3. For each * flow, a SYN packet, a DATA packet, and a FIN packet are sent. These packets * have the invalid sequence numbers, in order to avoid recomputing checksum. * * After FastTCPFlows has sent LIMIT packets, it will calculate the average * send rate (packets per second) between the first and last packets sent and * make that available in the rate handler. * * By default FastTCPFlows is ACTIVE. * * =h count read-only * Returns the total number of packets that have been generated. * =h rate read/write * Returns or sets the RATE parameter. * =h reset write * Reset and restart. * =h active write * Change ACTIVE * * =e *  FastTCPFlows(100000, 500000, 60,  *               0:0:0:0:0:0, 1.0.0.1, 1234,  *               1:1:1:1:1:1, 2.0.0.2, 1234, *               100, 10)  *    -> ToDevice; */#include <click/element.hh>#include <click/glue.hh>#include <click/gaprate.hh>#include <click/packet.hh>#include <clicknet/ether.h>#include <clicknet/tcp.h>class FastTCPFlows : public Element {  bool _rate_limited;  bool _sent_all_fins;  unsigned _len;  click_ether _ethh;  struct in_addr _sipaddr;  struct in_addr _dipaddr;  unsigned int _nflows;  unsigned int _last_flow;  unsigned int _flowsize;  bool _cksum;  unsigned long _first; // jiffies  unsigned long _last;   struct flow_t {    WritablePacket *syn_packet;    WritablePacket *fin_packet;    WritablePacket *data_packet;    int flow_count;  };  flow_t *_flows;  void change_ports(int);  Packet *get_packet(); public:    static const unsigned NO_LIMIT = 0xFFFFFFFFU;  GapRate _rate;  unsigned _count;  unsigned _limit;  bool _active;  FastTCPFlows();  ~FastTCPFlows();    const char *class_name() const	{ return "FastTCPFlows"; }  const char *processing() const	{ return PULL; }    int configure(Vector<String> &, ErrorHandler *);  int initialize(ErrorHandler *);  void cleanup(CleanupStage);  Packet *pull(int);  void add_handlers();  void reset();  unsigned count() { return _count; }  unsigned long first() { return _first; }  unsigned long last() { return _last; }};#endif

⌨️ 快捷键说明

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