📄 tora_api.cc
字号:
/* tora_api.cc $Id: tora_api.cc,v 1.1.1.1 2000/08/28 18:40:21 jinyang Exp $ Implement the API used by IMEP */#include <cmu/tora/tora.h>#define CURRENT_TIME Scheduler::instance().clock()voidtoraAgent::rtNotifyLinkUP(nsaddr_t index){ TORADest *td = dstlist.lh_first; /* * Update the destination lists... */ for( ; td; td = td->link.le_next) { if(td->nb_find(index) == 0) { (void) td->nb_add(index); } if (td->rt_req) { // must send a new query for this dest so the new // neighbor can hear it // IMEP will take care of aggregating all these into // one physical pkt trace("T %.9f _%d_ QRY %d for %d (rtreq set)", Scheduler::instance().clock(), ipaddr(), td->index, index); sendQRY(td->index); td->time_tx_qry = CURRENT_TIME; } }}voidtoraAgent::rtNotifyLinkDN(nsaddr_t index){ TORADest *td = dstlist.lh_first; /* * Purge each Destination's Neighbor List */ for( ; td; td = td->link.le_next) { if(td->nb_del(index)) { /* * Send an UPD packet if you've lost the last * downstream link. */ sendUPD(td->index); } } /* * Now purge the Network Interface queues that * may have packets destined for this broken * neighbor. */ { Packet *head = 0; Packet *p; Packet *np = 0; while((p = ifqueue->prq_get_nexthop(index))) { p->next_ = head; head = p; } for(p = head; p; p = np) { np = p->next_; /* * This make a lot of sense for TORA since we * will almost always have multiple routes to * a destination. */ log_link_layer_recycle(p); rt_resolve(p); } }}voidtoraAgent::rtNotifyLinkStatus(nsaddr_t /* index */, u_int32_t /* status */){ abort();}voidtoraAgent::rtRoutePacket(Packet *p){ struct hdr_cmn *ch = HDR_CMN(p); struct hdr_ip *ip = HDR_IP(p); // Non-data packets and BROADCAST packets can be dropped. if(DATA_PACKET(ch->ptype()) == 0 || ip->dst() == (nsaddr_t) IP_BROADCAST) { drop(p, DROP_RTR_MAC_CALLBACK); return; } rt_resolve(p);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -