/** * Creates and registers a table iterator helper handler calling * netsnmp_create_handler with a handler name set to TABLE_ITERATOR_NAME * and access method, netsnmp_table_iterator_helper_handler. * * If NOT_SERIALIZED is not defined the function injects the serialize * handler into the calling chain prior to calling netsnmp_register_table. * * @param reginfo is a pointer to a netsnmp_handler_registration struct * * @param iinfo A pointer to a netsnmp_iterator_info struct. If the flag * NETSNMP_HANDLER_OWNS_IINFO is not set in iinfo->flags, the caller remains * the owner of this structure. And if the flag NETSNMP_HANDLER_OWNS_IINFO is * set in iinfo->flags, ownership of this data structure is passed to the * handler. * * @return MIB_REGISTERED_OK is returned if the registration was a success. * Failures are MIB_REGISTRATION_FAILED, MIB_DUPLICATE_REGISTRATION. * If iinfo is NULL, SNMPERR_GENERR is returned. * */ int netsnmp_register_table_iterator (netsnmp_handler_registration * reginfo, netsnmp_iterator_info * iinfo) { #ifndef NETSNMP_FEATURE_REMOVE_STASH_CACHE reginfo->modes |= HANDLER_CAN_STASH; #endif /* NETSNMP_FEATURE_REMOVE_STASH_CACHE */ netsnmp_inject_handler (reginfo, netsnmp_get_table_iterator_handler (iinfo)); if (!iinfo) return SNMPERR_GENERR; if (!iinfo->indexes && iinfo->table_reginfo && iinfo->table_reginfo->indexes) iinfo->indexes = snmp_clone_varbind (iinfo->table_reginfo->indexes); return netsnmp_register_table (reginfo, iinfo->table_reginfo); }
/** registers a table after attaching it to a table_iterator helper */ int netsnmp_register_table_iterator(netsnmp_handler_registration *reginfo, netsnmp_iterator_info *iinfo) { netsnmp_inject_handler(reginfo, netsnmp_get_table_iterator_handler(iinfo)); if (!iinfo) return SNMPERR_GENERR; #ifndef NOT_SERIALIZED netsnmp_inject_handler(reginfo, netsnmp_get_serialize_handler()); #endif return netsnmp_register_table(reginfo, iinfo->table_reginfo); }
/** * Creates and registers a table iterator helper handler calling * netsnmp_create_handler with a handler name set to TABLE_ITERATOR_NAME * and access method, netsnmp_table_iterator_helper_handler. * * If NOT_SERIALIZED is not defined the function injects the serialize * handler into the calling chain prior to calling netsnmp_register_table. * * @param reginfo is a pointer to a netsnmp_handler_registration struct * * @param iinfo is a pointer to a netsnmp_iterator_info struct * * @return MIB_REGISTERED_OK is returned if the registration was a success. * Failures are MIB_REGISTRATION_FAILED, MIB_DUPLICATE_REGISTRATION. * If iinfo is NULL, SNMPERR_GENERR is returned. * */ int netsnmp_register_table_iterator(netsnmp_handler_registration *reginfo, netsnmp_iterator_info *iinfo) { reginfo->modes |= HANDLER_CAN_STASH; netsnmp_inject_handler(reginfo, netsnmp_get_table_iterator_handler(iinfo)); if (!iinfo) return SNMPERR_GENERR; if (!iinfo->indexes && iinfo->table_reginfo && iinfo->table_reginfo->indexes ) iinfo->indexes = snmp_clone_varbind( iinfo->table_reginfo->indexes ); return netsnmp_register_table(reginfo, iinfo->table_reginfo); }