亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? linkstat.cc

?? Click is a modular router toolkit. To use it you ll need to know how to compile and install the sof
?? CC
字號:
/* * linkstat.{cc,hh} -- track per-link delivery rates. * Douglas S. J. De Couto * * Copyright (c) 1999-2003 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, subject to the conditions * listed in the Click LICENSE file. These conditions include: you must * preserve this copyright notice, and you cannot mention the copyright * holders in advertising related to the Software without their permission. * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This * notice is a summary of the Click LICENSE file; the license in that file is * legally binding. */#include <click/config.h>#include <click/confparse.hh>#include <clicknet/ether.h>#include <click/error.hh>#include <click/glue.hh>#include <click/timer.hh>#include <click/straccum.hh>#include <elements/grid/grid.hh>#include <elements/grid/linkstat.hh>#include <elements/grid/timeutils.hh>CLICK_DECLSLinkStat::LinkStat()  : _window(100), _tau(10000), _period(1000),  _probe_size(1000), _seq(0), _send_timer(0),  _use_proto2(false){}LinkStat::~LinkStat(){}intLinkStat::configure(Vector<String> &conf, ErrorHandler *errh){  int res = cp_va_kparse(conf, this, errh,			 "WINDOW", 0, cpUnsigned, &_window,			 "ETH", 0, cpEthernetAddress, &_eth,			 "PERIOD", 0, cpUnsigned, &_period,			 "TAU", 0, cpUnsigned, &_tau,			 "SIZE", 0, cpUnsigned, &_probe_size,			 "USE_SECOND_PROTO", 0, cpBool, &_use_proto2,			 cpEnd);  if (res < 0)    return res;  unsigned min_sz = sizeof(click_ether) + link_probe::size;  if (_probe_size < min_sz)    return errh->error("Specified packet size is less than the minimum probe size of %u",		       min_sz);  return res;}voidLinkStat::send_hook(){  WritablePacket *p = Packet::make(_probe_size + 2); // +2 for alignment  if (p == 0) {    click_chatter("LinkStat %s: cannot make packet!", name().c_str());    return;  }  ASSERT_4ALIGNED(p->data());  p->pull(2);  memset(p->data(), 0, p->length());  p->set_timestamp_anno(Timestamp::now());  // fill in ethernet header  click_ether *eh = (click_ether *) p->data();  memset(eh->ether_dhost, 0xff, 6); // broadcast  eh->ether_type = htons(_use_proto2 ? ETHERTYPE_LINKSTAT2 : ETHERTYPE_LINKSTAT);  memcpy(eh->ether_shost, _eth.data(), 6);  // calculate number of entries  unsigned min_packet_sz = sizeof(click_ether) + link_probe::size;  unsigned max_entries = (_probe_size - min_packet_sz) / link_entry::size;  static bool size_warning = false;  if (!size_warning && max_entries < (unsigned) _bcast_stats.size()) {    size_warning = true;    click_chatter("LinkStat %s: WARNING, probe packet is too small to contain all link stats", name().c_str());  }  unsigned num_entries = max_entries < (unsigned) _bcast_stats.size() ? max_entries : _bcast_stats.size();  // build packet  link_probe lp(_seq, _period, num_entries, _tau, _probe_size);  _seq++;  unsigned char *d = p->data() + sizeof(click_ether);  d += lp.write(d);  for (ProbeMap::const_iterator i = _bcast_stats.begin();       i.live() && num_entries > 0;       num_entries--, i++) {    const probe_list_t &val = i.value();    if (val.probes.size() == 0) {      num_entries++;      continue;    }    unsigned n = count_rx(&val);    if (n > 0xFFff)      click_chatter("LinkStat %s: WARNING, overflow in number of probes received from %s", name().c_str(), val.eth.unparse().c_str());    link_entry le(val.eth, n & 0xFFff);    d += le.write(d);  }  link_probe::update_cksum(p->data() + sizeof(click_ether));  unsigned max_jitter = _period / 10;  unsigned j = click_random(0, max_jitter * 2);  _next_bcast += Timestamp::make_usec(1000 * (_period + j - max_jitter));  _send_timer->schedule_at(_next_bcast);  checked_output_push(0, p);}unsigned intLinkStat::count_rx(const probe_list_t *pl){  if (!pl)    return 0;  Timestamp earliest = Timestamp::now() - Timestamp::make_msec(_tau);  int num = 0;  for (int i = pl->probes.size() - 1; i >= 0; i--) {    if (pl->probes[i].when >= earliest)      num++;    else      break;  }  return num;}unsigned intLinkStat::count_rx(const EtherAddress &eth){  probe_list_t *pl = _bcast_stats.findp(eth);  if (pl)    return count_rx(pl);  else    return 0;}intLinkStat::initialize(ErrorHandler *errh){  if (noutputs() > 0) {    if (!_eth)      return errh->error("Source Ethernet address must be specified to send probes");    _send_timer = new Timer(static_send_hook, this);    _send_timer->initialize(this);    _next_bcast = Timestamp::now() + Timestamp(1, 0);    _send_timer->schedule_at(_next_bcast);  }  return 0;}Packet *LinkStat::simple_action(Packet *p){  unsigned min_sz = sizeof(click_ether) + link_probe::size;  if (p->length() < min_sz) {    click_chatter("LinkStat %s: packet is too small", name().c_str());    p->kill();    return 0;  }  click_ether *eh = (click_ether *) p->data();  if (ntohs(eh->ether_type) != (_use_proto2 ? ETHERTYPE_LINKSTAT2 : ETHERTYPE_LINKSTAT)) {    click_chatter("LinkStat %s: got non-LinkStat packet type", name().c_str());    p->kill();    return 0;  }  link_probe lp(p->data() + sizeof(click_ether));  if (link_probe::calc_cksum(p->data() + sizeof(click_ether)) != 0) {    click_chatter("LinkStat %s: bad checksum from %s", name().c_str(), EtherAddress(eh->ether_shost).unparse().c_str());    p->kill();    return 0;  }  if (p->length() < lp.psz)    click_chatter("LinkStat %s: packet is smaller (%d) than it claims (%u)",		  name().c_str(), p->length(), lp.psz);  add_bcast_stat(EtherAddress(eh->ether_shost), lp);  // look in received packet for info about our outgoing link  Timestamp now = Timestamp::now();  unsigned int max_entries = (p->length() - sizeof(*eh) - link_probe::size) / link_entry::size;  unsigned int num_entries = lp.num_links;  if (num_entries > max_entries) {    click_chatter("LinkStat %s: WARNING, probe packet from %s contains fewer link entries (at most %u) than claimed (%u)",		  name().c_str(), EtherAddress(eh->ether_shost).unparse().c_str(), max_entries, num_entries);    num_entries = max_entries;  }  const unsigned char *d = p->data() + sizeof(click_ether) + link_probe::size;  for (unsigned i = 0; i < num_entries; i++, d += link_entry::size) {    link_entry le(d);    if (le.eth == _eth) {      _rev_bcast_stats.insert(EtherAddress(eh->ether_shost), outgoing_link_entry_t(le, now, lp.tau));      break;    }  }  p->kill();  return 0;}boolLinkStat::get_forward_rate(const EtherAddress &eth, unsigned int *r,			   unsigned int *tau, Timestamp *t){  outgoing_link_entry_t *ol = _rev_bcast_stats.findp(eth);  if (!ol)    return false;  if (_period == 0)    return false;  unsigned num_expected = ol->tau / _period;  unsigned num_received = ol->num_rx;  // will happen if our send period is greater than the the remote  // host's averaging period  if (num_expected == 0)    return false;  unsigned pct = 100 * num_received / num_expected;  if (pct > 100)    pct = 100;  *r = pct;  *tau = ol->tau;  *t = ol->received_at;  return true;}boolLinkStat::get_reverse_rate(const EtherAddress &eth, unsigned int *r,			   unsigned int *tau){  probe_list_t *pl = _bcast_stats.findp(eth);  if (!pl)    return false;  if (pl->period == 0)    return false;  unsigned num_expected = _tau / pl->period;  unsigned num_received = count_rx(eth);  // will happen if our averaging period is less than the remote  // host's sending rate.  if (num_expected == 0)    return false;  unsigned pct = 100 * num_received / num_expected;  if (pct > 100)    pct = 100;  *r = pct;  *tau = _tau;  return true;}voidLinkStat::add_bcast_stat(const EtherAddress &eth, const link_probe &lp){  Timestamp now = Timestamp::now();  probe_t probe(now, lp.seq_no);  unsigned int new_period = lp.period;  probe_list_t *l = _bcast_stats.findp(eth);  if (!l) {    probe_list_t l2(eth, new_period, lp.tau);    _bcast_stats.insert(eth, l2);    l = _bcast_stats.findp(eth);  }  else if (l->period != new_period) {    click_chatter("LinkStat %s: %s has changed its link probe period from %u to %u; clearing probe info\n",		  name().c_str(), eth.unparse().c_str(), l->period, new_period);    l->probes.clear();    l->period = new_period;    return;  }  l->probes.push_back(probe);  /* only keep stats for last _window *unique* sequence numbers */  while ((unsigned) l->probes.size() > _window)    l->probes.pop_front();}StringLinkStat::read_window(Element *xf, void *){  LinkStat *f = (LinkStat *) xf;  return String(f->_window) + "\n";}StringLinkStat::read_period(Element *xf, void *){  LinkStat *f = (LinkStat *) xf;  return String(f->_period) + "\n";}StringLinkStat::read_tau(Element *xf, void *){  LinkStat *f = (LinkStat *) xf;  return String(f->_tau) + "\n";}StringLinkStat::read_bcast_stats(Element *xf, void *){  LinkStat *e = (LinkStat *) xf;  typedef HashMap<EtherAddress, bool> EthMap;  EthMap eth_addrs;  for (ProbeMap::const_iterator i = e->_bcast_stats.begin(); i.live(); i++)    eth_addrs.insert(i.key(), true);  for (ReverseProbeMap::const_iterator i = e->_rev_bcast_stats.begin(); i.live(); i++)    eth_addrs.insert(i.key(), true);  Timestamp now = Timestamp::now();  StringAccum sa;  for (EthMap::const_iterator i = eth_addrs.begin(); i.live(); i++) {    const EtherAddress &eth = i.key();    probe_list_t *pl = e->_bcast_stats.findp(eth);    outgoing_link_entry_t *ol = e->_rev_bcast_stats.findp(eth);    sa << eth << ' ';    sa << "fwd ";    if (ol) {      Timestamp age = now - ol->received_at;      sa << "age=" << age << " tau=" << ol->tau << " num_rx=" << (unsigned) ol->num_rx	 << " period=" << e->_period << " pct=" << calc_pct(ol->tau, e->_period, ol->num_rx);    }    else      sa << "age=-1 tau=-1 num_rx=-1 period=-1 pct=-1";    sa << " -- rev ";    if (pl) {      unsigned num_rx = e->count_rx(pl);      sa << "tau=" << e->_tau << " num_rx=" << num_rx << " period=" << pl->period	 << " pct=" << calc_pct(e->_tau, pl->period, num_rx);    }    else      sa << "tau=-1 num_rx=-1 period=-1 pct=-1";    sa << '\n';  }  return sa.take_string();}unsigned intLinkStat::calc_pct(unsigned tau, unsigned period, unsigned num_rx){  if (period == 0)    return 0;  unsigned num_expected = tau / period;  if (num_expected == 0)    return 0;  return 100 * num_rx / num_expected;}intLinkStat::write_window(const String &arg, Element *el,		       void *, ErrorHandler *errh){  LinkStat *e = (LinkStat *) el;  if (!cp_integer(arg, &e->_window))    return errh->error("window must be >= 0");  return 0;}intLinkStat::write_period(const String &arg, Element *el,		       void *, ErrorHandler *errh){  LinkStat *e = (LinkStat *) el;  if (!cp_integer(arg, &e->_period))    return errh->error("period must be >= 0");  return 0;}intLinkStat::write_tau(const String &arg, Element *el,		       void *, ErrorHandler *errh){  LinkStat *e = (LinkStat *) el;  if (!cp_integer(arg, &e->_tau))    return errh->error("tau must be >= 0");  return 0;}voidLinkStat::add_handlers(){  add_read_handler("bcast_stats", read_bcast_stats, 0);  add_read_handler("window", read_window, 0);  add_read_handler("tau", read_tau, 0);  add_read_handler("period", read_period, 0);  add_write_handler("window", write_window, 0);  add_write_handler("tau", write_tau, 0);  add_write_handler("period", write_period, 0);}LinkStat::link_probe::link_probe(const unsigned char *d)  : seq_no(uint_at(d + 0)), period(uint_at(d + 4)), num_links(uint_at(d + 8)),  tau(uint_at(d + 12)), cksum(ushort_at(d + 16)), psz(ushort_at(d + 18)){}intLinkStat::link_probe::write(unsigned char *d) const{  write_uint_at(d + 0, seq_no);  write_uint_at(d + 4, period);  write_uint_at(d + 8, num_links);  write_uint_at(d + 12, tau);  write_ushort_at(d + 16, 0); // cksum will be filled in later -- we don't know what the link_entry data is yet  write_ushort_at(d + 18, psz); // cksum will be filled in later -- we don't know what the link_entry data is yet  return size;}voidLinkStat::link_probe::update_cksum(unsigned char *d){  unsigned short cksum = calc_cksum(d);  unsigned char *c = (unsigned char *) &cksum;  d[cksum_offset] = c[0];  d[cksum_offset + 1] = c[1];}unsigned shortLinkStat::link_probe::calc_cksum(const unsigned char *d){  link_probe lp(d);  int nbytes = link_probe::size + lp.num_links * link_entry::size;  return click_in_cksum(d, nbytes);}LinkStat::link_entry::link_entry(const unsigned char *d)  : eth(d), num_rx(ushort_at(d + 6)){}intLinkStat::link_entry::write(unsigned char *d) const{  memcpy(d, eth.data(), 6);  write_ushort_at(d + 6, num_rx);  return size;}EXPORT_ELEMENT(LinkStat)CLICK_ENDDECLS

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区91| 欧美亚洲高清一区二区三区不卡| 成人美女在线观看| 在线观看精品一区| 久久久久久久久蜜桃| 亚洲在线视频网站| 国产精品亚洲人在线观看| 欧美午夜精品免费| 成人欧美一区二区三区| 裸体歌舞表演一区二区| 欧美亚洲国产一区二区三区| 日本一二三四高清不卡| 美腿丝袜亚洲色图| 色婷婷精品大在线视频| 中文字幕不卡的av| 紧缚奴在线一区二区三区| 欧美伊人久久大香线蕉综合69| 国产精品欧美久久久久无广告 | 欧美美女喷水视频| 国产精品亲子乱子伦xxxx裸| 精品一区二区三区免费| 88在线观看91蜜桃国自产| 亚洲综合丁香婷婷六月香| 成人免费视频网站在线观看| 久久蜜桃av一区精品变态类天堂 | 欧美精品 日韩| 亚洲影视在线观看| 99精品欧美一区二区蜜桃免费| 久久久www免费人成精品| 久久精品国产秦先生| 91精品国产综合久久久久久漫画 | 国产精品夫妻自拍| 国产东北露脸精品视频| 欧美精品一区二区久久久| 石原莉奈在线亚洲二区| 欧美日韩免费一区二区三区视频| 亚洲情趣在线观看| 日本高清无吗v一区| 伊人开心综合网| 欧美视频自拍偷拍| 天天av天天翘天天综合网| 欧美日韩国产小视频在线观看| 亚洲123区在线观看| 欧美肥胖老妇做爰| 日本亚洲欧美天堂免费| 精品少妇一区二区三区在线视频| 黄色资源网久久资源365| 日韩精品一区二区三区四区| 九九在线精品视频| 久久久精品天堂| 色综合一个色综合| 亚洲一区影音先锋| 欧美另类高清zo欧美| 久久精品999| 国产精品午夜春色av| 91理论电影在线观看| 亚洲18女电影在线观看| 欧美www视频| 9人人澡人人爽人人精品| 一区二区三区免费观看| 日韩欧美国产午夜精品| 国产ts人妖一区二区| 亚洲视频免费在线| 欧美精品久久天天躁| 国产一二三精品| 亚洲黄色免费网站| 日韩欧美高清dvd碟片| 国产99久久久国产精品潘金| 亚洲一区二区在线视频| 欧美成人video| 色综合久久中文综合久久97| 日产国产欧美视频一区精品| 欧美高清在线精品一区| 欧美日韩在线观看一区二区| 国产美女精品一区二区三区| 亚洲精品日产精品乱码不卡| 精品久久人人做人人爰| 在线观看亚洲精品| 精品在线亚洲视频| 亚洲精品亚洲人成人网在线播放| 精品国产一区二区亚洲人成毛片| 色婷婷综合久久久中文一区二区| 久久国产人妖系列| 亚洲黄色小视频| 欧美国产日韩在线观看| 欧美人与性动xxxx| 波波电影院一区二区三区| 美女视频一区在线观看| 亚洲专区一二三| 亚洲欧美一区二区视频| 欧美videofree性高清杂交| 色哟哟日韩精品| 夫妻av一区二区| 极品少妇xxxx精品少妇| 亚洲 欧美综合在线网络| 亚洲青青青在线视频| 国产拍欧美日韩视频二区| 9191国产精品| 欧美日韩一区不卡| 91美女蜜桃在线| 国产.欧美.日韩| 国模一区二区三区白浆| 日本中文一区二区三区| 亚洲国产欧美另类丝袜| 国产精品高潮久久久久无| 国产日韩欧美一区二区三区乱码| ww亚洲ww在线观看国产| 日韩精品在线网站| 欧美一区二区三区的| 欧美性生活一区| 欧洲一区二区三区免费视频| 99re这里只有精品首页| 不卡欧美aaaaa| 不卡视频在线观看| 成人国产精品免费| aa级大片欧美| 色域天天综合网| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 91丨国产丨九色丨pron| 丁香婷婷综合色啪| 岛国精品一区二区| 成人黄色a**站在线观看| 国产成人亚洲综合a∨猫咪| 国产成人鲁色资源国产91色综 | 国产精品女同一区二区三区| 国产日韩亚洲欧美综合| 国产精品伦理在线| 最近中文字幕一区二区三区| 亚洲人成网站色在线观看| 一区二区三区中文字幕精品精品 | 高清beeg欧美| 99久久国产综合精品麻豆| 波多野结衣的一区二区三区| 91黄色免费看| 欧美精品18+| 精品国产百合女同互慰| 久久久久国产精品麻豆ai换脸| 中文字幕巨乱亚洲| 亚洲丝袜另类动漫二区| 亚洲国产成人91porn| 蜜臀99久久精品久久久久久软件| 激情欧美一区二区| 成人福利在线看| 欧美日韩另类国产亚洲欧美一级| 欧美一区二区在线观看| 久久综合999| 亚洲综合色成人| 久久国产成人午夜av影院| 国产91综合网| 欧美日韩免费观看一区二区三区| 日韩亚洲欧美在线观看| 欧美激情一二三区| 亚洲成人av免费| 国产精品亚洲午夜一区二区三区| 91视视频在线观看入口直接观看www| 欧美网站一区二区| 久久精品人人做人人综合 | 日本久久电影网| 日韩写真欧美这视频| 一区二区中文字幕在线| 日韩精品欧美成人高清一区二区| 国产麻豆91精品| 欧美日本不卡视频| 亚洲欧美综合另类在线卡通| 蜜臀av亚洲一区中文字幕| av一区二区三区黑人| 欧美一二三区精品| 一区二区在线电影| 国产一区不卡视频| 欧美一三区三区四区免费在线看| 国产精品福利一区| 狠狠色丁香久久婷婷综合丁香| 91美女在线视频| 欧美国产1区2区| 久久丁香综合五月国产三级网站| 欧美优质美女网站| 国产日本欧洲亚洲| 奇米888四色在线精品| 色就色 综合激情| 亚洲国产精品精华液ab| 日韩精品欧美精品| 在线观看一区日韩| 亚洲视频香蕉人妖| 国产成人在线免费观看| 日韩区在线观看| 亚洲第一福利视频在线| 97超碰欧美中文字幕| 日本一区二区三区在线不卡| 黄色小说综合网站| 91精品国产高清一区二区三区| 亚洲国产日韩在线一区模特| 91丨porny丨户外露出| 国产亚洲一二三区| 国产伦精一区二区三区| 欧美mv和日韩mv的网站| 久久精品国产一区二区三区免费看| 欧美精品在线观看播放| 亚洲国产wwwccc36天堂| 欧美日韩国产一级| 日产国产欧美视频一区精品|