VxWorks Reference Manual : Libraries

m2UdpLib

NAME

m2UdpLib - MIB-II UDP-group API for SNMP agents

ROUTINES

m2UdpInit( ) - initialize MIB-II UDP-group access
m2UdpGroupInfoGet( ) - get MIB-II UDP-group scalar variables
m2UdpTblEntryGet( ) - get a UDP MIB-II entry from the UDP list of listeners
m2UdpDelete( ) - delete all resources used to access the UDP group

DESCRIPTION

This library provides MIB-II services for the UDP group. It provides routines to initialize the group, access the group scalar variables, and read the table of UDP listeners. 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 m2UdpInit( ) and m2UdpDelete( ) respectively, if only the UDP 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 group scalar variables are accessed by calling m2UdpGroupInfoGet( ) as follows:

    M2_UDP   udpVars;

    if (m2UdpGroupInfoGet (&udpVars) == OK)
        /* values in udpVars are valid */
The UDP table of listeners can be accessed in lexicographical order. The first entry in the table can be accessed by setting the table index to zero in a call to m2UdpTblEntryGet( ). Every other entry thereafter can be accessed by incrementing the index returned from the previous invocation to the next possible lexicographical index, and repeatedly calling m2UdpTblEntryGet( ) with the M2_NEXT_VALUE constant as the search parameter. For example:
M2_UDPTBL  udpEntry;

    /* Specify zero index to get the first entry in the table */

    udpEntry.udpLocalAddress = 0;    /* local IP Address in host byte order  */
    udpEntry.udpLocalPort    = 0;    /* local port Number                  */

    /* get the first entry in the table */

    if ((m2UdpTblEntryGet (M2_NEXT_VALUE, &udpEntry) == OK)
        /* values in udpEntry in the first entry are valid  */

    /* process first entry in the table */

    /* 
     * For the next call, increment the index returned in the previous call.
     * The increment is to the next possible lexicographic entry; for
     * example, if the returned index was 0.0.0.0.3000 the index passed in the
     * next invocation should be 0.0.0.0.3001.  If an entry in the table
     * matches the specified index, then that entry is returned.  
     * Otherwise the closest entry following it, in lexicographic order,
     * is returned.
     */

    /* get the second entry in the table */

    if ((m2UdpTblEntryGet (M2_NEXT_VALUE, &udpEntry) == OK)
        /* values in udpEntry in the second entry are valid  */

INCLUDE FILES

m2Lib.h

SEE ALSO

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


Libraries : Routines

m2UdpInit( )

NAME

m2UdpInit( ) - initialize MIB-II UDP-group access

SYNOPSIS


STATUS m2UdpInit (void)

DESCRIPTION

This routine allocates the resources needed to allow access to the UDP MIB-II variables. This routine must be called before any UDP variables can be accessed.

RETURNS

OK, always.

SEE ALSO

m2UdpLib, m2UdpGroupInfoGet( ), m2UdpTblEntryGet( ), m2UdpDelete( )


Libraries : Routines

m2UdpGroupInfoGet( )

NAME

m2UdpGroupInfoGet( ) - get MIB-II UDP-group scalar variables

SYNOPSIS

STATUS m2UdpGroupInfoGet
    (
    M2_UDP * pUdpInfo /* pointer to the UDP group structure */
    )

DESCRIPTION

This routine fills in the UDP structure at pUdpInfo with the MIB-II UDP scalar variables.

RETURNS

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

ERRNO

S_m2Lib_INVALID_PARAMETER

SEE ALSO

m2UdpLib, m2UdpInit( ), m2UdpTblEntryGet( ), m2UdpDelete( )


Libraries : Routines

m2UdpTblEntryGet( )

NAME

m2UdpTblEntryGet( ) - get a UDP MIB-II entry from the UDP list of listeners

SYNOPSIS

STATUS m2UdpTblEntryGet
    (
    int         search,   /* M2_EXACT_VALUE or M2_NEXT_VALUE */
    M2_UDPTBL * pUdpEntry /* ptr to the requested entry with index */
    )

DESCRIPTION

This routine traverses the UDP table of listeners and does an M2_EXACT_VALUE or a M2_NEXT_VALUE search based on the search parameter. The calling routine is responsible for supplying a valid MIB-II entry index in the input structure pUdpEntry. The index is made up of the IP address and the local port number. The first entry in the table is retrieved by doing a M2_NEXT_VALUE search with the index fields set to zero.

RETURNS

OK, or ERROR if the input parameter is not specified or a match is not found.

ERRNO

 S_m2Lib_INVALID_PARAMETER
 S_m2Lib_ENTRY_NOT_FOUND

SEE ALSO

m2UdpLib, m2Lib, m2UdpInit( ), m2UdpGroupInfoGet( ), m2UdpDelete( )


Libraries : Routines

m2UdpDelete( )

NAME

m2UdpDelete( ) - delete all resources used to access the UDP group

SYNOPSIS


STATUS m2UdpDelete (void)

DESCRIPTION

This routine frees all the resources allocated at the time the group was initialized. The UDP group should not be accessed after this routine has been called.

RETURNS

OK, always.

SEE ALSO

m2UdpLib, m2UdpInit( ), m2UdpGroupInfoGet( ), m2UdpTblEntryGet( )