netsnmp_variable_list * nsModuleTable_get_first_data_point(void **my_loop_context, void **my_data_context, netsnmp_variable_list * put_index_data, netsnmp_iterator_info *otherstuff) { struct variable_list *vptr; u_long ultmp; context_tree_ptr *ctree; ctree = SNMP_MALLOC_TYPEDEF(context_tree_ptr); ctree->context_ptr = get_top_context_cache(); ctree->tree = ctree->context_ptr->first_subtree; *my_loop_context = ctree; *my_data_context = ctree->tree; vptr = put_index_data; snmp_set_var_value(vptr, (u_char *) ctree->context_ptr->context_name, strlen(ctree->context_ptr->context_name)); vptr = vptr->next_variable; snmp_set_var_value(vptr, (u_char *)ctree->context_ptr->first_subtree->name_a, ctree->context_ptr->first_subtree->namelen * sizeof(oid)); ultmp = ctree->context_ptr->first_subtree->priority; vptr = vptr->next_variable; snmp_set_var_value(vptr, (u_char *) & ultmp, sizeof(ultmp)); return put_index_data; }
netsnmp_variable_list * udpTable_next_entry( void **loop_context, void **data_context, netsnmp_variable_list *index, netsnmp_iterator_info *data) { int i = (int)*loop_context; long port; if (udp_size < i) return NULL; /* * Set up the indexing for the specified row... */ #if defined (WIN32) || defined (cygwin) port = ntohl((u_long)udp_head[i].UDPTABLE_LOCALADDRESS); snmp_set_var_value(index, (u_char *)&port, sizeof(udp_head[i].UDPTABLE_LOCALADDRESS)); #else snmp_set_var_value(index, (u_char *)&udp_head[i].UDPTABLE_LOCALADDRESS, sizeof(udp_head[i].UDPTABLE_LOCALADDRESS)); #endif port = UDP_PORT_TO_HOST_ORDER((u_short)udp_head[i].UDPTABLE_LOCALPORT); snmp_set_var_value(index->next_variable, (u_char*)&port, sizeof(port)); /* * ... return the data structure for this row, * and update the loop context ready for the next one. */ *data_context = (void*)&udp_head[i]; *loop_context = (void*)++i; return index; }
/** * @internal * convert the index component stored in the context to an oid */ int dmfTable_index_to_oid(netsnmp_index * oid_idx, dmfTable_mib_index * mib_idx) { int err = SNMP_ERR_NOERROR; /* * temp storage for parsing indexes */ /* * server(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */ netsnmp_variable_list var_server; /* * pagesize(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ netsnmp_variable_list var_pagesize; /* * set up varbinds */ memset(&var_server, 0x00, sizeof(var_server)); var_server.type = ASN_OCTET_STR; memset(&var_pagesize, 0x00, sizeof(var_pagesize)); var_pagesize.type = ASN_INTEGER; /* * chain temp index varbinds together */ var_server.next_variable = &var_pagesize; var_pagesize.next_variable = NULL; DEBUGMSGTL(("verbose:dmfTable:dmfTable_index_to_oid", "called\n")); /* * server(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */ snmp_set_var_value(&var_server, (u_char *) & mib_idx->server, mib_idx->server_len * sizeof(mib_idx->server[0])); /* * pagesize(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ snmp_set_var_value(&var_pagesize, (u_char *) & mib_idx->pagesize, sizeof(mib_idx->pagesize)); err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, NULL, 0, &var_server); if (err) snmp_log(LOG_ERR, "error %d converting index to oid\n", err); /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers(&var_server); return err; } /* dmfTable_index_to_oid */
netsnmp_variable_list * ipCidrRouteTable_set_indexes(RTENTRY *ourroute, netsnmp_variable_list *put_index_data) { netsnmp_variable_list *vptr; /** ipCidrRouteDest */ vptr = put_index_data; snmp_set_var_value(vptr, (u_char *) &((struct sockaddr_in *) (&ourroute->rt_dst))->sin_addr.s_addr, sizeof(((struct sockaddr_in *) (&ourroute->rt_dst))->sin_addr)); /** ipCidrRouteMask */ vptr = vptr->next_variable; snmp_set_var_value(vptr, (u_char *) &((struct sockaddr_in *) (&ourroute->rt_genmask))->sin_addr.s_addr, sizeof(((struct sockaddr_in *) (&ourroute->rt_genmask))->sin_addr)); /** ipCidrRouteTos */ vptr = vptr->next_variable; snmp_set_var_value(vptr, (u_char *) &ourroute->rt_tos, sizeof(ourroute->rt_tos)); vptr = vptr->next_variable; /** ipCidrRouteNextHop */ snmp_set_var_value(vptr, (u_char *) &((struct sockaddr_in *) (&ourroute->rt_gateway))->sin_addr.s_addr, sizeof(((struct sockaddr_in *) (&ourroute->rt_gateway))->sin_addr)); return put_index_data; }
/** * @internal * convert the index component stored in the context to an oid */ int dot11WtpIfTable_index_to_oid(netsnmp_index *oid_idx, dot11WtpIfTable_mib_index *mib_idx) { int err = SNMP_ERR_NOERROR; /* * temp storage for parsing indexes */ /* * wtpMacAddr(1)/Dot11BaseWtpIdTC/ASN_OCTET_STR/char(char)//L/A/w/e/r/d/h */ netsnmp_variable_list var_wtpMacAddr; /* * wtpIfIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ netsnmp_variable_list var_wtpIfIndex; /* * set up varbinds */ memset( &var_wtpMacAddr, 0x00, sizeof(var_wtpMacAddr) ); var_wtpMacAddr.type = ASN_OCTET_STR; memset( &var_wtpIfIndex, 0x00, sizeof(var_wtpIfIndex) ); var_wtpIfIndex.type = ASN_INTEGER; /* * chain temp index varbinds together */ var_wtpMacAddr.next_variable = &var_wtpIfIndex; var_wtpIfIndex.next_variable = NULL; DEBUGMSGTL(("verbose:dot11WtpIfTable:dot11WtpIfTable_index_to_oid","called\n")); /* wtpMacAddr(1)/Dot11BaseWtpIdTC/ASN_OCTET_STR/char(char)//L/A/w/e/r/d/h */ snmp_set_var_value(&var_wtpMacAddr, (u_char*)&mib_idx->wtpMacAddr, mib_idx->wtpMacAddr_len * sizeof(mib_idx->wtpMacAddr[0])); /* wtpIfIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ snmp_set_var_value(&var_wtpIfIndex, (u_char*)&mib_idx->wtpIfIndex, sizeof(mib_idx->wtpIfIndex)); err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, NULL, 0, &var_wtpMacAddr); if(err) snmp_log(LOG_ERR,"error %d converting index to oid\n", err); /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers( &var_wtpMacAddr ); return err; } /* dot11WtpIfTable_index_to_oid */
int sctpAssocLocalAddrTable_entry_update_index(sctpAssocLocalAddrTable_entry * entry) { int err = 0; netsnmp_variable_list var_sctpAssocId; netsnmp_variable_list var_sctpAssocLocalAddrType; netsnmp_variable_list var_sctpAssocLocalAddr; /* * prepare the values to be converted */ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId)); var_sctpAssocId.type = ASN_UNSIGNED; memset(&var_sctpAssocLocalAddrType, 0, sizeof(var_sctpAssocLocalAddrType)); var_sctpAssocLocalAddrType.type = ASN_INTEGER; memset(&var_sctpAssocLocalAddr, 0, sizeof(var_sctpAssocLocalAddr)); var_sctpAssocLocalAddr.type = ASN_OCTET_STR; var_sctpAssocId.next_variable = &var_sctpAssocLocalAddrType; var_sctpAssocLocalAddrType.next_variable = &var_sctpAssocLocalAddr; var_sctpAssocLocalAddr.next_variable = NULL; snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId, sizeof(entry->sctpAssocId)); snmp_set_var_value(&var_sctpAssocLocalAddrType, (u_char *) & entry->sctpAssocLocalAddrType, sizeof(entry->sctpAssocLocalAddrType)); snmp_set_var_value(&var_sctpAssocLocalAddr, (u_char *) & entry->sctpAssocLocalAddr, entry->sctpAssocLocalAddr_len * sizeof(entry->sctpAssocLocalAddr[0])); /* * convert it */ err = build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len, &entry->oid_index.len, NULL, 0, &var_sctpAssocId); if (err) snmp_log(LOG_ERR, "error %d converting index to oid\n", err); /* * release any memory allocated during the conversion */ snmp_reset_var_buffers(&var_sctpAssocId); return err; }
netsnmp_variable_list * nsVacmAccessTable_get_next_data_point(void **my_loop_context, void **my_data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata) { struct vacm_accessEntry *entry = (struct vacm_accessEntry *) *my_loop_context; netsnmp_variable_list *idx; int len; char *cp; newView: idx = put_index_data; if ( nsViewIdx == VACM_MAX_VIEWS ) { entry = vacm_scanAccessNext(); nsViewIdx = 0; } if (entry) { len = entry->groupName[0]; snmp_set_var_value(idx, (u_char *)entry->groupName+1, len); idx = idx->next_variable; len = entry->contextPrefix[0]; snmp_set_var_value(idx, (u_char *)entry->contextPrefix+1, len); idx = idx->next_variable; snmp_set_var_value(idx, (u_char *)&entry->securityModel, sizeof(entry->securityModel)); idx = idx->next_variable; snmp_set_var_value(idx, (u_char *)&entry->securityLevel, sizeof(entry->securityLevel)); /* * Find the next valid authType view - skipping unused entries */ idx = idx->next_variable; for (; nsViewIdx < VACM_MAX_VIEWS; nsViewIdx++) { if ( entry->views[ nsViewIdx ][0] ) break; } if ( nsViewIdx == VACM_MAX_VIEWS ) goto newView; cp = se_find_label_in_slist(VACM_VIEW_ENUM_NAME, nsViewIdx++); DEBUGMSGTL(("nsVacm", "nextDP %s:%s (%d)\n", entry->groupName+1, cp, nsViewIdx-1)); snmp_set_var_value(idx, (u_char *)cp, strlen(cp)); idx = idx->next_variable; *my_data_context = (void *) entry; *my_loop_context = (void *) entry; return put_index_data; } else { return NULL; } }
netsnmp_variable_list * tcpTable_next_entry( void **loop_context, void **data_context, netsnmp_variable_list *index, netsnmp_iterator_info *data) { TCPTABLE_ENTRY_TYPE *entry = (TCPTABLE_ENTRY_TYPE *)*loop_context; netsnmp_variable_list *idx; long addr, port; if (!entry) return NULL; /* * Set up the indexing for the specified row... */ idx = index; #if defined(osf5) && defined(IN6_EXTRACT_V4ADDR) addr = ntohl(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)); #else addr = ntohl(entry->TCPTABLE_LOCALADDRESS); #endif snmp_set_var_value(idx, (u_char *)&addr, sizeof(addr)); port = TCP_PORT_TO_HOST_ORDER(entry->TCPTABLE_LOCALPORT); idx = idx->next_variable; snmp_set_var_value(idx, (u_char*)&port, sizeof(port)); idx = idx->next_variable; #if defined(osf5) && defined(IN6_EXTRACT_V4ADDR) addr = ntohl(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_faddr)); #else addr = ntohl(entry->TCPTABLE_REMOTEADDRESS); #endif snmp_set_var_value(idx, (u_char *)&addr, sizeof(addr)); port = TCP_PORT_TO_HOST_ORDER(entry->TCPTABLE_REMOTEPORT); idx = idx->next_variable; snmp_set_var_value(idx, (u_char*)&port, sizeof(port)); /* * ... return the data structure for this row, * and update the loop context ready for the next one. */ *data_context = (void*)entry; *loop_context = (void*)entry->INP_NEXT_SYMBOL; return index; }
/************************************************************ * * Convert table index components to an oid. */ int ituAlarmTable_index_to_oid(char* name, unsigned long index, long severity, netsnmp_index *oid_idx) { int err = SNMP_ERR_NOERROR; netsnmp_variable_list var_alarmListName; netsnmp_variable_list var_alarmModelIndex; netsnmp_variable_list var_alarmModelSeverity; /* * set up varbinds */ memset(&var_alarmListName, 0x00, sizeof(var_alarmListName)); var_alarmListName.type = ASN_OCTET_STR; memset(&var_alarmModelIndex, 0x00, sizeof(var_alarmModelIndex)); var_alarmModelIndex.type = ASN_UNSIGNED; memset(&var_alarmModelSeverity, 0x00, sizeof(var_alarmModelSeverity)); var_alarmModelSeverity.type = ASN_INTEGER; /* * chain index varbinds together */ var_alarmListName.next_variable = &var_alarmModelIndex; var_alarmModelIndex.next_variable = &var_alarmModelSeverity; var_alarmModelSeverity.next_variable = NULL; DEBUGMSGTL(("verbose:ituAlarmTable:ituAlarmTable_index_to_oid", "called\n")); snmp_set_var_value(&var_alarmListName, (u_char*) name, strlen(name)); snmp_set_var_value(&var_alarmModelIndex, (u_char*) &index, sizeof(index)); snmp_set_var_value(&var_alarmModelSeverity, (u_char*) &severity, sizeof(severity)); err = build_oid(&oid_idx->oids, &oid_idx->len, NULL, 0, &var_alarmListName); if (err) { snmp_log(LOG_ERR, "error %d converting index to oid: ituAlarmTable_index_to_oid", err); } /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers(&var_alarmListName); return err; }
/************************************************************ * * Convert table index components to an oid. */ int alarmModelTable_index_to_oid(char* name, unsigned long index, unsigned long state, netsnmp_index *oid_idx) { int err = SNMP_ERR_NOERROR; netsnmp_variable_list var_alarmListName; netsnmp_variable_list var_alarmModelIndex; netsnmp_variable_list var_alarmModelState; /* * set up varbinds */ memset(&var_alarmListName, 0x00, sizeof(var_alarmListName)); var_alarmListName.type = ASN_OCTET_STR; memset(&var_alarmModelIndex, 0x00, sizeof(var_alarmModelIndex)); var_alarmModelIndex.type = ASN_UNSIGNED; memset(&var_alarmModelState, 0x00, sizeof(var_alarmModelState)); var_alarmModelState.type = ASN_UNSIGNED; /* * chain index varbinds together */ var_alarmListName.next_variable = &var_alarmModelIndex; var_alarmModelIndex.next_variable = &var_alarmModelState; var_alarmModelState.next_variable = NULL; DEBUGMSGTL(("verbose:alarmModelTable:alarmModelTable_index_to_oid", "called\n")); snmp_set_var_value(&var_alarmListName, (u_char*) name, strlen(name)); snmp_set_var_value(&var_alarmModelIndex, (u_char*) &index, sizeof(index)); snmp_set_var_value(&var_alarmModelState, (u_char*) &state, sizeof(state)); err = build_oid(&oid_idx->oids, &oid_idx->len, NULL, 0, &var_alarmListName); if (err) { TRC_ERROR("error %d converting index to oid: alarmModelTable_index_to_oid", err); // LCOV_EXCL_LINE } /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers(&var_alarmListName); return err; }
int sctpAssocTable_entry_update_index(sctpAssocTable_entry * entry) { netsnmp_variable_list var_sctpAssocId; int err = 0; /* * prepare the value to be converted */ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId)); var_sctpAssocId.type = ASN_UNSIGNED; var_sctpAssocId.next_variable = NULL; snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId, sizeof(entry->sctpAssocId)); /* * convert it */ err = build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len, &entry->oid_index.len, NULL, 0, &var_sctpAssocId); if (err) snmp_log(LOG_ERR, "error %d converting index to oid\n", err); /* * release any memory allocated during the conversion */ snmp_reset_var_buffers(&var_sctpAssocId); return err; }
int snmp_set_var_typed_value(netsnmp_variable_list * newvar, u_char type, const u_char * val_str, size_t val_len) { newvar->type = type; return snmp_set_var_value(newvar, val_str, val_len); }
netsnmp_variable_list* pcapFilterTable_getFirst ( void **loop_context, void **data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata ) { struct device *d = NULL; struct filter *f = NULL; *loop_context = NULL; *data_context = NULL; // Find first valid filter within valid worker. for (d = g_pDeviceList; d; d = d->next_device) { if (!d->pcap) continue; if (!d->first_filter) continue; f = d->first_filter; *loop_context = (void*)f; *data_context = (void*)f; snmp_set_var_value (put_index_data, (u_char*) &f->index, sizeof(f->index)); return put_index_data; } return NULL; }
/** functionally the same as LHAMembershipTable_get_first_data_point, but my_loop_context has already been set to a previous value and should be updated to the next in the list. For example, if it was a linked list, you might want to cast it to your local data type and then return my_loop_context->next. The my_data_context pointer should be set to something you need later (in your main LHAMembershipTable_handler routine) and the indexes in put_index_data updated again. */ netsnmp_variable_list * LHAMembershipTable_get_next_data_point(void **my_loop_context, void **my_data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata) { static size_t i = 0; netsnmp_variable_list *vptr; SaClmClusterNotificationT * info; if (*my_loop_context != NULL) { i = *((size_t *) *my_loop_context); } else { i = 0; } if (!gMembershipInfo || i >= gMembershipInfo->len) return NULL; vptr = put_index_data; info = (SaClmClusterNotificationT *) g_ptr_array_index(gMembershipInfo, i); snmp_set_var_value(vptr, (u_char *) &i, sizeof(i)); vptr = vptr->next_variable; i++; *my_loop_context = (void *) &i; *my_data_context = (void *) info; return put_index_data; }
/** functionally the same as LHANodeTable_get_first_data_point, but my_loop_context has already been set to a previous value and should be updated to the next in the list. For example, if it was a linked list, you might want to cast it to your local data type and then return my_loop_context->next. The my_data_context pointer should be set to something you need later (in your main LHANodeTable_handler routine) and the indexes in put_index_data updated again. */ netsnmp_variable_list * LHANodeTable_get_next_data_point(void **my_loop_context, void **my_data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata) { static size_t i; netsnmp_variable_list *vptr; struct hb_nodeinfo * info; if (*my_loop_context != NULL) { i = *((size_t *) *my_loop_context); } else { i = 0; } if (!gNodeInfo || i >= gNodeInfo->len) return NULL; vptr = put_index_data; info = (struct hb_nodeinfo *) g_ptr_array_index(gNodeInfo, i); snmp_set_var_value(vptr, (u_char *) & info->id, sizeof(size_t)); vptr = vptr->next_variable; i++; *my_data_context = (void *) info; *my_loop_context = (void *) &i; return put_index_data; }
char * register_string_index(oid * name, size_t name_len, char *cp) { netsnmp_variable_list varbind, *res; memset(&varbind, 0, sizeof(netsnmp_variable_list)); varbind.type = ASN_OCTET_STR; snmp_set_var_objid(&varbind, name, name_len); if (cp != ANY_STRING_INDEX) { snmp_set_var_value(&varbind, (u_char *) cp, strlen(cp)); res = register_index(&varbind, ALLOCATE_THIS_INDEX, main_session); } else { res = register_index(&varbind, ALLOCATE_ANY_INDEX, main_session); } if (res == NULL) { return NULL; } else { char *rv = (char *)malloc(res->val_len + 1); if (rv) { memcpy(rv, res->val.string, res->val_len); rv[res->val_len] = 0; } free(res); return rv; } }
netsnmp_variable_list * nsTransactionTable_get_next_data_point(void **my_loop_context, void **my_data_context, netsnmp_variable_list * put_index_data, netsnmp_iterator_info *iinfo) { netsnmp_variable_list *vptr; netsnmp_agent_session *alist = (netsnmp_agent_session *) *my_loop_context; if (!alist->next) return NULL; alist = alist->next; *my_loop_context = (void *) alist; *my_data_context = (void *) alist; vptr = put_index_data; snmp_set_var_value(vptr, (u_char *) & alist->pdu->transid, sizeof(alist->pdu->transid)); return put_index_data; }
int unregister_string_index(oid * name, size_t name_len, char *cp) { netsnmp_variable_list varbind; memset(&varbind, 0, sizeof(netsnmp_variable_list)); varbind.type = ASN_OCTET_STR; snmp_set_var_objid(&varbind, name, name_len); snmp_set_var_value(&varbind, (u_char *) cp, strlen(cp)); return (unregister_index(&varbind, FALSE, main_session)); }
netsnmp_variable_list * dot11VlanAbilityTable_get_next_data_point(void **my_loop_context, void **my_data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata) { struct dot11VlanAbilityTable_entry *entry = (struct dot11VlanAbilityTable_entry *)*my_loop_context; netsnmp_variable_list *idx = put_index_data; if ( entry ) { snmp_set_var_value( idx, (u_char *)entry->wtpMacAddr, strlen(entry->wtpMacAddr) ); idx = idx->next_variable; snmp_set_var_value( idx, (u_char*)&entry->wlanCurrID, sizeof(long) ); idx = idx->next_variable; *my_data_context = (void *)entry; *my_loop_context = (void *)entry->next; } else { return NULL; } return put_index_data; }
int unregister_oid_index(oid * name, size_t name_len, oid * value, size_t value_len) { netsnmp_variable_list varbind; memset(&varbind, 0, sizeof(netsnmp_variable_list)); varbind.type = ASN_OBJECT_ID; snmp_set_var_objid(&varbind, name, name_len); snmp_set_var_value(&varbind, (u_char *) value, value_len * sizeof(oid)); return (unregister_index(&varbind, FALSE, main_session)); }
netsnmp_variable_list * get_first_logging_entry(void **loop_context, void **data_context, netsnmp_variable_list *index, netsnmp_iterator_info *data) { long temp; netsnmp_log_handler *logh_head = get_logh_head(); if ( !logh_head ) return NULL; temp = logh_head->priority; snmp_set_var_value(index, (u_char*)&temp, sizeof(temp)); if ( logh_head->token ) snmp_set_var_value(index->next_variable, (const u_char*)logh_head->token, strlen(logh_head->token)); else snmp_set_var_value(index->next_variable, NULL, 0); *loop_context = (void*)logh_head; *data_context = (void*)logh_head; return index; }
netsnmp_variable_list* pcapFilterTable_getNext ( void **loop_context, void **data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata ) { struct device *d = NULL; struct filter *f = NULL; if (!loop_context) return NULL; // Error. f = *(struct filter**)loop_context; if (!f) return NULL; // Error. if (f->next_filter) { f = f->next_filter; *loop_context = (void*)f; *data_context = (void*)f; snmp_set_var_value (put_index_data, (u_char*) &f->index, sizeof(f->index)); return put_index_data; } for (d = f->parent_device->next_device; d; d = d->next_device) { if (!d->pcap) continue; if (!d->first_filter) continue; f = d->first_filter; *loop_context = (void*)f; *data_context = (void*)f; snmp_set_var_value (put_index_data, (u_char*) &f->index, sizeof(f->index)); return put_index_data; } return NULL; }
/** * @internal * convert the index component stored in the context to an oid */ int jmfcNamespaceHttpServerTable_index_to_oid(netsnmp_index *oid_idx, jmfcNamespaceHttpServerTable_mib_index * mib_idx) { int err = SNMP_ERR_NOERROR; /* * temp storage for parsing indexes */ /* * jmfcNamespaceName(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h */ netsnmp_variable_list var_jmfcNamespaceName; /* * set up varbinds */ memset( &var_jmfcNamespaceName, 0x00, sizeof(var_jmfcNamespaceName) ); var_jmfcNamespaceName.type = ASN_OCTET_STR; /* * chain temp index varbinds together */ var_jmfcNamespaceName.next_variable = NULL; DEBUGMSGTL(("verbose:jmfcNamespaceHttpServerTable:jmfcNamespaceHttpServerTable_index_to_oid","called\n")); /* * jmfcNamespaceName(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h */ snmp_set_var_value(&var_jmfcNamespaceName, (u_char *) & mib_idx->jmfcNamespaceName, mib_idx->jmfcNamespaceName_len * sizeof(mib_idx->jmfcNamespaceName[0])); err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, NULL, 0, &var_jmfcNamespaceName); if(err) snmp_log(LOG_ERR,"error %d converting index to oid\n", err); /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers( &var_jmfcNamespaceName ); return err; } /* jmfcNamespaceHttpServerTable_index_to_oid */
/** * @internal * convert the index component stored in the context to an oid */ int ipv6ScopeZoneIndexTable_index_to_oid(netsnmp_index * oid_idx, ipv6ScopeZoneIndexTable_mib_index * mib_idx) { int err = SNMP_ERR_NOERROR; /* * temp storage for parsing indexes */ /* * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H */ netsnmp_variable_list var_ipv6ScopeZoneIndexIfIndex; /* * set up varbinds */ memset(&var_ipv6ScopeZoneIndexIfIndex, 0x00, sizeof(var_ipv6ScopeZoneIndexIfIndex)); var_ipv6ScopeZoneIndexIfIndex.type = ASN_INTEGER; /* * chain temp index varbinds together */ var_ipv6ScopeZoneIndexIfIndex.next_variable = NULL; DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_index_to_oid", "called\n")); /* * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H */ snmp_set_var_value(&var_ipv6ScopeZoneIndexIfIndex, (u_char *) & mib_idx->ipv6ScopeZoneIndexIfIndex, sizeof(mib_idx->ipv6ScopeZoneIndexIfIndex)); err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, NULL, 0, &var_ipv6ScopeZoneIndexIfIndex); if (err) snmp_log(LOG_ERR, "error %d converting index to oid\n", err); /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers(&var_ipv6ScopeZoneIndexIfIndex); return err; } /* ipv6ScopeZoneIndexTable_index_to_oid */
struct variable_list * nsModuleTable_get_next_data_point(void **my_loop_context, void **my_data_context, struct variable_list *put_index_data, netsnmp_iterator_info *otherstuff) { struct variable_list *vptr; context_tree_ptr *ctree = (context_tree_ptr *) * my_loop_context; u_long ultmp; if (ctree->tree->next) ctree->tree = ctree->tree->next; else { ctree->context_ptr = ctree->context_ptr->next; if (!ctree->context_ptr) { return NULL; } ctree->tree = ctree->context_ptr->first_subtree; } *my_data_context = ctree->tree; vptr = put_index_data; snmp_set_var_value(vptr, (u_char *) ctree->context_ptr->context_name, strlen(ctree->context_ptr->context_name)); vptr = vptr->next_variable; snmp_set_var_value(vptr, (u_char *) ctree->tree->name_a, ctree->tree->namelen * sizeof(oid)); ultmp = ctree->tree->priority; vptr = vptr->next_variable; snmp_set_var_value(vptr, (u_char *) & ultmp, sizeof(ultmp)); return put_index_data; }
netsnmp_variable_list * udpTable_next_entry( void **loop_context, void **data_context, netsnmp_variable_list *index, netsnmp_iterator_info *data) { UDPTABLE_ENTRY_TYPE *entry = (UDPTABLE_ENTRY_TYPE *)*loop_context; long port; in_addr_t addr; if (!entry) return NULL; /* * Set up the indexing for the specified row... */ #if defined(osf5) && defined(IN6_EXTRACT_V4ADDR) snmp_set_var_value(index, (u_char*)&IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr), sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr))); #else addr = UDP_ADDRESS_TO_NETWORK_ORDER((in_addr_t)entry->UDPTABLE_LOCALADDRESS); snmp_set_var_value(index, (u_char *)&addr, sizeof(entry->UDPTABLE_LOCALADDRESS)); #endif port = UDP_PORT_TO_HOST_ORDER(entry->UDPTABLE_LOCALPORT); snmp_set_var_value(index->next_variable, (u_char*)&port, sizeof(port)); /* * ... return the data structure for this row, * and update the loop context ready for the next one. */ *data_context = (void*)entry; *loop_context = (void*)entry->INP_NEXT_SYMBOL; return index; }
netsnmp_variable_list * dot11QosWirelessTable_get_next_data_point(void **my_loop_context, void **my_data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata) { struct dot11QosWirelessTable_entry *entry = (struct dot11QosWirelessTable_entry *)*my_loop_context; netsnmp_variable_list *idx = put_index_data; if ( entry ) { snmp_set_var_value( idx, (u_char*)&entry->globalWtpID, sizeof(entry->globalWtpID) ); idx = idx->next_variable; snmp_set_var_value( idx, (u_char*)&entry->RadioLocalID, sizeof(entry->RadioLocalID) ); idx = idx->next_variable; snmp_set_var_value( idx, (u_char*)&entry->QosType, sizeof(entry->QosType) ); idx = idx->next_variable; *my_data_context = (void *)entry; *my_loop_context = (void *)entry->next; } else { return NULL; } return put_index_data; }
/** * @internal * convert the index component stored in the context to an oid */ int dessertAppStatsTable_index_to_oid(netsnmp_index * oid_idx, dessertAppStatsTable_mib_index * mib_idx) { int err = SNMP_ERR_NOERROR; /* * temp storage for parsing indexes */ /* * appStatsIndex(1)///()//L/a/w/e/r/d/h */ netsnmp_variable_list var_appStatsIndex; /* * set up varbinds */ memset(&var_appStatsIndex, 0x00, sizeof(var_appStatsIndex)); var_appStatsIndex.type = ASN_INTEGER; /* * chain temp index varbinds together */ var_appStatsIndex.next_variable = NULL; DEBUGMSGTL(("verbose:dessertAppStatsTable:dessertAppStatsTable_index_to_oid", "called\n")); /* * appStatsIndex(1)///()//L/a/w/e/r/d/h */ snmp_set_var_value(&var_appStatsIndex, (u_char *) & mib_idx->appStatsIndex, sizeof(mib_idx->appStatsIndex)); err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, NULL, 0, &var_appStatsIndex); if (err) snmp_log(LOG_ERR, "error %d converting index to oid\n", err); /* * parsing may have allocated memory. free it. */ snmp_reset_var_buffers(&var_appStatsIndex); return err; } /* dessertAppStatsTable_index_to_oid */
netsnmp_variable_list * get_first_cache_entry(void **loop_context, void **data_context, netsnmp_variable_list *index, netsnmp_iterator_info *data) { netsnmp_cache *cache_head = netsnmp_cache_get_head(); if ( !cache_head ) return NULL; snmp_set_var_value(index, (u_char*)cache_head->rootoid, sizeof(oid) * cache_head->rootoid_len); *loop_context = (void*)cache_head; *data_context = (void*)cache_head; return index; }
struct variable_list * register_oid_index( oid *name, size_t name_len, oid *value, size_t value_len ) { struct variable_list varbind; memset( &varbind, 0, sizeof(struct variable_list)); varbind.type = ASN_OBJECT_ID; snmp_set_var_objid( &varbind, name, name_len ); if ( value != ANY_OID_INDEX ) { snmp_set_var_value( &varbind, (u_char*)value, value_len*sizeof(oid) ); return( register_index( &varbind, ALLOCATE_THIS_INDEX, main_session )); } else return( register_index( &varbind, ALLOCATE_ANY_INDEX, main_session )); }