/** * the *_extract_index routine * * This routine is called when a set request is received for an index * that was not found in the table container. Here, we parse the oid * in the the individual index components and copy those indexes to the * context. Then we make sure the indexes for the new row are valid. */ int saHpiCtrlAnalogTable_extract_index( saHpiCtrlAnalogTable_context * ctx, netsnmp_index * hdr ) { /* * temporary local storage for extracting oid index * * extract index uses varbinds (netsnmp_variable_list) to parse * the index OID into the individual components for each index part. */ /** TODO: add storage for external index(s)! */ netsnmp_variable_list var_saHpiDomainId; netsnmp_variable_list var_saHpiResourceId; netsnmp_variable_list var_saHpiResourceIsHistorical; netsnmp_variable_list var_saHpiCtrlAnalogEntryId; int err; DEBUGMSGTL ((AGENT, "saHpiCtrlAnalogTable_extract_index, called\n")); subagent_lock(&hpi_lock_data); /* * copy index, if provided */ if (hdr) { netsnmp_assert(ctx->index.oids == NULL); if (snmp_clone_mem( (void*)&ctx->index.oids, hdr->oids, hdr->len * sizeof(oid) )) { subagent_unlock(&hpi_lock_data); return -1; } ctx->index.len = hdr->len; } /* * initialize variable that will hold each component of the index. * If there are multiple indexes for the table, the variable_lists * need to be linked together, in order. */ /** TODO: add code for external index(s)! */ memset( &var_saHpiDomainId, 0x00, sizeof(var_saHpiDomainId) ); var_saHpiDomainId.type = ASN_UNSIGNED; /* type hint for parse_oid_indexes */ /** TODO: link this index to the next, or NULL for the last one */ var_saHpiDomainId.next_variable = &var_saHpiResourceId; memset( &var_saHpiResourceId, 0x00, sizeof(var_saHpiResourceId) ); var_saHpiResourceId.type = ASN_UNSIGNED; /* type hint for parse_oid_indexes */ /** TODO: link this index to the next, or NULL for the last one */ var_saHpiResourceId.next_variable = &var_saHpiResourceIsHistorical; memset( &var_saHpiResourceIsHistorical, 0x00, sizeof(var_saHpiResourceIsHistorical) ); var_saHpiResourceIsHistorical.type = ASN_INTEGER; /* type hint for parse_oid_indexes */ /** TODO: link this index to the next, or NULL for the last one */ var_saHpiResourceIsHistorical.next_variable = &var_saHpiCtrlAnalogEntryId; memset( &var_saHpiCtrlAnalogEntryId, 0x00, sizeof(var_saHpiCtrlAnalogEntryId) ); var_saHpiCtrlAnalogEntryId.type = ASN_UNSIGNED; /* type hint for parse_oid_indexes */ /** TODO: link this index to the next, or NULL for the last one */ var_saHpiCtrlAnalogEntryId.next_variable = NULL; /* * parse the oid into the individual index components */ err = parse_oid_indexes( hdr->oids, hdr->len, &var_saHpiDomainId ); if (err == SNMP_ERR_NOERROR) { /* * copy index components into the context structure */ /** skipping external index saHpiDomainId */ /** skipping external index saHpiResourceId */ /** skipping external index saHpiResourceIsHistorical */ ctx->saHpiCtrlAnalogEntryId = *var_saHpiCtrlAnalogEntryId.val.integer; err = saHpiDomainId_check_index( *var_saHpiDomainId.val.integer); err = saHpiResourceEntryId_check_index( *var_saHpiResourceId.val.integer); err = saHpiResourceIsHistorical_check_index( *var_saHpiResourceIsHistorical.val.integer); err = saHpiCtrlAnalogEntryId_check_index( *var_saHpiCtrlAnalogEntryId.val.integer); } /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers( &var_saHpiDomainId ); subagent_unlock(&hpi_lock_data); return err; }