📄 rrriptic.c
字号:
/** Copyright (c) 1998-2001 by NETsilicon Inc.** This software is copyrighted by and is the sole property of* NETsilicon. All rights, title, ownership, or other interests* in the software remain the property of NETsilicon. This* software may only be used in accordance with the corresponding* license agreement. Any unauthorized use, duplication, transmission,* distribution, or disclosure of this software is expressly forbidden.** This Copyright notice may not be removed or modified without prior* written consent of NETsilicon.** NETsilicon, reserves the right to modify this software* without notice.** NETsilicon* 411 Waverley Oaks Road USA 781.647.1234* Suite 227 http://www.netsilicon.com* Waltham, MA 02452 AmericaSales@netsilicon.com*************************************************************************** $Name: Fusion 6.52 Fusion 6.51 $* $Date: 2001/09/24 15:24:10 $* $Source: M:/psisrc/routing/rip/rcs/rrriptic.c $* $Revision: 1.7 $**************************************************************************** File Description: RIP tic processing ***************************************************************************/#include <ipport.h>#include <riproute.h>/****************************************RipTic:- proces route ttl.- call rip output once every 30 secs or on trigger req.****************************************/void RipTic(void){ int i,j; ipna_pt loc_ipa; rcirc_pt rc; /* route ttl timer list */ rrProcTimers(&ripTimers); /* rip periodic tx */ if(--rip_clock <= 0){ r_node->rn_trig = FALSE; } r_node->rn_tics++; /* periodic or trigger tx */ if(rip_clock <= 0 || r_node->rn_trig){ /* transmit gratuitous RSP */ /* generate locally connected routes if not present */ for( i= 0; i < CIRC_HASHES; i++){ for(rc= (rcirc_pt)rip_circ_hash[i].dll_fwd; rc; rc= rc->rc_fwd){ if(rc->rc_state != RCIRC_UP){ continue; } /* one for each add on multi-homed I/F, and also once if line is unnumbered. */ loc_ipa = rc->rc_ipa; for(j = 0; j < MAX_IF_IPADD; j++, loc_ipa++){ if(j && !loc_ipa->ip_add){ break; } /* tx an RSP frame */ riptx(loc_ipa, rc->rc_id, r_node->rn_trig,(rripa)0,0,0); } } } } /* clear triggered update */ r_node->rn_trig = FALSE; /* reset timed update */ if(rip_clock <= 0){ rip_clock = r_node->rn_riptimer; }}/***********************************************ripTimeout:route has expired or garbage time has expired.***********************************************/void ripTimeout(iproute_ent_pt rt){ /* verify rip */ ASSERT(RT_OWNER(rt) == IPRT_RIP,"ripTimeout: not rip owner"); /* was not infinite */ if(RT_TOS0_COST(rt) < RIP_INFINITE){ RipPurgeRoute(rt, 1); } /* was already infinite */ else{ RipDelRoute(rt); }}/************************************************ripRemLife:compute remaining ttl of route by traversingtimer list.***********************************************/int ripRemLife( rrtimer_pt t ){ rrtimer_pt t2; int cum; /* add all deltas */ for( t2 = ripTimers.dll_fwd, cum = 0; t2; t2 = t2->t_fwd){ cum += t2->t_delta; if(t2 == t){ return(cum); } } return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -