📄 priq.h
字号:
// A simple priority queue with a remove packet function#ifndef _priq_h#define _priq_h#include "object.h"#include "queue.h"#include "d-tail.h"#include "packet.h"#include "lib/bsd-list.h"#define MAXp 4 #define PKT_LEVEL(p) HDR_IP(p)->prio()class PriQ;typedef int (*PacketFilter)(Packet *, void *);LIST_HEAD(PriQ_List, PriQ);class PriQ : public DTail {public: PriQ(); int command(int argc, const char*const* argv); void recv(Packet *p, Handler *h); void pri_recv(Packet *p, Handler *h); void recvHighPriority(Packet *, Handler *); // insert packet at front of queue void filter(PacketFilter filter, void * data); // apply filter to each packet in queue, // - if filter returns 0 leave packet in queue // - if filter returns 1 remove packet from queue Packet* filter(nsaddr_t id); DTail pri_[MAXp]; void Terminate(void); int getLevels(); //added by smallko int choice; // 0: normal operation, 1: I:AC1 P:AC2 B: AC3, 2: Dynamic int threshold1; int threshold2; double prob0; double prob1; double prob2; int qlen0; int qlen1; int qlen2; int qlen3; private: int Prefer_Routing_Protocols; int max_levels; int level; int levels; int flag; int cntl; /* * A global list of Interface Queues. I use this list to iterate * over all of the queues at the end of the simulation and flush * their contents. - josh */public: LIST_ENTRY(PriQ) link; static struct PriQ_List prhead;};#endif /* !_priq_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -