randomerror.hh
来自「COPE the first practical network coding 」· HH 代码 · 共 60 行
HH
60 行
#ifndef CLICK_RANDOMERROR_HH#define CLICK_RANDOMERROR_HH#include <click/element.hh>CLICK_DECLS/* * =c * RandomBitErrors(P [, KIND, ACTIVE]) * =s modification * changes packet data with some probability * =d * * Change each bit in each packet with probability P. The KIND parameter * determines the kind of change. `flip' (the default) flips bits, `set' sets * bits to one, and `clear' sets bits to zero. * * RandomBitErrors can be active or inactive. It only changes bits when * active. It starts out active by default, but if you pass `false' for the * ACTIVE parameter, it will start out inactive. * * =h p_bit_error read/write * Returns or sets the P probability parameter. * =h error_kind read/write * Returns or sets the KIND parameter. * =h active read/write * Makes the element active or inactive. * * =a RandomSample */class RandomBitErrors : public Element { int _p_error[9]; // out of 0xFFFF unsigned _p_bit_error; // out of 0xFFFF int _kind; // 0 clear, 1 set, 2 flip bool _on; public: RandomBitErrors(); ~RandomBitErrors(); const char *class_name() const { return "RandomBitErrors"; } const char *processing() const { return AGNOSTIC; } unsigned p_bit_error() const { return _p_bit_error; } int kind() const { return _kind; } bool on() const { return _on; } void set_bit_error(unsigned); // out of 0xFFFF int configure(Vector<String> &, ErrorHandler *); bool can_live_reconfigure() const { return true; } void add_handlers(); Packet *simple_action(Packet *); };CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?