ospflstmpl.c

来自「TCP-IP红宝书源代码」· C语言 代码 · 共 37 行

C
37
字号
/* ospflstmpl.c - ospflstmpl */

#include <conf.h>
#include <kernel.h>
#include <network.h>
#include <ospf.h>

/*------------------------------------------------------------------------
 * ospflstmpl - fill in OSPF Link State Update packet template
 *------------------------------------------------------------------------
 */
struct ep *
ospflstmpl(struct ospf_if *pif)
{
	struct ep	*pep;
	struct ip	*pip;
	struct ospf	*po;
	struct ospf_lsu	*plsu;

	pep = (struct ep *)getbuf(Net.netpool);
	if ((int)pep == SYSERR)
		return 0;
	pip = (struct ip *)pep->ep_data;
	po = (struct ospf *)pip->ip_data;
	plsu = (struct ospf_lsu *)po->ospf_data;

	po->ospf_version = OSPF_VERSION;
	po->ospf_type = T_LSUPDATE;
	po->ospf_len = MINLSULEN;
	po->ospf_rid = pif->if_rid;
	po->ospf_aid = pif->if_area->ar_id;
	po->ospf_authtype = pif->if_area->ar_authtype;
	memcpy(po->ospf_auth, pif->if_auth, AUTHLEN);
	plsu->lsu_nads = 0;
	return pep;
}

⌨️ 快捷键说明

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