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

📄 hopcountmetric.cc

📁 COPE the first practical network coding scheme which is developped on click
💻 CC
字号:
/* * hopcountmetric.{cc,hh} -- minimum hop-count metric * * Copyright (c) 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 "elements/grid/hopcountmetric.hh"CLICK_DECLS const GridGenericMetric::metric_t GridGenericMetric::_bad_metric(777777, false);HopcountMetric::HopcountMetric()  : GridGenericMetric(0, 0){}HopcountMetric::~HopcountMetric(){}void *HopcountMetric::cast(const char *n) {  if (strcmp(n, "HopcountMetric") == 0)    return (HopcountMetric *) this;  else if (strcmp(n, "GridGenericMetric") == 0)    return (GridGenericMetric *) this;  else    return 0;}intHopcountMetric::configure(Vector<String> &conf, ErrorHandler *errh){  int res = cp_va_parse(conf, this, errh,			cpEnd);  return res;}boolHopcountMetric::metric_val_lt(const metric_t &m1, const metric_t &m2) const{  return m1.val() < m2.val();}GridGenericMetric::metric_t HopcountMetric::get_link_metric(const EtherAddress &, bool) const{  // XXX verify that the specified destination is actually a neighbor?  return metric_t(1);}GridGenericMetric::metric_tHopcountMetric::append_metric(const metric_t &r, const metric_t &l) const{  if (!r.good() || !l.good())    return _bad_metric;  else    return metric_t(r.val() + l.val());}voidHopcountMetric::add_handlers(){  add_default_handlers(true);}ELEMENT_PROVIDES(GridGenericMetric)EXPORT_ELEMENT(HopcountMetric)CLICK_ENDDECLS

⌨️ 快捷键说明

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