confile.c

来自「mcf5307实验源代码」· C语言 代码 · 共 312 行 · 第 1/2 页

C
312
字号
                             
                        case CONIP:
                             memcpy ((void *)&Smptr->hostip.is_ip_addrs[0],
                                        (const void *)&m->hostip.is_ip_addrs[0],
                                        4);
                             Smptr->mstat=m->mstat;
                             break;
                             
                        case CONGATE:           /* gateways cannot be copied 
                          from */
							 Smptr->gateway = 0;
                             break;
                             
                        case CONNS:                 /* can't copy nameservers 
                          either */
							 Smptr->nameserv = 0;
                             break;
                             
                        case CONRETR:
                             Smptr->retrans=m->retrans;
                             break;
                             
                        case CONWIND:
                             Smptr->window=m->window;
                             break;
                             
                        case CONSEG:
                             Smptr->maxseg=m->maxseg;
                             break;
                             
                        case CONMTU:
                             Smptr->mtu=m->mtu;
                             break;
                             
                        case CONTO:
                             Smptr->conto=m->conto;
                             break;
                             
                        case CONDUP:
                             Smptr->halfdup=m->halfdup;
                             break;
                             
                        case CONPORT:
                             Smptr->port=m->port;
                             break;
                             
                        default:
                             break;
                    }   /* end switch */
               else
                    switch(100+i) {     /* m=NU_NULL, install default values */
                        case CONHOST:
                             Smptr->hname[0] = NU_NULL;
                             break;
                             
                        case CONIP:
                             Smptr->mstat=NOIP;
                             break;
                             
						case CONGATE:			/* gateways cannot be copied from */
							 Smptr->gateway = 0;
                             break;
                             
                        case CONRETR:
                             Smptr->retrans=MINRTO;
                             break;
                             
                        case CONWIND:
                             Smptr->window=WINDOWSIZE;
                             break;
                             
                        case CONSEG:
                             Smptr->maxseg=MAX_SEGMENT_LEN;
                             break;
                             
                        case CONMTU:
                             Smptr->mtu=MAX_SEGMENT_LEN;
                             break;
                             
                        case CONNS:                 /* can't copy nameservers 
                          either */
							 Smptr->nameserv = 0;
                             break;
                             
                        case CONTO:
                             Smptr->conto=CONNWAITTIME;
                             break;
                             
                        case CONDUP:
							 Smptr->halfdup = 0;
                             break;
                             
                        case CONPORT:
                             Smptr->port=23;            /* the telnet port */
                             break;

                        default:
                             break;
                    }   /* end switch */
           }    /* end if */
	  Sflags[0] = 1;				  /* set that this machine was copied */
}   /* end Scopyfrom() */

/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      Ssetgates                                                        */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*   set up the gateway machines and the subnet mask after netinit()     */
/*   and start up ftp and rcp for them.                                  */
/*                                                                       */
/* CALLED BY                                                             */
/*      Snetinit                Network initialization                   */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      netsetmask                                                       */
/*      netsetgate                                                       */
/*                                                                       */
/*************************************************************************/
void Ssetgates (void)
{
	struct machinfo *m;
    int16 level, again;


	/*
     *  Search the list of machines for gateway flags.
     *  Invoke netsetgate in increasing order of gateway level #s.
     *  Terminates when it gets through list without finding next higher number.
     */
	level = 0;
	do
	{
		level++;
		again = 0;
		m = Smachlist;
        while (m != NU_NULL)
		{
			if ((m->gateway == (uint8)level) && (m->mstat >= HAVEIP))
			{
                netsetgate (&m->hostip.is_ip_addrs[0]);
			} /* end if */
			if ((m->gateway) == (uint8)(level + 1))
			{
				again = 1;
			}
			m = m->next;
        }  /* end while m != NU_NULL */
	} while (again);
}  /* end Ssetgates */

⌨️ 快捷键说明

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