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

📄 polldevice.hh

📁 COPE the first practical network coding scheme which is developped on click
💻 HH
字号:
#ifndef CLICK_POLLDEVICE_HH#define CLICK_POLLDEVICE_HH/*=cPollDevice(DEVNAME [, PROMISC, BURST, I<KEYWORDS>])=s devicespolls packets from network device (kernel)=dPoll packets received by the Linux network interface named DEVNAME. Packetswill be pushed to output 0. The packets include the link-level header. DEVNAMEmay also be an Ethernet address, in which case PollDevice searches for adevice with that address.Each time PollDevice is scheduled, it emits at most BURST packets. By default,BURST is 8.If PROMISC is set (by default, it is not), then the device is put intopromiscuous mode.This element is only available in the Linux kernel module.Keyword arguments are:=over 8=item PROMISCBoolean. Same as the PROMISC argument.=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 PollDevice will report a warning (rather thanan error). Later, while the router is running, if a device named DEVNAMEappears, PollDevice will seamlessly begin emitting its packets. Default isfalse.=back=nLinux won't see any packets from the device. If you want Linux to processpackets, you should hand them to ToHost. Also, if you would like to sendpackets while using PollDevice, you should also define a ToDevice on the samedevice.This element can only be used with devices that support the Click pollingextension. We have written polling patches for the Tulip Ethernet driver.Linux device drivers, and thus FromDevice, should set packets' timestamp,packet-type, and device annotations.=h count read-onlyReturns the number of packets PollDevice has received from the input card.=h reset_counts write-onlyResets C<count> counter to zero when written.=a FromDevice, ToDevice, FromHost, ToHost */#include "elements/linuxmodule/anydevice.hh"class PollDevice : public AnyTaskDevice { public:    PollDevice();  ~PollDevice();  static void static_initialize();  static void static_cleanup();    const char *class_name() const	{ return "PollDevice"; }  const char *processing() const	{ return PUSH; }    int configure_phase() const		{ return CONFIGURE_PHASE_POLLDEVICE; }  int configure(Vector<String> &, ErrorHandler *);  int initialize(ErrorHandler *);  void cleanup(CleanupStage);  void add_handlers();  void change_device(net_device *);  /* process a packet. return 0 if not wanted after all. */  int got_skb(struct sk_buff *);  bool run_task();  void reset_counts();    uint32_t _npackets;#if CLICK_DEVICE_STATS  uint64_t _time_poll;  uint64_t _time_allocskb;  uint64_t _time_refill;  uint64_t _perfcnt1_poll;  uint64_t _perfcnt1_refill;  uint64_t _perfcnt1_allocskb;  uint64_t _perfcnt1_pushing;  uint64_t _perfcnt2_poll;  uint64_t _perfcnt2_refill;  uint64_t _perfcnt2_allocskb;  uint64_t _perfcnt2_pushing;  uint32_t _empty_polls;  uint32_t _activations;#endif#if CLICK_DEVICE_THESIS_STATS || CLICK_DEVICE_STATS  uint64_t _push_cycles;#endif      uint32_t _buffers_reused; private:  unsigned _burst;};#endif 

⌨️ 快捷键说明

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