本文整理汇总了C++中snmp_reset_var_buffers函数的典型用法代码示例。如果您正苦于以下问题:C++ snmp_reset_var_buffers函数的具体用法?C++ snmp_reset_var_buffers怎么用?C++ snmp_reset_var_buffers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmp_reset_var_buffers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dmfTable_index_to_oid
/**
* @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 */
示例2: sctpAssocTable_entry_update_index
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;
}
示例3: saHpiAutoInsertTimeoutTable_extract_index
/**
* 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
saHpiAutoInsertTimeoutTable_extract_index( saHpiAutoInsertTimeoutTable_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;
int err;
/*
* 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) )) {
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 = 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 */
err = saHpiDomainId_check_index(*var_saHpiDomainId.val.integer);
}
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers( &var_saHpiDomainId );
return err;
}
示例4: openserSIPRegUserLookupTable_extract_index
/*
* the *_extract_index routine. (Mostly auto-generated)
*
* 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 individual index components and copy those indexes to the
* context. Then we make sure the indexes for the new row are valid.
*
* It has been modified from its original form in that if the indexes are
* invalid, then they aren't returned. An index is invalid if:
*
* 1) It is < 1
* 2) It doesn't match the global userLookupIndex. (As per MIB specs)
*
*/
int openserSIPRegUserLookupTable_extract_index(
openserSIPRegUserLookupTable_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.
*/
netsnmp_variable_list var_openserSIPRegUserLookupIndex;
int err;
/* copy index, if provided */
if(hdr) {
netsnmp_assert(ctx->index.oids == NULL);
if((hdr->len > MAX_OID_LEN) ||
snmp_clone_mem( (void*)&ctx->index.oids, hdr->oids,
hdr->len * sizeof(oid) )) {
return -1;
}
ctx->index.len = hdr->len;
}
/* Set up the index */
memset(&var_openserSIPRegUserLookupIndex, 0x00,
sizeof(var_openserSIPRegUserLookupIndex));
var_openserSIPRegUserLookupIndex.type = ASN_UNSIGNED;
var_openserSIPRegUserLookupIndex.next_variable = NULL;
/* parse the oid into the individual index components */
err = parse_oid_indexes( hdr->oids, hdr->len,
&var_openserSIPRegUserLookupIndex );
if (err == SNMP_ERR_NOERROR) {
/* copy index components into the context structure */
ctx->openserSIPRegUserLookupIndex =
*var_openserSIPRegUserLookupIndex.val.integer;
/*
* Check to make sure that the index corresponds to the
* global_userLookupCounter, as per the MIB specifications.
*/
if (*var_openserSIPRegUserLookupIndex.val.integer !=
global_UserLookupCounter ||
*var_openserSIPRegUserLookupIndex.val.integer < 1) {
err = -1;
}
}
/* parsing may have allocated memory. free it. */
snmp_reset_var_buffers( &var_openserSIPRegUserLookupIndex );
return err;
}
示例5: saHpiSensorTable_extract_index
/*
* the *_extract_index routine
*/
int
saHpiSensorTable_extract_index (saHpiSensorTable_context * ctx,
netsnmp_index * hdr)
{
/*
* temporary local storage for extracting oid index
*/
netsnmp_variable_list var_saHpiDomainID;
netsnmp_variable_list var_saHpiResourceID;
netsnmp_variable_list var_saHpiSensorIndex;
int err;
/*
* 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)))
{
return -1;
}
ctx->index.len = hdr->len;
}
/**
* Create variable to hold each component of the index
*/
memset (&var_saHpiDomainID, 0x00, sizeof (var_saHpiDomainID));
var_saHpiDomainID.type = ASN_UNSIGNED;
var_saHpiDomainID.next_variable = &var_saHpiResourceID;
memset (&var_saHpiResourceID, 0x00, sizeof (var_saHpiResourceID));
var_saHpiResourceID.type = ASN_UNSIGNED;
var_saHpiResourceID.next_variable = &var_saHpiSensorIndex;
memset (&var_saHpiSensorIndex, 0x00, sizeof (var_saHpiSensorIndex));
var_saHpiSensorIndex.type = ASN_UNSIGNED;
var_saHpiSensorIndex.next_variable = NULL;
/*
* parse the oid into the individual components
*/
err = parse_oid_indexes (hdr->oids, hdr->len, &var_saHpiDomainID);
if (err == SNMP_ERR_NOERROR)
{
ctx->saHpiSensorIndex = *var_saHpiSensorIndex.val.integer;
}
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers (&var_saHpiDomainID);
return err;
}
示例6: dot11WtpDataPktsTable_index_from_oid
/**
* extract dot11WtpDataPktsTable indexes from a netsnmp_index
*
* @retval SNMP_ERR_NOERROR : no error
* @retval SNMP_ERR_GENERR : error
*/
int
dot11WtpDataPktsTable_index_from_oid(netsnmp_index *oid_idx,
dot11WtpDataPktsTable_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;
/*
* set up varbinds
*/
memset( &var_wtpMacAddr, 0x00, sizeof(var_wtpMacAddr) );
var_wtpMacAddr.type = ASN_OCTET_STR;
/*
* chain temp index varbinds together
*/
var_wtpMacAddr.next_variable = NULL;
DEBUGMSGTL(("verbose:dot11WtpDataPktsTable:dot11WtpDataPktsTable_index_from_oid","called\n"));
/*
* parse the oid into the individual index components
*/
err = parse_oid_indexes( oid_idx->oids, oid_idx->len,
&var_wtpMacAddr );
if (err == SNMP_ERR_NOERROR) {
/*
* copy out values
*/
/*
* NOTE: val_len is in bytes, wtpMacAddr_len might not be
*/
if(var_wtpMacAddr.val_len > sizeof(mib_idx->wtpMacAddr))
err = SNMP_ERR_GENERR;
else {
memcpy(mib_idx->wtpMacAddr, var_wtpMacAddr.val.string, var_wtpMacAddr.val_len);
mib_idx->wtpMacAddr_len = var_wtpMacAddr.val_len / sizeof(mib_idx->wtpMacAddr[0]);
}
}
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers( &var_wtpMacAddr );
return err;
} /* dot11WtpDataPktsTable_index_from_oid */
示例7: dot11WtpIfTable_index_to_oid
/**
* @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 */
示例8: sctpAssocLocalAddrTable_entry_update_index
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;
}
示例9: ipv6ScopeZoneIndexTable_index_from_oid
/**
* extract ipv6ScopeZoneIndexTable indexes from a netsnmp_index
*
* @retval SNMP_ERR_NOERROR : no error
* @retval SNMP_ERR_GENERR : error
*/
int
ipv6ScopeZoneIndexTable_index_from_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_from_oid", "called\n"));
/*
* parse the oid into the individual index components
*/
err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
&var_ipv6ScopeZoneIndexIfIndex);
if (err == SNMP_ERR_NOERROR) {
/*
* copy out values
*/
mib_idx->ipv6ScopeZoneIndexIfIndex =
*((long *) var_ipv6ScopeZoneIndexIfIndex.val.string);
}
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers(&var_ipv6ScopeZoneIndexIfIndex);
return err;
} /* ipv6ScopeZoneIndexTable_index_from_oid */
示例10: jmfcNamespaceHttpServerTable_index_to_oid
/**
* @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 */
示例11: ipv6ScopeZoneIndexTable_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 */
示例12: dot11SsidTeminalTable_index_from_oid
/**
* extract dot11SsidTeminalTable indexes from a netsnmp_index
*
* @retval SNMP_ERR_NOERROR : no error
* @retval SNMP_ERR_GENERR : error
*/
int
dot11SsidTeminalTable_index_from_oid(netsnmp_index *oid_idx,
dot11SsidTeminalTable_mib_index *mib_idx)
{
int err = SNMP_ERR_NOERROR;
/*
* temp storage for parsing indexes
*/
/*
* wlanCurrID(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
*/
netsnmp_variable_list var_wlanCurrID;
/*
* set up varbinds
*/
memset( &var_wlanCurrID, 0x00, sizeof(var_wlanCurrID) );
var_wlanCurrID.type = ASN_INTEGER;
/*
* chain temp index varbinds together
*/
var_wlanCurrID.next_variable = NULL;
DEBUGMSGTL(("verbose:dot11SsidTeminalTable:dot11SsidTeminalTable_index_from_oid","called\n"));
/*
* parse the oid into the individual index components
*/
err = parse_oid_indexes( oid_idx->oids, oid_idx->len,
&var_wlanCurrID );
if (err == SNMP_ERR_NOERROR) {
/*
* copy out values
*/
mib_idx->wlanCurrID = *((long *)var_wlanCurrID.val.string);
}
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers( &var_wlanCurrID );
return err;
} /* dot11SsidTeminalTable_index_from_oid */
示例13: ituAlarmTable_index_to_oid
/************************************************************
*
* 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;
}
示例14: dessertAppStatsTable_index_to_oid
/**
* @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 */
示例15: alarmModelTable_index_to_oid
/************************************************************
*
* 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;
}