1304 lines
43 KiB
C
1304 lines
43 KiB
C
/*
|
|
******************************************************************************
|
|
* INTERPEAK SOURCE FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: iplite_if_mib.c,v $ $Revision: 1.17 $
|
|
* $Source: /home/interpeak/CVSRoot/iplite2/src/iplite_if_mib.c,v $
|
|
* $Author: kenneth $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Markus Carlstedt <markus@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* IF-MIB
|
|
*===========================================================================
|
|
*
|
|
* Autogenerated by 'ipmibc' with 'smidump 0.4.1' on 2003-11-25 at 17:40:00
|
|
*
|
|
* This file includes initialization code and stubs for MIB variables defined
|
|
* in IF-MIB. Without any changes it should compile and run with the
|
|
* behaviour that GetRequests succeed with the returned value being
|
|
* zero. SetRequests also succeed but without any actual variables
|
|
* being updated.
|
|
*
|
|
* Modifications to this file are necessary in order to enable read and
|
|
* write operations on actual variables presented in the MIB interface.
|
|
* Each segment in the code where a change is proposed is marked with a
|
|
* 'MIB_TODO' comment together with a pseudo code example describing the
|
|
* modification.
|
|
*
|
|
* This file shall normally be compiled together with the product to which
|
|
* SNMP support is to be added and then linked with the IPSNMP libraries.
|
|
* The MIB is initialized by calling the public initialization function defined
|
|
* at the end of this file. Since no header files are generated its function
|
|
* prototype should be copied into the the product that initializes the MIB.
|
|
*
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifndef IPCOM_KERNEL
|
|
#define IPCOM_KERNEL
|
|
#endif
|
|
#include "iplite_config.h"
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#define IPCOM_USE_CLIB_PROTO
|
|
#include <ipcom_type.h>
|
|
#include <ipcom_cstyle.h>
|
|
#include <ipcom_clib.h>
|
|
#include <ipcom_syslog.h>
|
|
#include <ipcom_err.h>
|
|
|
|
#ifdef IPSNMP
|
|
#include <ipsnmp_config.h>
|
|
#include <ipsnmp.h>
|
|
#include <iplite_h.h>
|
|
|
|
#if defined(IPCOM_USE_MIB2) && defined(IPCOM_USE_INET)
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifdef IPCOM_SYSLOG_FACILITY
|
|
#undef IPCOM_SYSLOG_FACILITY
|
|
#endif
|
|
#define IPCOM_SYSLOG_FACILITY IPCOM_LOG_IPSNMP
|
|
|
|
#ifdef IPCOM_SYSLOG_PRIORITY
|
|
#undef IPCOM_SYSLOG_PRIORITY
|
|
#endif
|
|
#define IPCOM_SYSLOG_PRIORITY IPCOM_LOG_DEBUG
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 EXTERNAL PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 7 LOCAL PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
IP_PUBLIC Ip_err iplite_if_mib_init(void);
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 8 DATA
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 9 STATIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* iplite_if_mib_lock
|
|
*===========================================================================
|
|
* Description: Protects MIB variables in SNMPv2-MIB from multiple access
|
|
* Parameters: lock - boolean that controls lock or unlock
|
|
* Returns: Nothing
|
|
*
|
|
*/
|
|
IP_STATIC void
|
|
iplite_if_mib_lock(Ip_bool lock)
|
|
{
|
|
if (lock == IP_TRUE)
|
|
{
|
|
IPLITE_CODE_LOCK();
|
|
}
|
|
else
|
|
{
|
|
IPLITE_CODE_UNLOCK();
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* iplite_if_mib_handler_ifNumber
|
|
*===========================================================================
|
|
* Description: MIB handler for ifNumber
|
|
* Parameters: See file 'ipsnmp.h'
|
|
* Returns: IPSNMP_ERROR_XXX
|
|
*
|
|
*/
|
|
IP_STATIC Ip_s32
|
|
iplite_if_mib_handler_ifNumber(Ip_s32 cmd,
|
|
char *id,
|
|
Ipsnmp_varbind *vb,
|
|
Ip_s32 magic,
|
|
struct Ipsnmp_node_object *nodeobj)
|
|
{
|
|
Ip_s32 i, ret = -1;
|
|
Ip_s32 ifNumber = 0;
|
|
char *iid;
|
|
|
|
(void)id;
|
|
(void)vb;
|
|
if (cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT)
|
|
{
|
|
iid = ipsnmp_create_iid_integer(nodeobj->id, 0);
|
|
if (iid == IP_NULL)
|
|
return IPSNMP_ERROR_GENERROR;
|
|
|
|
for (i = 1; i < IPLITE_CONF_MAX_NETIF; i++)
|
|
if (iplite.netifs[i] != IP_NULL)
|
|
ifNumber++;
|
|
|
|
ret = ipsnmp_util_put_integer(magic, iid, ifNumber);
|
|
ipcom_free(iid);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* iplite_if_mib_table_search_ifTable
|
|
*===========================================================================
|
|
* Description: Searches ifTable and ifXTable for a matching entry
|
|
* Parameters: id, buf, best, cmd
|
|
* Returns: Row index of the found entry OR -1 if not found OR -2 for error
|
|
*
|
|
*/
|
|
IP_STATIC Ip_s32
|
|
iplite_if_mib_table_search_ifTable(char *id,
|
|
char *buf,
|
|
char *best,
|
|
Ip_s32 cmd)
|
|
{
|
|
Ip_s32 ifIndex;
|
|
Ip_s32 ifTable_num_entries;
|
|
Ip_s32 i, bestindex = -1;
|
|
|
|
ifTable_num_entries = IPLITE_CONF_MAX_NETIF;
|
|
|
|
for (i = 0; i < ifTable_num_entries; i++)
|
|
{
|
|
Ip_s32 lex, len = 0;
|
|
|
|
buf[0] = '\0';
|
|
|
|
if (iplite.netifs[i] == IP_NULL)
|
|
continue;
|
|
|
|
ifIndex = iplite.netifs[i]->ipcom.ifindex;
|
|
|
|
if (ipcom_snprintf(&buf[len], IPSNMP_CONFIG_MAX_OBJECT_ID-len, "%ld.", ifIndex) < 0)
|
|
return -2;
|
|
len = ipcom_strlen(buf);
|
|
if (len)
|
|
buf[len-1] = '\0';
|
|
|
|
lex = ipsnmp_util_lexcmp_oid(buf, id);
|
|
if (cmd == IPSNMP_MIB_COMMAND_NEXT)
|
|
{
|
|
if (lex > 0)
|
|
{
|
|
if (bestindex == -1 || ipsnmp_util_lexcmp_oid(buf, best) < 0)
|
|
{
|
|
ipcom_strcpy(best, buf);
|
|
bestindex = i;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (lex == 0)
|
|
{
|
|
ipcom_strcpy(best, buf);
|
|
bestindex = i;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return bestindex;
|
|
}
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* iplite_if_mib_handler_ifTable
|
|
*===========================================================================
|
|
* Description: MIB handler for variables in ifTable
|
|
* Parameters: See file 'ipsnmp.h'
|
|
* Returns: IPSNMP_ERROR_XXX
|
|
*
|
|
*/
|
|
IP_STATIC Ip_s32
|
|
iplite_if_mib_handler_ifTable(Ip_s32 cmd,
|
|
char *id,
|
|
Ipsnmp_varbind *vb,
|
|
Ip_s32 magic,
|
|
struct Ipsnmp_node_object *nodeobj)
|
|
{
|
|
Ip_s32 lid, bestindex, ret = -1;
|
|
Ip_s32 ifAdminStatus = 0;
|
|
char *iid;
|
|
char *buf = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID);
|
|
char *best = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID);
|
|
struct Ip_ifreq ifreq;
|
|
|
|
if (buf == IP_NULL || best == IP_NULL)
|
|
{
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
goto exit;
|
|
}
|
|
|
|
lid = ipsnmp_util_last_subid(nodeobj->id);
|
|
ip_assert(lid >= 1 && lid <= 20);
|
|
ip_assert(lid != 12 && lid != 18);
|
|
bestindex = iplite_if_mib_table_search_ifTable(id, buf, best, cmd);
|
|
if (bestindex == -2)
|
|
{
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
goto exit;
|
|
}
|
|
else if (bestindex == -1)
|
|
{
|
|
ret = IPSNMP_ERROR_NOSUCHNAME;
|
|
goto exit;
|
|
}
|
|
|
|
if (cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT)
|
|
{
|
|
iid = ipsnmp_create_iid_direct(nodeobj->id, best);
|
|
if (iid == IP_NULL)
|
|
{
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
goto exit;
|
|
}
|
|
|
|
switch(lid)
|
|
{
|
|
case 1: /* ifIndex */
|
|
ret = ipsnmp_util_put_integer(magic, iid, iplite.netifs[bestindex]->ipcom.ifindex);
|
|
break;
|
|
case 2: /* ifDescr */
|
|
ret = ipsnmp_util_put_octetstring(magic, iid, (Ip_u8 *)iplite.netifs[bestindex]->ipcom.name, ipcom_strlen(iplite.netifs[bestindex]->ipcom.name));
|
|
break;
|
|
case 3: /* ifType */
|
|
ret = ipsnmp_util_put_integer(magic, iid, iplite.netifs[bestindex]->ipcom.type);
|
|
break;
|
|
case 4: /* ifMtu */
|
|
ret = ipsnmp_util_put_integer(magic, iid, iplite.netifs[bestindex]->ipcom.mtu);
|
|
break;
|
|
case 5: /* ifSpeed */
|
|
if (iplite.netifs[bestindex]->ipcom.type == IP_IFT_PPP)
|
|
ret = ipsnmp_util_put_gauge32(magic, iid, IPCOM_DRV_PPP_BAUDRATE);
|
|
else
|
|
ret = ipsnmp_util_put_gauge32(magic, iid, 10000000);
|
|
break;
|
|
case 6: /* ifPhysAddr */
|
|
ret = ipsnmp_util_put_octetstring(magic, iid, iplite.netifs[bestindex]->ipcom.link_addr, iplite.netifs[bestindex]->ipcom.link_addr_size);
|
|
break;
|
|
case 7: /* ifAdminStatus */
|
|
if (IP_BIT_ISSET(iplite.netifs[bestindex]->ipcom.flags, IP_IFF_UP))
|
|
ret = ipsnmp_util_put_integer(magic, iid, 1);
|
|
else
|
|
ret = ipsnmp_util_put_integer(magic, iid, 2);
|
|
break;
|
|
case 8: /* ifOperStatus */
|
|
if (IP_BIT_ISSET(iplite.netifs[bestindex]->ipcom.flags, IP_IFF_UP))
|
|
ret = ipsnmp_util_put_integer(magic, iid, 1);
|
|
else
|
|
ret = ipsnmp_util_put_integer(magic, iid, 2);
|
|
break;
|
|
case 9: /* ifLastChange */
|
|
ret = ipsnmp_util_put_timeticks(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifLastChange);
|
|
break;
|
|
case 10: /* ifInOctets */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifInOctets);
|
|
break;
|
|
case 11: /* ifInUcastPkts */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifInUcastPkts);
|
|
break;
|
|
case 13: /* ifInDiscards */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifInDiscards);
|
|
break;
|
|
case 14: /* ifInErrors */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifInErrors);
|
|
break;
|
|
case 15: /* ifInUnknownProtos */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifInUnknownProtos);
|
|
break;
|
|
case 16: /* ifOutOctets */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifOutOctets);
|
|
break;
|
|
case 17: /* ifOutUcastPkts */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifOutUcastPkts);
|
|
break;
|
|
case 19: /* ifOutDiscards */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifOutDiscards);
|
|
break;
|
|
case 20: /* ifOutErrors */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifOutErrors);
|
|
break;
|
|
default:
|
|
IP_PANIC();
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
break;
|
|
}
|
|
|
|
ipcom_free(iid);
|
|
}
|
|
|
|
if (cmd == IPSNMP_MIB_COMMAND_TEST || cmd == IPSNMP_MIB_COMMAND_SET)
|
|
{
|
|
switch(lid)
|
|
{
|
|
case 7: /* ifAdminStatus */
|
|
ret = ipsnmp_util_get_integer(vb, &ifAdminStatus);
|
|
if (ret == IPSNMP_ERROR_NOERROR)
|
|
{
|
|
if (ifAdminStatus != 1 && ifAdminStatus != 2)
|
|
{
|
|
ret = IPSNMP_ERROR_WRONGVALUE;
|
|
}
|
|
}
|
|
|
|
if (ret == IPSNMP_ERROR_NOERROR && cmd == IPSNMP_MIB_COMMAND_SET)
|
|
{
|
|
/* Change interface status */
|
|
ipcom_memset(&ifreq, 0, sizeof(struct Ip_ifreq));
|
|
ipcom_strcpy(ifreq.ifr_name, iplite.netifs[bestindex]->ipcom.name);
|
|
if (iplite_socketioctl_islocked(IP_INVALID_SOCKET, IP_SIOCGIFFLAGS, &ifreq) < 0)
|
|
{
|
|
IPCOM_LOG1(ERR, "Failed to get interface flags: %s", ipcom_strerror(ipcom_errno));
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
}
|
|
if (ifAdminStatus == 1)
|
|
IP_BIT_SET(ifreq.ip_ifr_flags, IP_IFF_UP);
|
|
else
|
|
IP_BIT_CLR(ifreq.ip_ifr_flags, IP_IFF_UP);
|
|
if (iplite_socketioctl_islocked(IP_INVALID_SOCKET, IP_SIOCSIFFLAGS, &ifreq) < 0)
|
|
{
|
|
IPCOM_LOG1(ERR, "Failed to set interface flags: %s", ipcom_strerror(ipcom_errno));
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
IP_PANIC();
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
break;
|
|
}
|
|
}
|
|
|
|
exit:
|
|
if (buf != IP_NULL)
|
|
ipcom_free(buf);
|
|
if (best != IP_NULL)
|
|
ipcom_free(best);
|
|
return ret;
|
|
}
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* iplite_if_mib_handler_ifXTable
|
|
*===========================================================================
|
|
* Description: MIB handler for variables in ifXTable
|
|
* Parameters: See file 'ipsnmp.h'
|
|
* Returns: IPSNMP_ERROR_XXX
|
|
*
|
|
*/
|
|
IP_STATIC Ip_s32
|
|
iplite_if_mib_handler_ifXTable(Ip_s32 cmd,
|
|
char *id,
|
|
Ipsnmp_varbind *vb,
|
|
Ip_s32 magic,
|
|
struct Ipsnmp_node_object *nodeobj)
|
|
{
|
|
Ip_s32 lid, bestindex, ret = -1;
|
|
Ip_s32 ifLinkUpDownTrapEnable = 0;
|
|
char *iid;
|
|
char *buf = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID);
|
|
char *best = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID);
|
|
|
|
if (buf == IP_NULL || best == IP_NULL)
|
|
{
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
goto exit;
|
|
}
|
|
|
|
lid = ipsnmp_util_last_subid(nodeobj->id);
|
|
ip_assert((lid >= 1 && lid <= 5) || (lid >= 14 && lid <= 19));
|
|
bestindex = iplite_if_mib_table_search_ifTable(id, buf, best, cmd);
|
|
if (bestindex == -2)
|
|
{
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
goto exit;
|
|
}
|
|
else if (bestindex == -1)
|
|
{
|
|
ret = IPSNMP_ERROR_NOSUCHNAME;
|
|
goto exit;
|
|
}
|
|
|
|
if (cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT)
|
|
{
|
|
iid = ipsnmp_create_iid_direct(nodeobj->id, best);
|
|
if (iid == IP_NULL)
|
|
{
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
goto exit;
|
|
}
|
|
|
|
switch(lid)
|
|
{
|
|
case 1: /* ifName */
|
|
ret = ipsnmp_util_put_octetstring(magic, iid, (Ip_u8 *)iplite.netifs[bestindex]->ipcom.name, ipcom_strlen(iplite.netifs[bestindex]->ipcom.name));
|
|
break;
|
|
case 2: /* ifInMulticastPkts */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifInMulticastPkts);
|
|
break;
|
|
case 3: /* ifInBroadcastPkts */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifInBroadcastPkts);
|
|
break;
|
|
case 4: /* ifOutMulticastPkts */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifOutMulticastPkts);
|
|
break;
|
|
case 5: /* ifOutBroadcastPkts */
|
|
ret = ipsnmp_util_put_counter32(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifOutBroadcastPkts);
|
|
break;
|
|
case 14: /* ifLinkUpDownTrapEnable */
|
|
if (iplite.netifs[bestindex]->ipcom.mib2.ifLinkUpDownTrapEnable == 0)
|
|
iplite.netifs[bestindex]->ipcom.mib2.ifLinkUpDownTrapEnable = 1;
|
|
ret = ipsnmp_util_put_integer(magic, iid, iplite.netifs[bestindex]->ipcom.mib2.ifLinkUpDownTrapEnable);
|
|
break;
|
|
case 15: /* ifHighSpeed */
|
|
if (iplite.netifs[bestindex]->ipcom.type == IP_IFT_PPP)
|
|
ret = ipsnmp_util_put_gauge32(magic, iid, 0);
|
|
else
|
|
ret = ipsnmp_util_put_gauge32(magic, iid, 10);
|
|
break;
|
|
case 16: /* ifPromiscuousMode */
|
|
if (IP_BIT_ISSET(iplite.netifs[bestindex]->ipcom.flags, IP_IFF_PROMISC))
|
|
ret = ipsnmp_util_put_integer(magic, iid, 1);
|
|
else
|
|
ret = ipsnmp_util_put_integer(magic, iid, 2);
|
|
break;
|
|
case 17: /* ifConnectorPresent */
|
|
ret = ipsnmp_util_put_integer(magic, iid, 2);
|
|
break;
|
|
case 18: /* ifAlias */
|
|
ret = ipsnmp_util_put_octetstring(magic, iid, IP_NULL, 0);
|
|
break;
|
|
case 19: /* ifCounterDiscontinuityTime */
|
|
ret = ipsnmp_util_put_timeticks(magic, iid, 0);
|
|
break;
|
|
default:
|
|
IP_PANIC();
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
break;
|
|
}
|
|
|
|
ipcom_free(iid);
|
|
}
|
|
|
|
if (cmd == IPSNMP_MIB_COMMAND_TEST || cmd == IPSNMP_MIB_COMMAND_SET)
|
|
{
|
|
switch(lid)
|
|
{
|
|
case 14: /* ifLinkUpDownTrapEnable */
|
|
ret = ipsnmp_util_get_integer(vb, &ifLinkUpDownTrapEnable);
|
|
if (ret == IPSNMP_ERROR_NOERROR)
|
|
{
|
|
if (ifLinkUpDownTrapEnable != 1 && ifLinkUpDownTrapEnable != 2)
|
|
{
|
|
ret = IPSNMP_ERROR_WRONGVALUE;
|
|
}
|
|
}
|
|
|
|
if (ret == IPSNMP_ERROR_NOERROR && cmd == IPSNMP_MIB_COMMAND_SET)
|
|
{
|
|
iplite.netifs[bestindex]->ipcom.mib2.ifLinkUpDownTrapEnable = ifLinkUpDownTrapEnable;
|
|
}
|
|
break;
|
|
case 16: /* ifPromiscuousMode */
|
|
case 18: /* ifAlias */
|
|
ret = IPSNMP_ERROR_NOSUCHNAME;
|
|
break;
|
|
default:
|
|
IP_PANIC();
|
|
ret = IPSNMP_ERROR_GENERROR;
|
|
break;
|
|
}
|
|
}
|
|
|
|
exit:
|
|
if (buf != IP_NULL)
|
|
ipcom_free(buf);
|
|
if (best != IP_NULL)
|
|
ipcom_free(best);
|
|
return ret;
|
|
}
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 10 GLOBAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 11 PUBLIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* iplite_if_mib_init
|
|
*===========================================================================
|
|
* Description: Initializes IF-MIB
|
|
* Parameters: None
|
|
* Returns: IPCOM_SUCCESS or IPCOM_ERR_FAILED
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err
|
|
iplite_if_mib_init(void)
|
|
{
|
|
struct Ipsnmp_node_object nodeobj;
|
|
Ip_s32 ret;
|
|
|
|
/* Assign lock function */
|
|
nodeobj.lock = iplite_if_mib_lock;
|
|
|
|
/* Add node "ifMIB" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.2.1.31";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifMIB";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_OTHER;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "interfaces" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.2.1.2";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "interfaces";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_OTHER;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifMIBObjects" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifMIBObjects";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_OTHER;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifNumber" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifNumber;
|
|
nodeobj.id = "1.3.6.1.2.1.2.1";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifNumber";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_SCALAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifTable" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifTable";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_AGGREGATE;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifEntry" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifEntry";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_AGGREGATE;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifIndex" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.1";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifIndex";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifDescr" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_OCTETSTRING;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.2";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifDescr";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifType" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.3";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifType";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifMtu" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.4";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifMtu";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifSpeed" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_GAUGE32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.5";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifSpeed";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifPhysAddress" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_OCTETSTRING;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.6";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifPhysAddress";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifAdminStatus" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READWRITE;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.7";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifAdminStatus";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifOperStatus" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.8";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifOperStatus";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifLastChange" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_TIMETICKS;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.9";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifLastChange";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifInOctets" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.10";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifInOctets";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifInUcastPkts" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.11";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifInUcastPkts";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifInDiscards" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.13";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifInDiscards";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifInErrors" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.14";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifInErrors";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifInUnknownProtos" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.15";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifInUnknownProtos";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifOutOctets" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.16";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifOutOctets";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifOutUcastPkts" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.17";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifOutUcastPkts";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifOutDiscards" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.19";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifOutDiscards";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifOutErrors" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifTable;
|
|
nodeobj.id = "1.3.6.1.2.1.2.2.1.20";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifOutErrors";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifXTable" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifXTable";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_AGGREGATE;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifXEntry" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifXEntry";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_AGGREGATE;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifName" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_OCTETSTRING;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.1";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifName";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifInMulticastPkts" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.2";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifInMulticastPkts";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifInBroadcastPkts" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.3";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifInBroadcastPkts";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifOutMulticastPkts" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.4";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifOutMulticastPkts";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifOutBroadcastPkts" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_COUNTER32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.5";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifOutBroadcastPkts";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifLinkUpDownTrapEnable" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READWRITE;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.14";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifLinkUpDownTrapEnable";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifHighSpeed" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_GAUGE32;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.15";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifHighSpeed";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifPromiscuousMode" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READWRITE;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.16";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifPromiscuousMode";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifConnectorPresent" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_INTEGER;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.17";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifConnectorPresent";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifAlias" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READWRITE;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_OCTETSTRING;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.18";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifAlias";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifCounterDiscontinuityTime" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_TIMETICKS;
|
|
nodeobj.handler = iplite_if_mib_handler_ifXTable;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.1.1.19";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifCounterDiscontinuityTime";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_COLUMNAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "ifTableLastChange" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_READONLY;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_TIMETICKS;
|
|
nodeobj.handler = ipsnmp_mib_standard_handler;
|
|
nodeobj.id = "1.3.6.1.2.1.31.1.5";
|
|
nodeobj.instance = &(&iplite)->mib2.ifTableLastChange;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "ifTableLastChange";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_SCALAR;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "linkDown" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.6.3.1.1.5.3";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "linkDown";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_TRAP;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
/* Add node "linkUp" to the MIB tree */
|
|
nodeobj.access = IPSNMP_NODE_ACCESS_NOACCESS;
|
|
nodeobj.datatype = IPSNMP_DATA_TYPE_UNSPECIFIED;
|
|
nodeobj.handler = IP_NULL;
|
|
nodeobj.id = "1.3.6.1.6.3.1.1.5.4";
|
|
nodeobj.instance = IP_NULL;
|
|
#ifdef IP_DEBUG
|
|
nodeobj.name = "linkUp";
|
|
#endif
|
|
nodeobj.nodetype = IPSNMP_NODE_TYPE_TRAP;
|
|
ret = ipsnmp_add_node(&nodeobj);
|
|
if (ret != 0)
|
|
{
|
|
IPCOM_LOG2(ERR, "ipsnmp_add_node() :: failed to add %s (%d)", nodeobj.id, ret);
|
|
return IPCOM_ERR_FAILED;
|
|
}
|
|
|
|
return IPCOM_SUCCESS;
|
|
}
|
|
|
|
#endif /* #if defined(IPCOM_USE_MIB2) && defined(IPCOM_USE_INET) */
|
|
#endif /* #ifdef IPSNMP */
|
|
|
|
#if !defined(IPSNMP) || !defined(IPCOM_USE_MIB2)
|
|
void iplite_if_mib_empty_file(void);
|
|
void iplite_if_mib_empty_file(void) { }
|
|
#endif
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|
|
|