srt_getn.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 68 行

C,V
68
字号
head	1.1;
access;
symbols;
locks
	dls:1.1; strict;
comment	@ * @;


1.1
date	97.09.21.19.29.17;	author dls;	state Dist;
branches;
next	;


desc
@@


1.1
log
@pre-3e code
@
text
@/* srt_getn.c - srt_getn */

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

#ifdef	SNMP

#include <snmp.h>
#include <mib.h>
#include <asn1.h>

/*------------------------------------------------------------------------
 * srt_getn - perform a getnext on a variable in the Routing Table
 *------------------------------------------------------------------------
 */
int srt_getn(bindl, mip, numifaces)
struct snbentry *bindl;
struct mib_info *mip;
int		numifaces;
{
	struct 	route	*rtp, *srt_findnext();
	int		rtl, field, oidi;

	if (srt_match(bindl, &rtp, &rtl, &field) == SYSERR)
		return SERR_NO_SUCH;
	if ((rtp = srt_findnext(rtp, &rtl)) == 0) {
		rtp = (struct route *) NULL;
		rtl = 0;	/* set route hash table list to 0 */
		rtp = srt_findnext(rtp, &rtl);
		if (++field > SNUMF_RTTAB) 
			return (*mip->mi_next->mi_func)
				(bindl, mip->mi_next, SOP_GETF);
	}
	oidi = SRT_OIDLEN;	/* 4.21.1 */

	bindl->sb_oid.id[oidi++] = field;
	sip2ocpy(&bindl->sb_oid.id[oidi], rtp->rt_net, IP_ALEN);
	bindl->sb_oid.len = oidi + IP_ALEN;

	return srt_get(bindl, numifaces);
}
#endif	/* SNMP */
@

⌨️ 快捷键说明

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