NS2下AODV协议aodv.cc注释(11)


/*
 * Called when we receive *explicit* notification that a Neighbor
 * is no longer reachable.
 */
void
AODV::nb_delete(nsaddr_t id) {
AODV_Neighbor *nb = nbhead.lh_first;

log_link_del(id);
 seqno += 2;    // Set of neighbors changed
 assert ((seqno%2) == 0);

for(; nb; nb = nb->nb_link.le_next) {
  if(nb->nb_addr == id) {
    LIST_REMOVE(nb,nb_link);
    delete nb;
    break;
  }
 }

handle_link_failure(id);

}


/*
 * Purges all timed-out Neighbor Entries - runs every
 * HELLO_INTERVAL * 1.5 seconds.
 */
void
AODV::nb_purge() {
AODV_Neighbor *nb = nbhead.lh_first;
AODV_Neighbor *nbn;
double now = CURRENT_TIME;

for(; nb; nb = nbn) {
  nbn = nb->nb_link.le_next;
  if(nb->nb_expire <= now) {
    nb_delete(nb->nb_addr);
  }
 }

}

Ubuntu 13.04 安装NS2.35

Linux平台下NS2.35安装

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ab5562fd35bafa4ee10b3188dd4834ce.html