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

📄 bcast_queue.h

📁 code that can compile NS-2.27 on Fedora Core 4
💻 H
字号:
/******************************************************************* Copyright (C) 2004 Thomas Kunz, CRC Canada, BCAST for IPv4. DISTRIBUTED WITH NO WARRANTY, EXPRESS OR IMPLIED. See the GNU Library General Public License (file COPYING in the MANET_multicast directory) for conditions of use and redistribution.*********************************************************************//* * Functions to manage pending broadcast messages. These are saved in  * an ordered list, with timeouts set to schedule the first packet in the * list. * This queue structure is necessarily to implement the Scalable Broadcast * Algorithm described in "Comparison of Broadcasting Techniques for * Mobile Ad Hoc Networks" by Williams and Camp, MobiHoc 2002. */#ifndef _bcast_queue_h_#define _bcast_queue_h_#include "cmu-trace.h"#include "bcast/bcast.h"#include "bcast/bcast_packet.h"#define MAX_QUEUE_LEN	20	// maximum number of pending broadcasts/*  Pending BCAST list*/class BCASTHandler;class PendingBCAST {	friend class BCASTHandler; public:	PendingBCAST(Packet *packet, double delay) { p=packet; expire=delay; } protected:        LIST_ENTRY(PendingBCAST) link;	int             no_of_neighbors;         // how many neighbors	nsaddr_t        neighbors[NEIGHBOR_COUNT];// one-hop neighborhood        Packet		*p;        double          expire;};LIST_HEAD(PBCAST_cache, PendingBCAST);class BCASTHandler : public Handler {	friend class BCAST;public:        BCASTHandler(BCAST *a) : agent(a) {LIST_INIT(&pbcasts); no_bcasts=0;}        void    handle(Event*);        void 	insert(Packet *p, int no_of_neighbors, nsaddr_t neighbors[], 			double delay);	void	process(nsaddr_t src, int unique_id, 			int count, nsaddr_t neighbors[]);private:        Event   intr;	BCAST	*agent;	int	no_bcasts;        PBCAST_cache pbcasts; // cache (list) of pending BCASTs	void 	compare(PendingBCAST *b, int count, nsaddr_t neighbors[]);};#endif

⌨️ 快捷键说明

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