VxWorks Reference Manual : Libraries

m2SysLib

NAME

m2SysLib - MIB-II system-group API for SNMP agents

ROUTINES

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

DESCRIPTION

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.

USING THIS LIBRARY

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 */

INCLUDE FILES

m2Lib.h

SEE ALSO

m2SysLib, m2Lib, m2IfLib, m2IpLib, m2IcmpLib, m2UdpLib, m2TcpLib


Libraries : Routines

m2SysInit( )

NAME

m2SysInit( ) - initialize MIB-II system-group routines

SYNOPSIS

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 */
    )

DESCRIPTION

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.

RETURNS

OK, always.

ERRNO

S_m2Lib_CANT_CREATE_SYS_SEM

SEE ALSO

m2SysLib, m2SysGroupInfoGet( ), m2SysGroupInfoSet( ), m2SysDelete( )


Libraries : Routines

m2SysGroupInfoGet( )

NAME

m2SysGroupInfoGet( ) - get system-group MIB-II variables

SYNOPSIS

STATUS m2SysGroupInfoGet
    (
    M2_SYSTEM * pSysInfo /* pointer to MIB-II system group structure */
    )

DESCRIPTION

This routine fills in the structure at pSysInfo with the values of MIB-II system-group variables.

RETURNS

OK, or ERROR if pSysInfo is not a valid pointer.

ERRNO

S_m2Lib_INVALID_PARAMETER

SEE ALSO

m2SysLib, m2SysInit( ), m2SysGroupInfoSet( ), m2SysDelete( )


Libraries : Routines

m2SysGroupInfoSet( )

NAME

m2SysGroupInfoSet( ) - set system-group MIB-II variables to new values

SYNOPSIS

STATUS m2SysGroupInfoSet
    (
    unsigned int varToSet, /* bit field of variables to set */
    M2_SYSTEM *  pSysInfo  /* pointer to the system structure */
    )

DESCRIPTION

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.

RETURNS

OK, or ERROR if pSysInfo is not a valid pointer, or varToSet has an invalid bit field.

ERRNO

 S_m2Lib_INVALID_PARAMETER
 S_m2Lib_INVALID_VAR_TO_SET

SEE ALSO

m2SysLib, m2SysInit( ), m2SysGroupInfoGet( ), m2SysDelete( )


Libraries : Routines

m2SysDelete( )

NAME

m2SysDelete( ) - delete resources used to access the MIB-II system group

SYNOPSIS

STATUS m2SysDelete (void)

DESCRIPTION

This routine frees all the resources allocated at the time the group was initialized. Do not access the system group after calling this routine.

RETURNS

OK, always.

SEE ALSO

m2SysLib, m2SysInit( ), m2SysGroupInfoGet( ), m2SysGroupInfoSet( ).