aodv_logs.cc

来自「CBRP协议(移动adhoc中基于分簇的路由协议)ns2下的源码」· CC 代码 · 共 82 行

CC
82
字号
/*    aodv_logs.cc   $Id: aodv_logs.cc,v 1.2 1998/11/19 06:23:17 dmaltz Exp $   */#include <aodv/aodv.h>#include <aodv/aodv_packet.h>#include <ip.h>#define CURRENT_TIME    Scheduler::instance().clock()static const int verbose = 0;/* =====================================================================   Logging Functions   ===================================================================== */voidAODV::log_link_del(nsaddr_t dst){        static int link_del = 0;        if(! logtarget || ! verbose) return;        /*         *  If "god" thinks that these two nodes are still         *  reachable then this is an erroneous deletion.         */        sprintf(logtarget->buffer(),                "A %.9f _%d_ deleting LL hop to %d (delete %d is %s)",                CURRENT_TIME,                index,                dst,                ++link_del,                God::instance()->hops(index, dst) != 1 ? "VALID" : "INVALID");        logtarget->dump();}voidAODV::log_link_broke(Packet *p){        static int link_broke = 0;        struct hdr_cmn *ch = HDR_CMN(p);        if(! logtarget || ! verbose) return;        sprintf(logtarget->buffer(),                "A %.9f _%d_ LL unable to deliver packet %d to %d (%d) (reason = %d, ifqlen = %d)",                CURRENT_TIME,                index,                ch->uid_,                ch->next_hop_,                ++link_broke,                ch->xmit_reason_,                ifqueue->length());	logtarget->dump();}voidAODV::log_link_kept(nsaddr_t dst){        static int link_kept = 0;        if(! logtarget || ! verbose) return;        /*         *  If "god" thinks that these two nodes are now         *  unreachable, then we are erroneously keeping         *  a bad route.         */        sprintf(logtarget->buffer(),                "A %.9f _%d_ keeping LL hop to %d (keep %d is %s)",                CURRENT_TIME,                index,                dst,                ++link_kept,                God::instance()->hops(index, dst) == 1 ? "VALID" : "INVALID");        logtarget->dump();}

⌨️ 快捷键说明

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