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

📄 upstreamnotifier.cc

📁 Click is a modular router toolkit. To use it you ll need to know how to compile and install the sof
💻 CC
字号:
/* * upstreamnotifier.{cc,hh} -- a nonfull_notifier * John Bicket * * Copyright (c) 2004 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 <click/error.hh>#include <click/error.hh>#include <click/glue.hh>#include "upstreamnotifier.hh"CLICK_DECLSUpstreamNotifier::UpstreamNotifier(){}UpstreamNotifier::~UpstreamNotifier(){}void *UpstreamNotifier::cast(const char *n){    if (strcmp(n, "UpstreamNotifier") == 0)	return (Element *) this;    else if (strcmp(n, Notifier::FULL_NOTIFIER) == 0)	return static_cast<Notifier *>(&_notifier);    else	return 0;}intUpstreamNotifier::configure(Vector<String> &conf, ErrorHandler *errh){    bool signal;    _notifier.initialize(Notifier::FULL_NOTIFIER, router());    if (cp_va_kparse(conf, this, errh,		     "SIGNAL", cpkP+cpkM, cpBool, &signal,		     cpEnd) < 0)	return -1;    _notifier.set_active(signal, false);    return 0;}voidUpstreamNotifier::push(int p, Packet *p_in){    output(p).push(p_in);}enum { H_SIGNAL };static Stringread_param(Element *e, void *thunk){    UpstreamNotifier *f = (UpstreamNotifier *)e;    switch ((uintptr_t) thunk) {      case H_SIGNAL: return String(f->_notifier.active());    }    return String();}static intwrite_param(const String &s, Element *e, void *vparam,	    ErrorHandler *errh){    UpstreamNotifier *f = (UpstreamNotifier *)e;    switch ((intptr_t) vparam) {      case H_SIGNAL: {	  bool signal;	  if (!cp_bool(s, &signal))	      return errh->error("signal parameter must be boolean");	  f->_notifier.set_active(signal, true);	  break;      }    }    return 0;}voidUpstreamNotifier::add_handlers(){    add_write_handler("signal", write_param, H_SIGNAL, Handler::CHECKBOX);    add_read_handler("signal", read_param, H_SIGNAL);}CLICK_ENDDECLSEXPORT_ELEMENT(UpstreamNotifier)

⌨️ 快捷键说明

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