/** * oh_add_rdr: Add an RDR to a RPT entry's RDR repository. * If an RDR is found with the same record id as the one being added, the RDR being * added will overlay the existing one. Also, a unique record id will be assigned * to it based on the RDR type and its type's numeric id. * @table: Pointer to RPT table containig the RPT entry to which the RDR will belong. * @rid: Id of the RPT entry that will own the RDR to be added. * @rdr: RDR to be added to an RPT entry's RDR repository. * @data: Pointer to private data belonging to the RDR that is being added. * * All rdr interface funtions, except oh_add_rdr will act in the context of * the first RPT entry in the table, if rid is RPT_ENTRY_BEGIN (0xffffffff). * * Return value: * 0 - Successful addition of RDR. * -2 - Failure. RPT entry for that rid was not found. * -3 - Failure. RDR entity path is different from parent RPT entry. * -4* - Failure. RDR type number has not been assigned. *COMMENTED OUT * -5 - Failure. Could not allocate enough memory to position the new RDR in the RDR * repository. **/ int oh_add_rdr(RPTable *table, SaHpiResourceIdT rid, SaHpiRdrT *rdr, void *data) { RPTEntry *rptentry; RDRecord *rdrecord; SaHpiUint8T type_num; const guint EP_STR_SIZE = 255; char parent_ep[EP_STR_SIZE]; char child_ep[EP_STR_SIZE]; rptentry = get_rptentry_by_rid(table, rid); if (!rptentry){ dbg("Failed to add RDR. Parent RPT entry was not found in table."); entitypath2string(&(rdr->Entity), child_ep, EP_STR_SIZE); dbg("RID: %d, Child EP: %s", rid, child_ep); return -2; } if (memcmp(&(rptentry->rpt_entry.ResourceEntity), &(rdr->Entity), sizeof(SaHpiEntityPathT))) { entitypath2string(&(rptentry->rpt_entry.ResourceEntity), parent_ep, EP_STR_SIZE); entitypath2string(&(rdr->Entity), child_ep, EP_STR_SIZE); dbg("Failed to add RDR. Entity path is different from parent RPT entry."); dbg("Parent EP: %s, Child EP: %s", parent_ep, child_ep); return -3; } /*if (!(type_num = get_rdr_type_num(rdr))) { dbg("Failed to add RDR. Type's id number (num) has not been assigned."); return -4; }*/ type_num = get_rdr_type_num(rdr); /* Form correct RecordId. */ rdr->RecordId = get_rdr_uid(rdr->RdrType, type_num); /* Check if record exists */ rdrecord = get_rdrecord_by_id(rptentry->rdrtable, rdr->RecordId); /* If not, create new rdr */ if (!rdrecord) { rdrecord = (RDRecord *)g_malloc0(sizeof(RDRecord)); if (!rdrecord) { dbg("Not enough memory to add RDR."); return -5; } /* Put new rdrecord in rdr repository */ rptentry->rdrtable = g_slist_append(rptentry->rdrtable, (gpointer)rdrecord); } /* Else, modify existing rdrecord */ rdrecord->rdr = *rdr; rdrecord->data = data; update_rptable(table, RPT_KEEP_COUNT); return 0; }
/** * print_ep * @ep: Pointer to entity path stucture. * * Print the string form of an entity path structure. * * Returns: 0 on Success, -1 on Failure. **/ int print_ep(const SaHpiEntityPathT *ep) { const int buffer_size = 512; gchar epstr[buffer_size]; int len; memset(epstr,0,buffer_size); if (!ep) { dbg("Error: null pointer \n"); return -1; } len = entitypath2string(ep, epstr, sizeof(epstr)); if (len < 0) return -1; /* Entity path with a sole root element will be an empty string */ printf("Entity Path=\"%s\"\n", epstr); return 0; }
static SaErrorT list_rpt(SaHpiRptEntryT *rptptr,SaHpiResourceIdT resourceid) { SaErrorT rv = SA_OK; SaHpiTextBufferT working; oh_init_textbuffer(&working); if ((resourceid == all_resources) || (resourceid == rptptr->ResourceId)) { /* Always print resource header */ entitypath2string(&rptptr->ResourceEntity, working.Data, SAHPI_MAX_TEXT_BUFFER_LENGTH); printf("\n+%s\n",working.Data); if (!f_listall && !f_rpt) printf(" Tag: %s, ResourceId %d\n\n",rptptr->ResourceTag.Data, rptptr->ResourceId); /* Print details when asked */ if (f_listall || f_rpt) oh_print_rptentry(rptptr, 2); } return(rv); }
int main (int argc, char **argv) { SaHpiEntityPathT ep; gchar *test_string, *expected_string; const int MAX_STRING_SIZE = 512; gchar returned_string[MAX_STRING_SIZE]; int err; test_string = "{217,11}"; expected_string = "{217,11}"; err = string2entitypath(test_string, &ep); if (err) return 1; err = entitypath2string(&ep, returned_string, MAX_STRING_SIZE); if (err < 0) return 1; if (strcmp(returned_string, expected_string)) return 1; return 0; }
int main (int argc, char **argv) { SaHpiEntityPathT ep; gchar *test_string, *expected_string; const int MAX_STRING_SIZE = 512; gchar returned_string[MAX_STRING_SIZE]; int err; // check if we can convert the last entry of the list test_string = "{SUBBOARD_CARRIER_BLADE,12}"; expected_string = "{SUBBOARD_CARRIER_BLADE,12}"; err = string2entitypath(test_string, &ep); if (err) return 1; err = entitypath2string(&ep, returned_string, MAX_STRING_SIZE); if (err < 0) return 1; if (strcmp(returned_string, expected_string)) return 1; return 0; }
SaErrorT discover_domain(SaHpiDomainIdT domain_id, SaHpiSessionIdT session_id, SaHpiRptEntryT entry) { SaErrorT err; SaHpiRptInfoT rpt_info_before; SaHpiRptInfoT rpt_info_after; SaHpiEntryIdT current; SaHpiEntryIdT next; err = saHpiResourcesDiscover(session_id); if (SA_OK != err) { error("saHpiResourcesDiscover", err); return err; } warn("list_resources: discover done"); /* grab copy of the update counter before traversing RPT */ err = saHpiRptInfoGet(session_id, &rpt_info_before); if (SA_OK != err) { error("saHpiRptInfoGet", err); return err; } warn("Scanning RPT..."); next = SAHPI_FIRST_ENTRY; do { char tmp_epath[128]; current = next; err = saHpiRptEntryGet(session_id, current, &next, &entry); if (SA_OK != err) { if (current != SAHPI_FIRST_ENTRY) { error("saHpiRptEntryGet", err); return err; } else { warn("Empty RPT\n"); break; } } printf("***Records:\n"); printf("%s\n", (char *)entry.ResourceTag.Data); printf("Entry ID: %d\n", (int) entry.EntryId); printf("Resource ID: %d\n", (int) entry.ResourceId); printf("Domain ID: %d\n", (int) entry.DomainId); printf("Revision: %c\n", entry.ResourceInfo.ResourceRev); printf("Version: %c\n", entry.ResourceInfo.SpecificVer); printf("Device Support: %d\n", entry.ResourceInfo.DeviceSupport); printf("Manufacturer ID: %d\n", (int) entry.ResourceInfo.ManufacturerId); printf("Product ID: %d\n", (int) entry.ResourceInfo.ProductId); printf("Firmware Major, Minor, Aux: %d %d %d\n", entry.ResourceInfo.FirmwareMajorRev, entry.ResourceInfo.FirmwareMinorRev, entry.ResourceInfo.AuxFirmwareRev); printf("Severity: %s\n",severity2str(entry.ResourceSeverity)); rpt_cap2str(entry.ResourceCapabilities); printf("Entity Path:\n"); entitypath2string(&entry.ResourceEntity, tmp_epath, sizeof(tmp_epath)); printf("\t%s\n", tmp_epath); printf("\tResourceTag: "); display_textbuffer(entry.ResourceTag); if (entry.ResourceCapabilities & SAHPI_CAPABILITY_RDR) list_rdr(session_id, entry.ResourceId); if (entry.ResourceCapabilities & SAHPI_CAPABILITY_SEL) list_sel(session_id, entry.ResourceId); #if 0 /* if the resource is also a domain, then * traverse its RPT */ if (entry.ResourceCapabilities & SAHPI_CAPABILITY_DOMAIN) { err = discover_domain(entry.DomainId); if (SA_OK != err) return err; } #endif printf("\tEntryId: %d\n", next); } while (next != SAHPI_LAST_ENTRY); printf("SAHPI_LAST_ENTRY\n"); /* wait for update in RPT */ while (1) { err = saHpiRptInfoGet(session_id, &rpt_info_after); if (SA_OK != err) { error("saHpiRptInfoGet", err); return err; } if (rpt_info_before.UpdateCount != rpt_info_after.UpdateCount) { rpt_info_before = rpt_info_after; } else break; }; return SA_OK; }
void list_sel(SaHpiSessionIdT session_id, SaHpiResourceIdT resource_id) { char str[256]; printf("SEL Info:\n"); SaHpiSelInfoT info; SaErrorT rv = saHpiEventLogInfoGet(session_id, resource_id, &info); if (rv != SA_OK) { printf( "Error=%d reading SEL info\n", rv); return; } printf("\tEntries in SEL: %d\n", info.Entries); printf("\tSize: %d\n", info.Size); time2str(info.UpdateTimestamp, str); printf("\tUpdateTimestamp: %s\n", str); time2str(info.CurrentTime, str); printf("\tCurrentTime : %s\n", str); printf("\tEnabled: %s\n", info.Enabled ? "true" : "false"); printf("\tOverflowFlag: %s\n", info.OverflowFlag ? "true" : "false"); printf("\tOverflowAction: " ); switch(info.OverflowAction) { case SAHPI_SEL_OVERFLOW_DROP: printf("SAHPI_SEL_OVERFLOW_DROP\n"); break; case SAHPI_SEL_OVERFLOW_WRAP: printf("SAHPI_SEL_OVERFLOW_WRAP\n"); break; case SAHPI_SEL_OVERFLOW_WRITELAST: printf("SAHPI_SEL_OVERFLOW_WRITELAST\n"); break; default: printf("unknown(0x%x)\n", info.OverflowAction); break; } printf("\tDeleteEntrySupported: %s\n", info.DeleteEntrySupported ? "true" : "false" ); if (info.Entries == 0) return; //else // read sel records SaHpiSelEntryIdT current = SAHPI_OLDEST_ENTRY; do { SaHpiSelEntryIdT prev; SaHpiSelEntryIdT next; SaHpiSelEntryT entry; SaHpiRdrT rdr; SaHpiRptEntryT res; rv = saHpiEventLogEntryGet(session_id, resource_id, current, &prev, &next, &entry, &rdr, &res); if (rv != SA_OK) { printf( "Error=%d reading SEL entry %d\n", rv, current); return; } printf("\t\tEntry %d, prev %d, next %d\n", entry.EntryId, prev, next); time2str(entry.Timestamp, str); printf("\t\t\tTimestamp: %s\n", str); SaHpiRptEntryT rres; rv = saHpiRptEntryGetByResourceId(session_id, entry.Event.Source, &rres ); if ( rv != SA_OK ) printf("\t\t\tSource: unknown\n" ); else { entitypath2string( &rres.ResourceEntity, str, sizeof(str)); printf("\t\t\tSource: %s\n", str ); } printf("\t\t\tEventType: %s\n", eventtype2str(entry.Event.EventType)); time2str(entry.Timestamp, str); printf("\t\t\tEvent timestamp: %s\n", str); printf("\t\t\tSeverity: %s\n", severity2str( entry.Event.Severity ) ); switch(entry.Event.EventType) { case SAHPI_ET_SENSOR: { SaHpiSensorEventT *se = &entry.Event.EventDataUnion.SensorEvent; printf("\t\t\tSensorNum: %d\n", se->SensorNum ); printf("\t\t\tSensorType: %s\n", get_sensor_type(se->SensorType ) ); printf("\t\t\tEventCategory: %s\n", get_sensor_category( se->EventCategory ) ); printf("\t\t\tAssertion: %s\n", se->Assertion ? "TRUE" : "FALSE" ); } break; case SAHPI_ET_HOTSWAP: { SaHpiHotSwapEventT *he = &entry.Event.EventDataUnion.HotSwapEvent; printf("\t\t\tHotSwapState: %s\n", hotswapstate2str( he->HotSwapState ) ); printf("\t\t\tPreviousHotSwapState: %s\n", hotswapstate2str( he->PreviousHotSwapState ) ); } break; case SAHPI_ET_WATCHDOG: break; case SAHPI_ET_OEM: break; case SAHPI_ET_USER: break; } current = next; } while(current != SAHPI_NO_MORE_ENTRIES); }
void list_rdr(SaHpiSessionIdT session_id, SaHpiResourceIdT resource_id) { SaErrorT err; SaHpiEntryIdT current_rdr; SaHpiEntryIdT next_rdr; SaHpiRdrT rdr; SaHpiSensorReadingT reading; SaHpiSensorTypeT sensor_type; SaHpiSensorNumT sensor_num; SaHpiEventCategoryT category; SaHpiSensorThresholdsT thres; SaHpiCtrlNumT ctrl_num; SaHpiCtrlStateT state; SaHpiCtrlTypeT ctrl_type; SaHpiEirIdT l_eirid; SaHpiInventoryDataT* l_inventdata; const SaHpiUint32T l_inventsize = 16384; SaHpiUint32T l_actualsize; printf("RDR Info:\n"); next_rdr = SAHPI_FIRST_ENTRY; do { char tmp_epath[128]; current_rdr = next_rdr; err = saHpiRdrGet(session_id, resource_id, current_rdr, &next_rdr, &rdr); if (SA_OK != err) { if (current_rdr == SAHPI_FIRST_ENTRY) printf("Empty RDR table\n"); else error("saHpiRdrGet", err); return; } printf("\tRecordId: %x\n", rdr.RecordId); printf("\tRdrType: %s\n", rdrtype2str(rdr.RdrType)); if (rdr.RdrType == SAHPI_SENSOR_RDR) { SaErrorT val; sensor_num = rdr.RdrTypeUnion.SensorRec.Num; val = saHpiSensorTypeGet(session_id, resource_id, sensor_num, &sensor_type, &category); printf("\tSensor num: %i\n\tType: %s\n", sensor_num, get_sensor_type(sensor_type)); printf("\tCategory: %s\n", get_sensor_category(category)); memset(&reading, 0, sizeof(SaHpiSensorReadingT)); err = saHpiSensorReadingGet(session_id, resource_id, sensor_num, &reading); if (err != SA_OK) { printf("Error=%d reading sensor data {sensor, %d}\n", err, sensor_num); continue; } if (reading.ValuesPresent & SAHPI_SRF_RAW) { printf("\tValues Present: RAW\n"); printf("\t\tRaw value: %d\n", reading.Raw); } if (reading.ValuesPresent & SAHPI_SRF_INTERPRETED) { printf("\tValues Present: Interpreted\n"); printf("\t\t"); interpreted2str(reading.Interpreted); } if (reading.ValuesPresent & SAHPI_SRF_EVENT_STATE) { printf("\tValues Present: Event State\n"); } if (rdr.RdrTypeUnion.SensorRec.ThresholdDefn.IsThreshold == SAHPI_TRUE) { memset(&thres, 0, sizeof(SaHpiSensorThresholdsT)); err = saHpiSensorThresholdsGet(session_id, resource_id, sensor_num, &thres); if (err != SA_OK) { printf("Error=%d reading sensor thresholds {sensor, %d}\n", err, sensor_num); continue; } if (thres.LowCritical.ValuesPresent) { printf("\t\tThreshold: Low Critical Values\n"); printreading(thres.LowCritical); } if (thres.LowMajor.ValuesPresent) { printf("\t\tThreshold: Low Major Values\n"); printreading(thres.LowMajor); } if (thres.LowMinor.ValuesPresent) { printf("\t\tThreshold: Low Minor Values\n"); printreading(thres.LowMinor); } if (thres.UpCritical.ValuesPresent) { printf("\t\tThreshold: Up Critical Values\n"); printreading(thres.UpCritical); } if (thres.UpMajor.ValuesPresent) { printf("\t\tThreshold: Up Major Values\n"); printreading(thres.UpMajor); } if (thres.UpMinor.ValuesPresent) { printf("\t\tThreshold: Up Minor Values\n"); printreading(thres.UpMinor); } if (thres.PosThdHysteresis.ValuesPresent) { printf("\t\tThreshold: Pos Threshold Hysteresis Values\n"); printreading(thres.PosThdHysteresis); } if (thres.NegThdHysteresis.ValuesPresent) { printf("\t\tThreshold: Neg Threshold Hysteresis Values\n"); printreading(thres.NegThdHysteresis); } } } if (rdr.RdrType == SAHPI_CTRL_RDR) { ctrl_num = rdr.RdrTypeUnion.CtrlRec.Num; err = saHpiControlTypeGet(session_id, resource_id, ctrl_num, &ctrl_type); if (err != SA_OK) { printf("Error=%d reading control type {control, %d}\n", err, ctrl_num); continue; } printf("\tControl num: %i\n\tType: %s\n", ctrl_num, get_control_type(ctrl_type)); err = saHpiControlStateGet(session_id, resource_id, ctrl_num, &state); if (err != SA_OK) { printf("Error=%d reading control state {control, %d}\n", err, ctrl_num); continue; } if (ctrl_type != state.Type) { printf("Control Type mismatch between saHpiControlTypeGet=%d and saHpiControlStateGet = %d\n", ctrl_type, state.Type); } switch (state.Type) { case SAHPI_CTRL_TYPE_DIGITAL: printf("\t\tControl Digital State: %s\n", ctrldigital2str(state.StateUnion.Digital)); break; case SAHPI_CTRL_TYPE_DISCRETE: printf("\t\tControl Discrete State: %x\n", state.StateUnion.Discrete); break; case SAHPI_CTRL_TYPE_ANALOG: printf("\t\tControl Analog State: %x\n", state.StateUnion.Analog); break; case SAHPI_CTRL_TYPE_STREAM: printf("\t\tControl Stream Repeat: %d\n", state.StateUnion.Stream.Repeat); printf("\t\tControl Stream Data: "); display_oembuffer(state.StateUnion.Stream.StreamLength, state.StateUnion.Stream.Stream); break; case SAHPI_CTRL_TYPE_TEXT: printf("\t\tControl Text Line Num: %c\n", state.StateUnion.Text.Line); display_textbuffer(state.StateUnion.Text.Text); break; case SAHPI_CTRL_TYPE_OEM: printf("\t\tControl OEM Manufacturer: %d\n", state.StateUnion.Oem.MId); printf("\t\tControl OEM Data: "); display_oembuffer((SaHpiUint32T)state.StateUnion.Oem.BodyLength, state.StateUnion.Oem.Body); break; default: printf("\t\tInvalid control type (%d) from saHpiControlStateGet\n", state.Type); } } if (rdr.RdrType == SAHPI_INVENTORY_RDR) { l_eirid = rdr.RdrTypeUnion.InventoryRec.EirId; l_inventdata = (SaHpiInventoryDataT *)g_malloc(l_inventsize); err = saHpiEntityInventoryDataRead(session_id, resource_id, l_eirid, l_inventsize, l_inventdata, &l_actualsize); if (err != SA_OK) { printf("Error=%d reading inventory type {EirId, %d}\n", err, l_eirid); continue; } else if (l_inventdata->Validity == SAHPI_INVENT_DATA_VALID) { printf("\tFound Inventory RDR with EirId: %x\n", l_eirid); printf("\tRDR l_inventsize = %d, actualsize = %d\n", l_inventsize, l_actualsize); switch (l_inventdata->DataRecords[0]->RecordType) { case SAHPI_INVENT_RECTYPE_INTERNAL_USE: printf( "Internal Use\n"); break; case SAHPI_INVENT_RECTYPE_PRODUCT_INFO: printf( "Product Info\n"); break; case SAHPI_INVENT_RECTYPE_CHASSIS_INFO: printf( "Chassis Info\n"); break; case SAHPI_INVENT_RECTYPE_BOARD_INFO: printf( "Board Info\n"); break; case SAHPI_INVENT_RECTYPE_OEM: printf( "OEM Record\n"); break; default: printf(" Invalid Invent Rec Type =%x\n", l_inventdata->DataRecords[0]->RecordType); break; } } g_free(l_inventdata); } printf("\tEntity: \n"); entitypath2string(&rdr.Entity, tmp_epath, sizeof(tmp_epath)); printf("\t\t%s\n", tmp_epath); printf("\tIdString: "); display_textbuffer(rdr.IdString); printf("\n"); /* Produce blank line between rdrs. */ }while(next_rdr != SAHPI_LAST_ENTRY); }
static int discover_domain( SaHpiSessionIdT session_id ) { /* walk the RPT list */ SaErrorT rv; SaHpiEntryIdT next = SAHPI_FIRST_ENTRY; int found = 0; do { SaHpiRptEntryT entry; SaHpiEntryIdT current = next; rv = saHpiRptEntryGet( session_id, current, &next, &entry ); if ( rv != SA_OK ) { printf( "saHpiRptEntryGet: %s\n", decode_error( rv ) ); return 1; } // check for control rdr if ( !(entry.ResourceCapabilities & SAHPI_CAPABILITY_RDR) || !(entry.ResourceCapabilities & SAHPI_CAPABILITY_CONTROL) ) continue; /* walk the RDR list for this RPT entry */ SaHpiEntryIdT next_rdr; SaHpiResourceIdT resource_id = entry.ResourceId; int epath_out = 1; do { SaHpiEntryIdT current_rdr = next_rdr; SaHpiRdrT rdr; rv = saHpiRdrGet( session_id, resource_id, current_rdr, &next_rdr, &rdr ); if ( rv != SA_OK ) { printf( "saHpiRdrGet: %s\n", decode_error( rv ) ); return 1; } // check for control if ( rdr.RdrType != SAHPI_CTRL_RDR ) continue; // check for fan if ( rdr.RdrTypeUnion.CtrlRec.OutputType != SAHPI_CTRL_FAN_SPEED ) continue; if ( epath_out ) { char tmp_epath[128]; entitypath2string( &entry.ResourceEntity, tmp_epath, sizeof( tmp_epath ) ); printf("resource: %s\n", tmp_epath ); epath_out = 0; } do_fan( session_id, resource_id, &rdr ); found++; } while( next_rdr != SAHPI_LAST_ENTRY ); } while( next != SAHPI_LAST_ENTRY ); if ( found == 0 ) printf( "no fans found.\n" ); return 0; }
int saHpiRdrTable_modify_context (SaHpiRptEntryT * rpt_entry, SaHpiRdrT * entry, saHpiRdrTable_context * ctx, oid * rpt_oid, size_t rpt_oid_len, oid * child_oid, size_t child_oid_len, unsigned long child_id, trap_vars ** var, size_t * var_len, oid ** var_trap_oid) { unsigned int update_entry = MIB_FALSE; long hash; int len; // Make sure they are valid. if (entry && ctx) { // We are subtracting SaHpiTextBufferT b/c the underlaying HPI // library is not zeroing out the memory for not used entries - // thus garbage in SaHpiTextBufferT exist, hash = calculate_hash_value (entry, sizeof (SaHpiRdrTypeT) + sizeof (SaHpiEntityPathT) + sizeof (SaHpiEntryIdT)); DEBUGMSGTL ((AGENT, " Hash value: %d, in ctx: %d\n", hash, ctx->hash)); if (ctx->hash != 0) { // Only do the check if the hash value is something else than zero. // 'zero' value is only for newly created records, and in some // rare instances when the hash has rolled to zero - in which // case we will just consider the worst-case scenario and update // the record and not trust the hash value. if (hash == ctx->hash) { // The same data. No need to change. return AGENT_ENTRY_EXIST; } if ((ctx->domain_id == rpt_entry->DomainId) && (ctx->saHpiResourceID == rpt_entry->ResourceId) && (ctx->saHpiRdrRecordId == entry->RecordId) && (ctx->saHpiRdrType == entry->RdrType+1)) { update_entry = MIB_TRUE; DEBUGMSGTL((AGENT,"Updating RDR entry. [%d, %d, %d, %d]\n", rpt_entry->DomainId, rpt_entry->ResourceId, entry->RecordId, entry->RdrType+1)); } } if (hash == 0) hash = -1; ctx->hash = hash; ctx->domain_id = rpt_entry->DomainId; //ctx->child_id = child_id; ctx->saHpiResourceID = rpt_entry->ResourceId; ctx->saHpiRdrRecordId = entry->RecordId; ctx->saHpiRdrType = entry->RdrType+1; len = entitypath2string (&entry->Entity, ctx->saHpiRdrEntityPath, SNMP_MAX_MSG_SIZE); // Try to get it from rpt_entry. if (len == 0) { len = entitypath2string (&rpt_entry->ResourceEntity, ctx->saHpiRdrEntityPath, SNMP_MAX_MSG_SIZE); } if (len < 0) { // Bummer, EntityPath too long to fit in the SNMP_MAX_MSG_SIZE. len = 0; } DEBUGMSGTL ((AGENT, "EntityPath: %s\n", ctx->saHpiRdrEntityPath)); ctx->saHpiRdrEntityPath_len = len; ctx->saHpiRdr_len = child_oid_len * sizeof (oid); memcpy (ctx->saHpiRdr, child_oid, ctx->saHpiRdr_len); ctx->saHpiRdrRTP_len = rpt_oid_len * sizeof (oid); memcpy (ctx->saHpiRdrRTP, rpt_oid, ctx->saHpiRdrRTP_len); ctx->saHpiRdrId = child_id; // Fix the trap messages saHpiResourceDataRecordNotification[RDR_NOTIF_RDRRECORDID].value = (u_char *) & ctx->saHpiRdrRecordId; saHpiResourceDataRecordNotification[RDR_NOTIF_RDRRECORDID].value_len = sizeof (ctx->saHpiRdrRecordId); saHpiResourceDataRecordNotification[RDR_NOTIF_TYPE].value = (u_char *) & ctx->saHpiRdrType; saHpiResourceDataRecordNotification[RDR_NOTIF_TYPE].value_len = sizeof (ctx->saHpiRdrType); saHpiResourceDataRecordNotification[RDR_NOTIF_ENTITY_PATH].value = (u_char *) & ctx->saHpiRdrEntityPath; saHpiResourceDataRecordNotification[RDR_NOTIF_ENTITY_PATH].value_len = ctx->saHpiRdrEntityPath_len; saHpiResourceDataRecordNotification[RDR_NOTIF_RDR].value = (u_char *) & ctx->saHpiRdr; saHpiResourceDataRecordNotification[RDR_NOTIF_RDR].value_len = ctx->saHpiRdr_len; saHpiResourceDataRecordNotification[RDR_NOTIF_RDR_RTP].value = (u_char *) & ctx->saHpiRdrRTP; saHpiResourceDataRecordNotification[RDR_NOTIF_RDR_RTP].value_len = ctx->saHpiRdrRTP_len; // Point *var to this trap_vars. *var = (trap_vars *) & saHpiResourceDataRecordNotification; *var_len = RDR_NOTIF_COUNT; *var_trap_oid = (oid *) & saHpiResourceDataRecordNotification_oid; if (update_entry == MIB_TRUE) return AGENT_ENTRY_EXIST; return AGENT_NEW_ENTRY; } return AGENT_ERR_NULL_DATA; }