sif_set.c,v

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

C,V
62
字号
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
@/* sif_set.c - sif_set */

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

#ifdef	SNMP

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

/*------------------------------------------------------------------------
 * sif_set - perform a set on a variable in the Interfaces Table
 *------------------------------------------------------------------------
 */
int sif_set(bindl, mip, numifaces)
struct snbentry	*bindl;
struct mib_info	*mip;
int		numifaces;
{
	int iface, field;

	if (sif_match(bindl, &iface, &field, numifaces) == SYSERR)
		return SERR_NO_SUCH;
	/* the only settable object here is ifAdminStatus (ifEntry 7) */
	if (field != 7)
		return SERR_NO_SUCH;
	if (SVTYPE(bindl) != ASN1_INT)
		return SERR_BAD_VALUE;
	if (SVINT(bindl) < 0 || SVINT(bindl) > 1)
		return SERR_BAD_VALUE;
	/* value is OK, so install it */
	nif[iface].ni_admstate = SVINT(bindl);
	return SNMP_OK;
}
#endif	/* SNMP */
@

⌨️ 快捷键说明

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