📄 todevice.hh
字号:
#ifndef CLICK_TODEVICE_HH#define CLICK_TODEVICE_HH/*=title ToDevice.b=cToDevice(DEVNAME [, BURST, I<KEYWORDS>])=s devicessends packets to network device (BSD kernel)=dThis manual page describes the FreeBSD kernel module version of the ToDeviceelement. For the user-level element, read the ToDevice.u manual page.Pulls packets from its single input and sends them out the FreeBSD networkinterface named DEVNAME. DEVNAME may also be an Ethernet address, in whichcase ToDevice searches for a device with that address.Sends up to BURST packets each time it is scheduled. By default, BURST is 16.For good performance, you should set BURST to be 8 times the number ofelements that could generate packets for this device.Packets must have a link header. For Ethernet, ToDevice makes sure everypacket is at least 60 bytes long.Keyword arguments are:=over 8=item BURSTUnsigned integer. Same as the BURST argument.=item ALLOW_NONEXISTENTAllow nonexistent devices. If true, and no device named DEVNAME exists whenthe router is initialized, then ToDevice will report a warning (rather than anerror). Later, while the router is running, if a device named DEVNAME appears,ToDevice will seamlessly begin sending packets to it. Default is false.=back=nThe FreeBSD networking code may also send packets out the device. Click won'tsee those packets. Worse, FreeBSD may cause the device to be busy when aToDevice wants to send a packet. Click is not clever enough to re-queuesuch packets, and discards them. ToDevice's depend on the net driver's send operation for synchronization=h packets read-onlyReturns the number of packets ToDevice has pulled.=h reset_counts write-onlyResets C<packets> counter to zero when written.=a FromDevice, FromHost, ToHost, ToDevice.u */#include "elements/bsdmodule/anydevice.hh"#include <click/notifier.hh>class ToDevice : public AnyDevice { public: ToDevice(); ~ToDevice(); const char *class_name() const { return "ToDevice"; } const char *processing() const { return PULL; } int configure_phase() const { return CONFIGURE_PHASE_TODEVICE; } int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); void add_handlers(); bool run_task(); void reset_counts(); unsigned _npackets; unsigned long _busy_returns; private: unsigned _burst; NotifierSignal _signal; };#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -