VxWorks Reference Manual : Libraries
m2SysLib - MIB-II system-group API for SNMP agents
m2SysInit( ) - initialize MIB-II system-group routines
m2SysGroupInfoGet( ) - get system-group MIB-II variables
m2SysGroupInfoSet( ) - set system-group MIB-II variables to new values
m2SysDelete( ) - delete resources used to access the MIB-II system group
This library provides MIB-II services for the system group. It provides routines to initialize the group and to access the group scalar variables. For a broader description of MIB-II services, see the manual entry for m2Lib.
This library can be initialized and deleted by calling m2SysInit( ) and m2SysDelete( ) respectively, if only the system group's services are needed. If full MIB-II support is used, this group and all other groups can be initialized and deleted by calling m2Init( ) and m2Delete( ).
The system group provides the option to set the system variables at the time m2Sysinit( ) is called. The MIB-II variables sysDescr and sysobjectId are read-only, and can be set only by the system-group initialization routine. The variables sysContact, sysName and sysLocation can be set through m2SysGroupInfoSet( ) at any time.
The following is an example of system group initialization:
M2_OBJECTID mySysObjectId = { 8, {1,3,6,1,4,1,731,1} }; if (m2SysInit ("VxWorks MIB-II library ", "support@wrs.com", "1010 Atlantic Avenue Alameda, California 94501", &mySysObjectId) == OK) /* System group initialized successfully */The system group variables can be accessed as follows:M2_SYSTEM sysVars; if (m2SysGroupInfoGet (&sysVars) == OK) /* values in sysVars are valid */The system group variables can be set as follows:M2_SYSTEM sysVars; unsigned int varToSet; /* bit field of variables to set */ /* Set the new system Name */ strcpy (m2SysVars.sysName, "New System Name"); varToSet |= M2SYSNAME; /* Set the new contact name */ strcpy (m2SysVars.sysContact, "New Contact"); varToSet |= M2SYSCONTACT; if (m2SysGroupInfoGet (varToSet, &sysVars) == OK) /* values in sysVars set */
m2Lib.h
m2SysLib, m2Lib, m2IfLib, m2IpLib, m2IcmpLib, m2UdpLib, m2TcpLib
m2SysInit( ) - initialize MIB-II system-group routines
STATUS m2SysInit ( char * pMib2SysDescr, /* pointer to MIB-2 sysDescr */ char * pMib2SysContact, /* pointer to MIB-2 sysContact */ char * pMib2SysLocation, /* pointer to MIB-2 sysLocation */ M2_OBJECTID * pObjectId /* pointer to MIB-2 ObjectId */ )
This routine allocates the resources needed to allow access to the system-group MIB-II variables. This routine must be called before any system-group variables can be accessed. The input parameters pMib2SysDescr, pMib2SysContact, pMib2SysLocation, and pObjectId are optional. The parameters pMib2SysDescr, pObjectId are read only, as specified by MIB-II, and can be set only by this routine.
OK, always.
S_m2Lib_CANT_CREATE_SYS_SEM
m2SysLib, m2SysGroupInfoGet( ), m2SysGroupInfoSet( ), m2SysDelete( )
m2SysGroupInfoGet( ) - get system-group MIB-II variables
STATUS m2SysGroupInfoGet ( M2_SYSTEM * pSysInfo /* pointer to MIB-II system group structure */ )
This routine fills in the structure at pSysInfo with the values of MIB-II system-group variables.
OK, or ERROR if pSysInfo is not a valid pointer.
S_m2Lib_INVALID_PARAMETER
m2SysLib, m2SysInit( ), m2SysGroupInfoSet( ), m2SysDelete( )
m2SysGroupInfoSet( ) - set system-group MIB-II variables to new values
STATUS m2SysGroupInfoSet ( unsigned int varToSet, /* bit field of variables to set */ M2_SYSTEM * pSysInfo /* pointer to the system structure */ )
This routine sets one or more variables in the system group as specified in the input structure at pSysInfo and the bit field parameter varToSet.
OK, or ERROR if pSysInfo is not a valid pointer, or varToSet has an invalid bit field.
S_m2Lib_INVALID_PARAMETER
S_m2Lib_INVALID_VAR_TO_SET
m2SysLib, m2SysInit( ), m2SysGroupInfoGet( ), m2SysDelete( )
m2SysDelete( ) - delete resources used to access the MIB-II system group
STATUS m2SysDelete (void)
This routine frees all the resources allocated at the time the group was initialized. Do not access the system group after calling this routine.
OK, always.
m2SysLib, m2SysInit( ), m2SysGroupInfoGet( ), m2SysGroupInfoSet( ).