VxWorks Reference Manual : Libraries
m2UdpLib - MIB-II UDP-group API for SNMP agents
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
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.
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 */
m2Lib.h
m2UdpLib, m2Lib, m2IfLib, m2IpLib, m2IcmpLib, m2TcpLib, m2SysLib
m2UdpInit( ) - initialize MIB-II UDP-group access
STATUS m2UdpInit (void)
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.
OK, always.
m2UdpLib, m2UdpGroupInfoGet( ), m2UdpTblEntryGet( ), m2UdpDelete( )
m2UdpGroupInfoGet( ) - get MIB-II UDP-group scalar variables
STATUS m2UdpGroupInfoGet ( M2_UDP * pUdpInfo /* pointer to the UDP group structure */ )
This routine fills in the UDP structure at pUdpInfo with the MIB-II UDP scalar variables.
OK, or ERROR if pUdpInfo is not a valid pointer.
S_m2Lib_INVALID_PARAMETER
m2UdpLib, m2UdpInit( ), m2UdpTblEntryGet( ), m2UdpDelete( )
m2UdpTblEntryGet( ) - get a UDP MIB-II entry from the UDP list of listeners
STATUS m2UdpTblEntryGet ( int search, /* M2_EXACT_VALUE or M2_NEXT_VALUE */ M2_UDPTBL * pUdpEntry /* ptr to the requested entry with index */ )
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.
OK, or ERROR if the input parameter is not specified or a match is not found.
S_m2Lib_INVALID_PARAMETER
S_m2Lib_ENTRY_NOT_FOUND
m2UdpLib, m2Lib, m2UdpInit( ), m2UdpGroupInfoGet( ), m2UdpDelete( )
m2UdpDelete( ) - delete all resources used to access the UDP group
STATUS m2UdpDelete (void)
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.
OK, always.
m2UdpLib, m2UdpInit( ), m2UdpGroupInfoGet( ), m2UdpTblEntryGet( )