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

📄 unique_id.h

📁 在NS-2环境中实现了移动Ad Hoc的两种广播算法:Flood和Bcast。里面本来有个test目录
💻 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 unique message IDs. These are saved in a list * which gets temporarily purged (entries have associated timeout values). */#ifndef _unique_id_#define _unique_id_#include "cmu-trace.h"#define UNIQUE_ID_SAVE 100  /*  Unique ID Cache*/class UniqueIDHandler;class UniqueID {	friend class UniqueIDHandler; public:        UniqueID(nsaddr_t i, u_int32_t b) { src = i; id = b;  } protected:        LIST_ENTRY(UniqueID) link;        nsaddr_t        src;        u_int32_t       id;        double          expire;         // now + UNIQUE_ID_SAVE s};LIST_HEAD(UID_cache, UniqueID);class UniqueIDHandler : public Handler {public:        UniqueIDHandler() {LIST_INIT(&uids);}        void    handle(Event*);        void 	id_insert(nsaddr_t id, u_int32_t bid);        bool 	id_lookup(nsaddr_t id, u_int32_t bid);        void 	id_purge();private:        Event   intr;        UID_cache uids;};#endif

⌨️ 快捷键说明

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