static const char * getName(int index) { #ifndef USING_IF_MIB_IFTABLE_IFTABLE_MODULE oid name[MAX_OID_LEN] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2 }; size_t length = 10; struct variable ifName_variable = { 2, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_ifEntry, 10, {1, 3, 6, 1, 2, 1, 2, 2, 1, 2} }; unsigned char *p; size_t var_len; WriteMethod *write_method; name[length] = index; length++; p = var_ifEntry(&ifName_variable, name, &length, 1 /* exact */ , &var_len, &write_method); if (!p) return NULL; return p; #else return netsnmp_access_interface_name_find(index); #endif }
/** * update underlying data store (kernel) for entry * * @retval 0 : success * @retval -1 : error */ int netsnmp_access_ipaddress_entry_set(netsnmp_ipaddress_entry * entry) { int rc = SNMP_ERR_NOERROR; if (NULL == entry) { netsnmp_assert(NULL != entry); return -1; } /* * make sure interface and ifIndex match up */ if (NULL == netsnmp_access_interface_name_find(entry->if_index)) { DEBUGMSGT(("access:ipaddress:set", "cant find name for index %" NETSNMP_PRIo "d\n", entry->if_index)); return -1; } /* * don't support non-volatile yet */ if (STORAGETYPE_VOLATILE != entry->ia_storagetype) { DEBUGMSGT(("access:ipaddress:set", "non-volatile storagetypes unsupported\n")); return -1; } /* * */ rc = -1; if (entry->flags & NETSNMP_ACCESS_IPADDRESS_CREATE) { rc = netsnmp_arch_ipaddress_create(entry); } else if (entry->flags & NETSNMP_ACCESS_IPADDRESS_CHANGE) { } else if (entry->flags & NETSNMP_ACCESS_IPADDRESS_DELETE) { rc = netsnmp_arch_ipaddress_delete(entry); } else { snmp_log(LOG_ERR,"netsnmp_access_ipaddress_entry_set with no mode\n"); netsnmp_assert(!"ipaddress_entry_set == unknown mode"); /* always false */ rc = -1; } return rc; }