📄 linkunqueue.hh
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_LINKUNQUEUE_HH#define CLICK_LINKUNQUEUE_HH#include <click/element.hh>#include <click/task.hh>#include <click/timer.hh>#include <click/notifier.hh>#include <click/standard/storage.hh>CLICK_DECLS/*=cLinkUnqueue(LATENCY, BANDWIDTH)=s packet schedulinglink emulator=dPulls packets from the single input port, then delays them so as to emulate aserial link with latency LATENCY (microsecond precision) and bandwidthBANDWIDTH (such as "384kbps"). Thus, every packet is delayed at leastby LATENCY, and additionally delayed by their packet size and BANDWIDTH, andby any packets ahead of it in the virtual link. Packets are pushed out thesingle output port when their time comes.LinkUnqueue listens for upstream notification, such as that available fromQueue.LinkUnqueue stores packets that are in transit over the virtual link. Itdoesn't store any other packets, however; it doesn't pull from its inputunless there is room on the link. To emulate a link fed by a packet queue, usea "Queue -> LinkUnqueue" combination.LinkUnqueue uses its input packets' "extra length" annotations, and destroystheir "next packet" annotations.=h latency read-onlyThe LATENCY argument.=h bandwidth read-onlyThe BANDWIDTH argument.=h size read-onlyThe number of packets currently in, or partially in, the emulated link.=h reset write-onlyWhen written, drops all packets in, or partially in, the emulated link.=a DelayUnqueue, Queue, Unqueue, RatedUnqueue, BandwidthRatedUnqueue,DelayShaper, SetTimestamp */class LinkUnqueue : public Element, public Storage { public: LinkUnqueue(); ~LinkUnqueue(); const char *class_name() const { return "LinkUnqueue"; } const char *processing() const { return PULL_TO_PUSH; } void *cast(const char *); int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); void add_handlers(); bool run_task(); private: Packet *_qhead; Packet *_qtail; Timestamp _latency; enum { S_TASK, S_TIMER, S_ASLEEP } _state; uint32_t _bandwidth; Task _task; Timer _timer; NotifierSignal _signal; void delay_by_bandwidth(Packet *, const Timestamp &) const; static String read_param(Element *, void *); static int write_handler(const String &, Element *, void *, ErrorHandler *);};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -