nb_switch.c,v
来自「TCP-IP红宝书源代码」· C,V 代码 · 共 107 行
C,V
107 行
head 1.3;
access;
symbols;
locks
dls:1.3; strict;
comment @ * @;
1.3
date 97.09.21.19.28.38; author dls; state Dist;
branches;
next 1.2;
1.2
date 94.02.13.19.38.53; author dls; state Works;
branches;
next 1.1;
1.1
date 94.02.06.18.20.37; author dls; state Ok;
branches;
next ;
desc
@@
1.3
log
@pre-3e code
@
text
@/* nb_switch.c - nb_switch */
#include <conf.h>
#include <kernel.h>
#include <network.h>
#include <ospf.h>
/*------------------------------------------------------------------------
* nb_switch - handle neighbor state changes on HELLO packet input
*------------------------------------------------------------------------
*/
int nb_switch(pif, pnb, pep)
struct ospf_if *pif;
struct ospf_nb *pnb;
struct ep *pep;
{
struct ip *pip;
struct ospf *po;
struct ospf_hello *poh;
Bool found = FALSE;
int nn, maxn;
pip = (struct ip *)pep->ep_data;
po = (struct ospf *)((char *)pip + IP_HLEN(pip));
poh = (struct ospf_hello *)po->ospf_data;
maxn = (po->ospf_len - MINHELLOLEN) / sizeof(long);
for (nn=0; nn<maxn; ++nn)
if (found = (pif->if_rid == poh->oh_neighbor[nn]))
break;
if (!found) {
if (pnb->nb_state >= NBS_2WAY) {
pnb->nb_state = NBS_INIT;
nb_clearl(pnb);
}
return 0;
} else if (pnb->nb_state == NBS_INIT) {
pnb->nb_state = NBS_2WAY;
if (nb_aok(pif, pnb)) {
gettime(&pnb->nb_seq); /* set initial seq */
pnb->nb_state = NBS_EXSTART;
nb_makel(pnb);
dd_queue(pif, pnb);
}
}
return 1;
}
@
1.2
log
@*** empty log message ***
@
text
@@
1.1
log
@Initial revision
@
text
@d34 1
a34 1
/* clear LS rexmt, DB summary & LS req lists here */
d38 1
d42 3
a44 3
dd_send(pif, pnb);
} else
pnb->nb_state = NBS_2WAY;
@
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?