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

📄 bitrate.cc

📁 Click is a modular router toolkit. To use it you ll need to know how to compile and install the sof
💻 CC
字号:
#include <click/config.h>#include "bitrate.hh"#include <clicknet/wifi.h>unsignedcalc_transmit_time(int rate, int length){	unsigned t_plcp_header = 96;	if (rate == 2) {		t_plcp_header = 192;	} else if (!is_b_rate(rate)) {		t_plcp_header = 20;  }	return (2 * (t_plcp_header + ((length * 8))))/ rate;}unsignedcalc_backoff(int rate, int t){	int t_slot = is_b_rate(rate) ? WIFI_SLOT_B : WIFI_SLOT_A;	int cw = WIFI_CW_MIN;	/* there is backoff, even for the first packet */	for (int x = 0; x < t; x++) {		cw = MIN(WIFI_CW_MAX, (cw + 1) * 2);	}	return t_slot * cw / 2;}unsignedcalc_usecs_wifi_packet_tries(int length, int rate, int try0, int tryN){	if (!rate || !length || try0 > tryN) {		return 99999;	}	/* pg 205 ieee.802.11.pdf */	unsigned t_slot = 20;	unsigned t_ack = 304; // 192 + 14*8/1	unsigned t_difs = 50;	unsigned t_sifs = 10;	if (!is_b_rate(rate)) {		/* with 802.11g, things are at 6 mbit/s */		t_slot = 9;		t_sifs = 9;		t_difs = 28;		t_ack = 30;	}	int tt = 0;	for (int x = try0; x <= tryN; x++) {		tt += calc_backoff(rate, x) + calc_transmit_time(rate, length) +			t_sifs + t_ack;	}	return tt;}unsignedcalc_usecs_wifi_packet(int length, int rate, int retries){	return calc_usecs_wifi_packet_tries(length, rate, 0, retries);}ELEMENT_PROVIDES(bitrate)

⌨️ 快捷键说明

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