本文整理汇总了C++中snmp_reset_var_buffers函数的典型用法代码示例。如果您正苦于以下问题:C++ snmp_reset_var_buffers函数的具体用法?C++ snmp_reset_var_buffers怎么用?C++ snmp_reset_var_buffers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmp_reset_var_buffers函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 */
开发者ID:grantc,项目名称:ingres-snmp-agent,代码行数:64,代码来源:dmfTable_interface.c
示例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;
}
开发者ID:Undrizzle,项目名称:apps,代码行数:32,代码来源:sctpAssocTable.c
示例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;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:68,代码来源:saHpiAutoInsertTimeoutTable.c
示例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;
}
开发者ID:alias-neo,项目名称:opensips,代码行数:74,代码来源:openserSIPRegUserLookupTable.c
示例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;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:61,代码来源:saHpiSensorTable.c
示例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 */
开发者ID:inibir,项目名称:daemongroup,代码行数:63,代码来源:dot11WtpDataPktsTable_interface.c
示例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 */
开发者ID:inibir,项目名称:daemongroup,代码行数:59,代码来源:dot11WtpIfTable_interface.c
示例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;
}
开发者ID:prak5192,项目名称:C_Project,代码行数:53,代码来源:sctpAssocLocalAddrTable.c
示例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 */
开发者ID:duniansampa,项目名称:SigLog,代码行数:58,代码来源:ipv6ScopeZoneIndexTable_interface.cpp
示例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 */
开发者ID:skizhak,项目名称:open-media-flow-controller,代码行数:54,代码来源:jmfcNamespaceHttpServerTable_interface.c
示例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 */
开发者ID:duniansampa,项目名称:SigLog,代码行数:54,代码来源:ipv6ScopeZoneIndexTable_interface.cpp
示例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 */
开发者ID:inibir,项目名称:daemongroup,代码行数:55,代码来源:dot11SsidTeminalTable_interface.c
示例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;
}
开发者ID:AiprNick,项目名称:clearwater-snmp-handlers,代码行数:52,代码来源:itu_alarm_table.cpp
示例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 */
开发者ID:Dekue,项目名称:libdessert,代码行数:52,代码来源:dessertAppStatsTable_interface.c
示例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;
}
开发者ID:LoveleshPandya,项目名称:clearwater-snmp-handlers,代码行数:52,代码来源:alarm_model_table.cpp
示例16: memset
void AlarmTrapSender::send_trap(AlarmTableDef& alarm_table_def)
{
static const oid snmp_trap_oid[] = {1,3,6,1,6,3,1,1,4,1,0};
static const oid clear_oid[] = {1,3,6,1,2,1,118,0,3};
static const oid active_oid[] = {1,3,6,1,2,1,118,0,2};
static const oid model_ptr_oid[] = {1,3,6,1,2,1,118,1,2,2,1,13,0};
static const oid model_row_oid[] = {1,3,6,1,2,1,118,1,1,2,1,3,0,1,2};
static const oid resource_id_oid[] = {1,3,6,1,2,1,118,1,2,2,1,10,0};
static const oid zero_dot_zero[] = {0,0};
netsnmp_variable_list var_trap;
netsnmp_variable_list var_model_row;
netsnmp_variable_list var_resource_id;
memset(&var_trap, 0x00, sizeof(var_trap));
memset(&var_model_row, 0x00, sizeof(var_model_row));
memset(&var_resource_id, 0x00, sizeof(var_resource_id));
var_trap.next_variable = &var_model_row;
var_model_row.next_variable = &var_resource_id;
var_resource_id.next_variable = NULL;
snmp_set_var_objid(&var_trap, snmp_trap_oid, OID_LENGTH(snmp_trap_oid));
if (alarm_table_def.severity() == AlarmDef::CLEARED)
{
snmp_set_var_typed_value(&var_trap, ASN_OBJECT_ID, (u_char*) clear_oid, sizeof(clear_oid));
}
else
{
snmp_set_var_typed_value(&var_trap, ASN_OBJECT_ID, (u_char*) active_oid, sizeof(active_oid));
}
snmp_set_var_objid(&var_model_row, model_ptr_oid, OID_LENGTH(model_ptr_oid));
snmp_set_var_typed_value(&var_model_row, ASN_OBJECT_ID, (u_char*) model_row_oid, sizeof(model_row_oid));
var_model_row.val.objid[ALARMMODELTABLEROW_INDEX] = alarm_table_def.index();
var_model_row.val.objid[ALARMMODELTABLEROW_STATE] = alarm_table_def.state();
snmp_set_var_objid(&var_resource_id, resource_id_oid, OID_LENGTH(resource_id_oid));
snmp_set_var_typed_value(&var_resource_id, ASN_OBJECT_ID, (u_char*) zero_dot_zero, sizeof(zero_dot_zero));
send_v2trap(&var_trap);
snmp_reset_var_buffers(&var_trap);
}
开发者ID:AiprNick,项目名称:clearwater-snmp-handlers,代码行数:47,代码来源:alarm_trap_sender.cpp
示例17: saHpiEventTable_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
saHpiEventTable_extract_index( saHpiEventTable_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_saHpiEventRowPointer;
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_saHpiEventRowPointer, 0x00, sizeof(var_saHpiEventRowPointer) );
var_saHpiEventRowPointer.type = ASN_OBJECT_ID; /* type hint for parse_oid_indexes */
/** TODO: link this index to the next, or NULL for the last one */
var_saHpiEventRowPointer.next_variable = NULL;
memcpy(ctx->saHpiEventRowPointer, hdr->oids, hdr->len * sizeof(oid));
ctx->saHpiEventRowPointer_len = hdr->len;
err = SNMP_ERR_NOERROR;
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers( &var_saHpiEventRowPointer );
return err;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:55,代码来源:saHpiEventTable.c
示例18: dot11SsidTeminalTable_index_to_oid
/**
* @internal
* convert the index component stored in the context to an oid
*/
int
dot11SsidTeminalTable_index_to_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_to_oid","called\n"));
/* wlanCurrID(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */
snmp_set_var_value(&var_wlanCurrID, (u_char*)&mib_idx->wlanCurrID,
sizeof(mib_idx->wlanCurrID));
err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
NULL, 0, &var_wlanCurrID);
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_wlanCurrID );
return err;
} /* dot11SsidTeminalTable_index_to_oid */
开发者ID:inibir,项目名称:daemongroup,代码行数:49,代码来源:dot11SsidTeminalTable_interface.c
示例19: dot11WtpWAPIPerformanceStatsTable_index_to_oid
/**
* @internal
* convert the index component stored in the context to an oid
*/
int
dot11WtpWAPIPerformanceStatsTable_index_to_oid(netsnmp_index *oid_idx,
dot11WtpWAPIPerformanceStatsTable_mib_index *mib_idx)
{
int err = SNMP_ERR_NOERROR;
/*
* temp storage for parsing indexes
*/
/*
* staMacAddr(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
*/
netsnmp_variable_list var_staMacAddr;
/*
* set up varbinds
*/
memset( &var_staMacAddr, 0x00, sizeof(var_staMacAddr) );
var_staMacAddr.type = ASN_OCTET_STR;
/*
* chain temp index varbinds together
*/
var_staMacAddr.next_variable = NULL;
DEBUGMSGTL(("verbose:dot11WtpWAPIPerformanceStatsTable:dot11WtpWAPIPerformanceStatsTable_index_to_oid","called\n"));
/* staMacAddr(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */
snmp_set_var_value(&var_staMacAddr, (u_char*)&mib_idx->staMacAddr,
mib_idx->staMacAddr_len * sizeof(mib_idx->staMacAddr[0]));
err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
NULL, 0, &var_staMacAddr);
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_staMacAddr );
return err;
} /* dot11WtpWAPIPerformanceStatsTable_index_to_oid */
开发者ID:kkcloudy,项目名称:daemongroup,代码行数:49,代码来源:dot11WtpWAPIPerformanceStatsTable_interface.c
示例20: pgsqlPgAmTable_index_from_oid
/**
* extract pgsqlPgAmTable indexes from a netsnmp_index
*
* @retval SNMP_ERR_NOERROR : no error
* @retval SNMP_ERR_GENERR : error
*/
int
pgsqlPgAmTable_index_from_oid(netsnmp_index *oid_idx,
pgsqlPgAmTable_mib_index *mib_idx)
{
int err = SNMP_ERR_NOERROR;
/*
* temp storage for parsing indexes
*/
/*
* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H
*/
netsnmp_variable_list var_pgsnmpdConnID;
/*
* rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h
*/
netsnmp_variable_list var_rdbmsDbIndex;
/*
* pgsqlPgAmEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h
*/
netsnmp_variable_list var_pgsqlPgAmEntryOID;
/*
* set up varbinds
*/
memset( &var_pgsnmpdConnID, 0x00, sizeof(var_pgsnmpdConnID) );
var_pgsnmpdConnID.type = ASN_OCTET_STR;
memset( &var_rdbmsDbIndex, 0x00, sizeof(var_rdbmsDbIndex) );
var_rdbmsDbIndex.type = ASN_INTEGER;
memset( &var_pgsqlPgAmEntryOID, 0x00, sizeof(var_pgsqlPgAmEntryOID) );
var_pgsqlPgAmEntryOID.type = ASN_INTEGER;
/*
* chain temp index varbinds together
*/
var_pgsnmpdConnID.next_variable = &var_rdbmsDbIndex; var_rdbmsDbIndex.next_variable = &var_pgsqlPgAmEntryOID; var_pgsqlPgAmEntryOID.next_variable = NULL;
DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_index_from_oid","called\n"));
/*
* parse the oid into the individual index components
*/
err = parse_oid_indexes( oid_idx->oids, oid_idx->len,
&var_pgsnmpdConnID );
if (err == SNMP_ERR_NOERROR) {
/*
* copy out values
*/
/*
* NOTE: val_len is in bytes, pgsnmpdConnID_len might not be
*/
if(var_pgsnmpdConnID.val_len > sizeof(mib_idx->pgsnmpdConnID))
err = SNMP_ERR_GENERR;
else {
memcpy(mib_idx->pgsnmpdConnID, var_pgsnmpdConnID.val.string, var_pgsnmpdConnID.val_len);
mib_idx->pgsnmpdConnID_len = var_pgsnmpdConnID.val_len / sizeof(mib_idx->pgsnmpdConnID[0]);
}
mib_idx->rdbmsDbIndex = *((long *)var_rdbmsDbIndex.val.string);
mib_idx->pgsqlPgAmEntryOID = *((long *)var_pgsqlPgAmEntryOID.val.string);
}
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers( &var_pgsnmpdConnID );
return err;
} /* pgsqlPgAmTable_index_from_oid */
开发者ID:GunioRobot,项目名称:pgsnmpd,代码行数:77,代码来源:pgsqlPgAmTable_interface.c
|
请发表评论