⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysmth.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/winagent/sysmth.c,v 1.2 2001/11/09 21:29:36 josh Exp $ *//* * Copyright (C) 1999-2005 Wind River Systems, Inc. * All rights reserved.  Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. *//**************************************************************************** *  Copyright 1988-1997 Epilogue Technology Corporation. *  Copyright 1998 Integrated Systems, Inc. *  All rights reserved. ****************************************************************************//* system group method routines for winsock agent *//* * $Log: sysmth.c,v $ * Revision 1.2  2001/11/09 21:29:36  josh * winagent path retooling * * Revision 1.1.1.1  2001/11/05 17:49:18  tneale * Tornado shuffle * * Revision 1.7  2001/01/19 22:25:10  paul * Update copyright. * * Revision 1.6  2000/03/17 00:15:48  meister * Update copyright message * * Revision 1.5  1998/02/25 04:58:28  sra * Update copyrights. * * Revision 1.4  1997/03/20 06:53:31  sra * DFARS-safe copyright text.  Zap! * * Revision 1.3  1997/02/25 10:58:16  sra * Update copyright notice, dust under the bed. * *//* [clearcase]modification history-------------------01a,19apr05,job  update copyright notices*/#include "wsagent.h"#include <sys/types.h>#include <sys/timeb.h>#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/auxfuncs.h>#include "sysvars.h"UINT_32_T  sysuptime(void){struct _timeb now_is;_ftime(&now_is);return((UINT_32_T)(((now_is.time - boot_at.time) * 100) +			(now_is.millitm / 10)));}  /****************************************************************************NAME:  get_sysUpTimePURPOSE:  Get the system uptime object PARAMETERS:	OIDC_T      Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int      Number of components in the unused part of the			object identifier	OIDC_T * Unused part of the object identifier	SNMP_PKT_T *   SNMP packet currently being processed.	VB_T *      Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void  get_sysUpTime(OIDC_T      last_match,		int       tcount,		OIDC_T      *tlist,		SNMP_PKT_T  *pktp,		VB_T     *vbp){		/* test that the instance information is correct,	we should have a sinlge oid of value 0 */if ((tcount != 1) || (*tlist != 0))	 getproc_nosuchins(pktp, vbp);else	 getproc_got_uint32(pktp, vbp, sysuptime(), VT_TIMETICKS);return;}/****************************************************************************NAME:  get_sysNamePURPOSE:  Get the system namePARAMETERS:	OIDC_T      Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int      Number of components in the unused part of the			object identifier	OIDC_T * Unused part of the object identifier	SNMP_PKT_T *   SNMP packet currently being processed.	VB_T *      Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void  get_sysName(OIDC_T     last_match,			int       tcount,			OIDC_T      *tlist,			SNMP_PKT_T  *pktp,			VB_T     *vbp){static int nm_length = 0;/* test that the instance information is correct,	we should have a sinlge oid of value 0 */if ((tcount != 1) || (*tlist != 0))	 getproc_nosuchins(pktp, vbp);else {	 /* The address returned *MUST* reference a static location */	 if (nm_length == 0) {	(void)gethostname(snmp_sysName, MAX_SYSNAME);	nm_length = strlen(snmp_sysName);	}	 getproc_got_string(pktp, vbp, nm_length, snmp_sysName, 0, VT_STRING);	 }return;}#if 0/*ARGSUSED*/voidset_sysLocation(lastmatch, compc, compl, cookie, cp, length)	OIDC_T   lastmatch;	int   compc;	OIDC_T   *compl;	char  *cookie;	char  *cp;	int   length;{int lngth;if (length != 0)  {  lngth = min(MAX_SYSLOCATION-1, length);  void memcpy(cookie, cp, min(MAX_SYSLOCATION, lngth));  cookie[lngth] = '\0';  }}#endif/****************************************************************************NAME:  set_sysContactPURPOSE:  set the given value into the contact name areaPARAMETERS:	OIDC_T      Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int      Number of components in the unused part of the			object identifier	OIDC_T * Unused part of the object identifier	SNMP_PKT_T *   SNMP packet currently being processed.	VB_T *      Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void  set_sysContact(OIDC_T     last_match,		 int      tcount,		 OIDC_T     *tlist,		 SNMP_PKT_T *pktp,		 VB_T    *vbp){int lngth;OCTET_T *cp;lngth = EBufferUsed(&vbp->value_u.v_string);cp = (OCTET_T *)(VB_TO_COOKIE(vbp));if (lngth) {	 MEMCPY(cp, EBufferStart(&vbp->value_u.v_string), lngth);	 cp[lngth] = '\0';	 }setproc_good(pktp, vbp);return;}/****************************************************************************NAME:  test_sysContactPURPOSE:  Test the instance information and values to be set.PARAMETERS:	OIDC_T      Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int      Number of components in the unused part of the			object identifier	OIDC_T * Unused part of the object identifier	SNMP_PKT_T *   SNMP packet currently being processed.	VB_T *      Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void  test_sysContact(OIDC_T    last_match,		  int     tcount,		  OIDC_T *tlist,		  SNMP_PKT_T   *pktp,		  VB_T      *vbp){int lngth;lngth = EBufferUsed(&vbp->value_u.v_string);if (lngth > (MAX_SYSCONTACT - 1)) {	 testproc_error(pktp, vbp, WRONG_LENGTH);	 return;	 }/* test that the instance information is correct,	we should have a sinlge oid of value 0 */if ((tcount != 1) || (*tlist != 0))	 testproc_error(pktp, vbp, NO_CREATION);else 	 testproc_good(pktp, vbp);return;}/****************************************************************************NAME:  get_sysServicesPURPOSE:  Get the system servicesPARAMETERS:	OIDC_T      Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int      Number of components in the unused part of the			object identifier	OIDC_T * Unused part of the object identifier	SNMP_PKT_T *   SNMP packet currently being processed.	VB_T *      Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void  get_sysServices(OIDC_T    last_match,		  int     tcount,		  OIDC_T *tlist,		  SNMP_PKT_T   *pktp,		  VB_T      *vbp){/* test that the instance information is correct,	we should have a sinlge oid of value 0 */if ((tcount != 1) || (*tlist != 0))	 getproc_nosuchins(pktp, vbp);else	 getproc_got_int32(pktp, vbp, 0x4F);return;}intsys_init(){return 0;}

⌨️ 快捷键说明

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