/** * @internal * set row context indexes * * @param reqreq_ctx the row context that needs updated indexes * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR : other error. * * @remark * This function sets the mib indexs, then updates the oid indexs * from the mib index. */ int tcpListenerTable_indexes_set(tcpListenerTable_rowreq_ctx * rowreq_ctx, u_long tcpListenerLocalAddressType_val, char *tcpListenerLocalAddress_val_ptr, size_t tcpListenerLocalAddress_val_ptr_len, u_long tcpListenerLocalPort_val) { DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_indexes_set", "called\n")); if (MFD_SUCCESS != tcpListenerTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, tcpListenerLocalAddressType_val, tcpListenerLocalAddress_val_ptr, tcpListenerLocalAddress_val_ptr_len, tcpListenerLocalPort_val)) return MFD_ERROR; /* * convert mib index to oid index */ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); if (0 != tcpListenerTable_index_to_oid(&rowreq_ctx->oid_idx, &rowreq_ctx->tbl_idx)) { return MFD_ERROR; } return MFD_SUCCESS; } /* tcpListenerTable_indexes_set */
tcpListenerTable_rowreq_ctx * tcpListenerTable_row_find_by_mib_index(tcpListenerTable_mib_index * mib_idx) { tcpListenerTable_rowreq_ctx *rowreq_ctx; oid oid_tmp[MAX_OID_LEN]; netsnmp_index oid_idx; int rc; /* * set up storage for OID */ oid_idx.oids = oid_tmp; oid_idx.len = sizeof(oid_tmp) / sizeof(oid); /* * convert */ rc = tcpListenerTable_index_to_oid(&oid_idx, mib_idx); if (MFD_SUCCESS != rc) return NULL; rowreq_ctx = CONTAINER_FIND(tcpListenerTable_if_ctx.container, &oid_idx); return rowreq_ctx; }