本文整理汇总了C++中CONTAINER_FIND函数的典型用法代码示例。如果您正苦于以下问题:C++ CONTAINER_FIND函数的具体用法?C++ CONTAINER_FIND怎么用?C++ CONTAINER_FIND使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CONTAINER_FIND函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: update_watchdog_row
int
update_watchdog_row (SaHpiDomainIdT domain_id,
SaHpiResourceIdT resource_id,
SaHpiWatchdogNumT num, SaHpiWatchdogEventT * wdog)
{
saHpiWatchdogTable_context *ctx;
oid index_oid[WATCHDOG_INDEX_NR];
netsnmp_index index;
// Look at the MIB to find out what the indexs are
index_oid[0] = domain_id;
index_oid[1] = resource_id;
index_oid[2] = num;
// Possible more indexes?
index.oids = (oid *) & index_oid;
index.len = WATCHDOG_INDEX_NR;
ctx = CONTAINER_FIND (cb.container, &index);
if (ctx)
{
ctx->saHpiWatchdogTimerUse = wdog->WatchdogUse + 1;
ctx->saHpiWatchdogTimerAction = wdog->WatchdogAction + 1;
ctx->saHpiWatchdogPretimerInterrupt = wdog->WatchdogPreTimerAction + 1;
return AGENT_ERR_NOERROR;
}
return AGENT_ERR_NOT_FOUND;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:29,代码来源:saHpiWatchdogTable.c
示例2: ipv4InterfaceTable_row_find_by_mib_index
ipv4InterfaceTable_rowreq_ctx *
ipv4InterfaceTable_row_find_by_mib_index(ipv4InterfaceTable_mib_index *
mib_idx)
{
ipv4InterfaceTable_rowreq_ctx *rowreq_ctx;
oid oid_tmp[MAX_OID_LEN];
netsnmp_index oid_idx;
int rc;
/*
* set up storage for OID
*/
oid_idx.oids = oid_tmp;
oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
/*
* convert
*/
rc = ifTable_index_to_oid(&oid_idx, mib_idx);
if (MFD_SUCCESS != rc)
return NULL;
rowreq_ctx =
CONTAINER_FIND(ipv4InterfaceTable_if_ctx.container, &oid_idx);
return rowreq_ctx;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:27,代码来源:ipv4InterfaceTable_interface.c
示例3: clear_domain_info_entry
/**
*
* @sessionid
*
* @return
*/
SaErrorT clear_domain_info_entry(SaHpiDomainIdT domain_id)
{
SaErrorT rv = SA_OK;
netsnmp_index *row_idx;
saHpiDomainInfoTable_context *ctx;
DEBUGMSGTL ((AGENT, "clear_domain_info_entry, called\n"));
DEBUGMSGTL ((AGENT, " domainId [%d]\n", domain_id));
row_idx = CONTAINER_FIRST(cb.container);
if (row_idx) //At least one entry was found.
{
do {
ctx = CONTAINER_FIND(cb.container, row_idx);
row_idx = CONTAINER_NEXT(cb.container, row_idx);
if (ctx->index.oids[saHpiDomainId_INDEX] == domain_id) {
/* all conditions met remove row */
CONTAINER_REMOVE (cb.container, ctx);
saHpiDomainInfoTable_delete_row (ctx);
domain_info_entry_count =
CONTAINER_SIZE (cb.container);
DEBUGMSGTL ((AGENT, "clear_domain_info_entry:"
" found row: removing\n"));
}
} while (row_idx);
}
return rv;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:39,代码来源:saHpiDomainInfoTable.c
示例4: delete_hotswap_row
int
delete_hotswap_row (SaHpiDomainIdT domain_id, SaHpiResourceIdT resource_id)
{
saHpiHotSwapTable_context *ctx;
oid hotswap_oid[HOTSWAP_INDEX_NR];
netsnmp_index hotswap_index;
int rc = AGENT_ERR_NOT_FOUND;
DEBUGMSGTL ((AGENT, "delete_hotswap_row (%d, %d). Entry\n",
domain_id, resource_id));
hotswap_oid[0] = domain_id;
hotswap_oid[1] = resource_id;
// Possible more indexs?
hotswap_index.oids = (oid *) & hotswap_oid;
hotswap_index.len = HOTSWAP_INDEX_NR;
ctx = CONTAINER_FIND (cb.container, &hotswap_index);
if (ctx)
{
CONTAINER_REMOVE (cb.container, ctx);
saHpiHotSwapTable_delete_row (ctx);
rc = AGENT_ERR_NOERROR;
}
DEBUGMSGTL ((AGENT, "delete_hotswap_row. Exit (rc: %d).\n", rc));
return rc;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:31,代码来源:saHpiHotSwapTable.c
示例5: delete_watchdog_row
int
delete_watchdog_row (SaHpiDomainIdT domain_id,
SaHpiResourceIdT resource_id, SaHpiWatchdogNumT num)
{
saHpiWatchdogTable_context *ctx;
oid index_oid[WATCHDOG_INDEX_NR];
netsnmp_index index;
int rc = AGENT_ERR_NOT_FOUND;
DEBUGMSGTL ((AGENT, "delete_watchdog_row (%d, %d, %d). Entry.\n",
domain_id, resource_id, num));
// Look at the MIB to find out what the indexs are
index_oid[0] = domain_id;
index_oid[1] = resource_id;
index_oid[2] = num;
// Possible more indexes?
index.oids = (oid *) & index_oid;
index.len = WATCHDOG_INDEX_NR;
ctx = CONTAINER_FIND (cb.container, &index);
if (ctx)
{
CONTAINER_REMOVE (cb.container, ctx);
saHpiWatchdogTable_delete_row (ctx);
watchdog_count = CONTAINER_SIZE (cb.container);
rc = AGENT_ERR_NOERROR;
}
DEBUGMSGTL ((AGENT, "delete_watchdog_row. Exit (rc: %d).\n", rc));
return rc;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:32,代码来源:saHpiWatchdogTable.c
示例6: delete_ThdPosHysteresis_row
int
delete_ThdPosHysteresis_row (SaHpiDomainIdT domain_id,
SaHpiResourceIdT resource_id,
SaHpiSensorNumT sensor_num)
{
saHpiSensorThdPosHysteresisTable_context *ctx;
oid index_oid[SENSOR_THD_INDEX_NR];
netsnmp_index sensor_reading_index;
int rc = AGENT_ERR_NOT_FOUND;
DEBUGMSGTL ((AGENT, "delete_ThdPosHysteresis_row (%d, %d, %d). Entry.\n",
domain_id, resource_id, sensor_num));
// Look at the MIB to find out what the indexs are
index_oid[0] = domain_id;
index_oid[1] = resource_id;
index_oid[2] = sensor_num;
// Possible more indexs?
sensor_reading_index.oids = (oid *) & index_oid;
sensor_reading_index.len = SENSOR_THD_INDEX_NR;
ctx = CONTAINER_FIND (cb.container, &sensor_reading_index);
if (ctx)
{
CONTAINER_REMOVE (cb.container, ctx);
saHpiSensorThdPosHysteresisTable_delete_row (ctx);
rc = AGENT_ERR_NOERROR;
}
DEBUGMSGTL ((AGENT, "delete_ThdPosHysteresis_row. Exit (rc: %d).\n", rc));
return rc;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:33,代码来源:saHpiSensorThdPosHysteresisTable.c
示例7: deleteContactRow
/*
* Removes the row indexed by userIndex and contactIndex, and free's up the
* memory allocated to it. If the row could not be found, then nothing is done.
*/
void deleteContactRow(int userIndex, int contactIndex)
{
openserSIPContactTable_context *theRow;
netsnmp_index indexToRemove;
oid indexToRemoveOID[2];
/* Form the OID Index of the row so we can search for it */
indexToRemoveOID[0] = userIndex;
indexToRemoveOID[1] = contactIndex;
indexToRemove.oids = indexToRemoveOID;
indexToRemove.len = 2;
theRow = CONTAINER_FIND(cb.container, &indexToRemove);
/* The ContactURI is shared memory, the index.oids was allocated from
* pkg_malloc(), and theRow was made with the NetSNMP API which uses
* malloc() */
if (theRow != NULL) {
CONTAINER_REMOVE(cb.container, &indexToRemove);
pkg_free(theRow->openserSIPContactURI);
pkg_free(theRow->index.oids);
free(theRow);
}
}
开发者ID:UIKit0,项目名称:OpenSIPS,代码行数:29,代码来源:openserSIPContactTable.c
示例8: update_hotswap_event
int
update_hotswap_event (SaHpiDomainIdT domain_id,
SaHpiResourceIdT resource_id,
SaHpiHotSwapEventT * event)
{
saHpiHotSwapTable_context *ctx;
oid hotswap_oid[HOTSWAP_INDEX_NR];
netsnmp_index hotswap_index;
int rc = AGENT_ERR_NOT_FOUND;
hotswap_oid[0] = domain_id;
hotswap_oid[1] = resource_id;
// Possible more indexs?
hotswap_index.oids = (oid *) & hotswap_oid;
hotswap_index.len = HOTSWAP_INDEX_NR;
ctx = CONTAINER_FIND (cb.container, &hotswap_index);
if (ctx)
{
ctx->saHpiHotSwapState = event->HotSwapState + 1;
ctx->saHpiHotSwapPreviousState = event->PreviousHotSwapState + 1;
rc = AGENT_ERR_NOERROR;
}
return rc;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:29,代码来源:saHpiHotSwapTable.c
示例9: put_memTable
void
put_memTable(int idx, char* name, int total, int avail, int used, int usage)
{
netsnmp_index index;
oid myoid;
memTable_context* myrow;
int makeit=0;
myoid = idx;
index.oids = &myoid;
index.len = 1;
if(!(myrow = (memTable_context*)CONTAINER_FIND(cb.container, &index))) {
myrow = memTable_create_row(&index); makeit=1;
}
myrow->memIndex = idx;
strcpy(myrow->memSystem, name);
myrow->memSystem_len = strlen(name);
myrow->memTotal = total;
myrow->memAvail = avail;
myrow->memUsed = used;
myrow->memUsage = usage;
if(makeit) CONTAINER_INSERT(cb.container,myrow);
}
开发者ID:lanian09,项目名称:mysource,代码行数:26,代码来源:memTable.c
示例10: _cert_map_tweak_storage
static void
_cert_map_tweak_storage(certToTSN_entry *entry)
{
netsnmp_container *maps;
netsnmp_cert_map *map, index;
if (NULL == entry)
return;
DEBUGMSGTL(("tlstmCertToTSNTable:map:tweak", "pri %ld, st %d\n",
entry->tlstmCertToTSNID, entry->storageType));
/** get current active maps */
maps = netsnmp_cert_map_container();
if (NULL == maps)
return;
index.priority = entry->tlstmCertToTSNID;
map = CONTAINER_FIND(maps, &index);
if (NULL == map) {
DEBUGMSGTL(("tlstmCertToTSNTable:map:tweak", "couldn't find map!\n"));
return;
}
if (entry->storageType == ST_NONVOLATILE)
map->flags |= NSCM_NONVOLATILE;
else
map->flags &= ~NSCM_NONVOLATILE;
}
开发者ID:RasmusKoldsoe,项目名称:performand.k70.2,代码行数:29,代码来源:snmpTlstmCertToTSNTable.c
示例11: deleteRegUserRow
/* Removes an SNMP row indexed by userIndex, and frees the string and index it
* pointed to. */
void deleteRegUserRow(int userIndex)
{
openserSIPRegUserTable_context *theRow;
netsnmp_index indexToRemove;
oid indexToRemoveOID;
indexToRemoveOID = userIndex;
indexToRemove.oids = &indexToRemoveOID;
indexToRemove.len = 1;
theRow = CONTAINER_FIND(cb.container, &indexToRemove);
/* The userURI is shared memory, the index.oids was allocated from
* pkg_malloc(), and theRow was made with the NetSNMP API which uses
* malloc() */
if (theRow != NULL) {
CONTAINER_REMOVE(cb.container, &indexToRemove);
pkg_free(theRow->openserSIPUserUri);
pkg_free(theRow->index.oids);
free(theRow);
}
}
开发者ID:iamroger,项目名称:voip,代码行数:27,代码来源:openserSIPRegUserTable.c
示例12: netSnmpIETFWGTable_get_by_idx
/************************************************************
* netSnmpIETFWGTable_get_by_idx
*/
const netSnmpIETFWGTable_context *
netSnmpIETFWGTable_get_by_idx(netsnmp_index * hdr)
{
DEBUGMSGTL((AGENT,"netSnmpIETFWGTable_get_by_idx"));
return (const netSnmpIETFWGTable_context *)
CONTAINER_FIND(cb.container, hdr);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:10,代码来源:netSnmpIETFWGTable.c
示例13: saHpiRdrTable_get_by_idx
/************************************************************
* saHpiRdrTable_get_by_idx
*/
const saHpiRdrTable_context *
saHpiRdrTable_get_by_idx(netsnmp_index * hdr)
{
DEBUGMSGTL ((AGENT, "saHpiRdrTable_get_by_idx, called\n"));
return (const saHpiRdrTable_context *)
CONTAINER_FIND(cb.container, hdr );
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:11,代码来源:saHpiRdrTable.c
示例14: saHpiSensorThdNegHysteresisTable_get_by_idx
/************************************************************
* saHpiSensorThdNegHysteresisTable_get_by_idx
*/
const saHpiSensorThdNegHysteresisTable_context *
saHpiSensorThdNegHysteresisTable_get_by_idx(netsnmp_index * hdr)
{
DEBUGMSGTL ((AGENT, "saHpiSensorThdNegHysteresisTable_get_by_idx called\n"));
return(const saHpiSensorThdNegHysteresisTable_context *)
CONTAINER_FIND(cb.container, hdr );
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:11,代码来源:saHpiSensorThdNegHysteresisTable.c
示例15: debug_is_token_registered
/*
* debug_is_token_registered(char *TOKEN):
*
* returns SNMPERR_SUCCESS
* or SNMPERR_GENERR
*
* if TOKEN has been registered and debugging support is turned on.
*/
int
debug_is_token_registered(const char *token)
{
int i, rc;
/*
* debugging flag is on or off
*/
if (!dodebug)
return SNMPERR_GENERR;
if (debug_num_tokens == 0 || debug_print_everything) {
/*
* no tokens specified, print everything
* (unless something might be excluded)
*/
if (debug_num_excluded) {
rc = SNMPERR_SUCCESS; /* ! found = success */
} else {
return SNMPERR_SUCCESS;
}
}
else
rc = SNMPERR_GENERR; /* ! found = err */
for (i = 0; i < debug_num_tokens; i++) {
if (SNMP_DEBUG_DISABLED == dbg_tokens[i].enabled)
continue;
if (dbg_tokens[i].token_name &&
strncmp(dbg_tokens[i].token_name, token,
strlen(dbg_tokens[i].token_name)) == 0) {
if (SNMP_DEBUG_ACTIVE == dbg_tokens[i].enabled)
return SNMPERR_SUCCESS; /* active */
else
return SNMPERR_GENERR; /* excluded */
}
}
#ifdef NETSNMP_DEBUG_STATS
if ((SNMPERR_SUCCESS == rc) && (NULL != dbg_stats)) {
netsnmp_token_descr td, *found;
td.token_name = token;
found = CONTAINER_FIND(dbg_stats, &td);
if (NULL == found) {
found = SNMP_MALLOC_TYPEDEF(netsnmp_token_descr);
netsnmp_assert(NULL != found);
found->token_name = strdup(token);
netsnmp_assert(0 == found->enabled);
CONTAINER_INSERT(dbg_stats, found);
}
++found->enabled;
/* snmp_log(LOG_ERR,"tok %s, %d hits\n", token, found->enabled); */
}
#endif
return rc;
}
开发者ID:Undrizzle,项目名称:apps,代码行数:66,代码来源:snmp_debug.c
示例16: return
/** finds a row in the 'tdata' table given the index OID */
netsnmp_tdata_row *netsnmp_tdata_row_get_byoid (netsnmp_tdata * table, oid * searchfor, size_t searchfor_len)
{
netsnmp_index index;
if (!table)
return NULL;
index.oids = searchfor;
index.len = searchfor_len;
return (netsnmp_tdata_row *) CONTAINER_FIND (table->container, &index);
}
开发者ID:274914765,项目名称:C,代码行数:12,代码来源:table_tdata.c
示例17: populate_hotswap
int
populate_hotswap (SaHpiRptEntryT * rpt_entry,
oid * rpt_oid, size_t rpt_oid_len)
{
SaHpiSessionIdT session_id;
int rc = AGENT_ERR_NOERROR;
oid index_oid[HOTSWAP_INDEX_NR];
netsnmp_index hotswap_index;
saHpiHotSwapTable_context *hotswap_context;
DEBUGMSGTL ((AGENT, "\n\t--- populate_hotswap. Entry\n"));
if ((rc = getSaHpiSession (&session_id)) == AGENT_ERR_NOERROR)
{
index_oid[0] = rpt_entry->DomainId;
index_oid[1] = rpt_entry->ResourceId;
hotswap_index.oids = (oid *) & index_oid;
hotswap_index.len = HOTSWAP_INDEX_NR;
hotswap_context = CONTAINER_FIND (cb.container, &hotswap_index);
if (!hotswap_context)
{
// Couldn't find it. Add new entry.
hotswap_context = saHpiHotSwapTable_create_row (&hotswap_index);
}
if (!hotswap_context)
{
snmp_log (LOG_ERR, "Not enough memory for a HotSwap row!\n");
return AGENT_ERR_MEMORY_FAULT;
}
if (saHpiHotSwapTable_modify_context (rpt_entry,
rpt_oid,
rpt_oid_len,
hotswap_context)
== AGENT_NEW_ENTRY)
{
CONTAINER_INSERT (cb.container, hotswap_context);
}
}
DEBUGMSGTL ((AGENT, "\n\t--- populate_hotswap: Exit (rc: %d).\n", rc));
return rc;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:53,代码来源:saHpiHotSwapTable.c
示例18: createIndex
/* Will return an existing row indexed by the parameter list if one exists, and
* return a new one otherwise. If the row is new, then the provided index will be
* assigned to the new row.
*
* Note: NULL will be returned on an error
*/
openserSIPPortTable_context *getRow(int ipType, int *ipAddress)
{
int lengthOfOID;
oid *currentOIDIndex = createIndex(ipType, ipAddress, &lengthOfOID);
if (currentOIDIndex == NULL)
{
return NULL;
}
netsnmp_index theIndex;
theIndex.oids = currentOIDIndex;
theIndex.len = lengthOfOID;
openserSIPPortTable_context *rowToReturn;
/* Lets check to see if there is an existing row. */
rowToReturn = CONTAINER_FIND(cb.container, &theIndex);
/* We found an existing row, so there is no need to create a new one.
* Let's return it to the caller. */
if (rowToReturn != NULL)
{
/* We don't need the index we allocated anymore, because the
* existing row already has its own copy, so free the memory */
pkg_free(currentOIDIndex);
return rowToReturn;
}
/* If we are here then the row doesn't exist yet. So lets create it. */
rowToReturn = SNMP_MALLOC_TYPEDEF(openserSIPPortTable_context);
/* Not enough memory to create the new row. */
if (rowToReturn == NULL) {
pkg_free(currentOIDIndex);
return NULL;
}
/* Assign the Container Index. */
rowToReturn->index.len = lengthOfOID;
rowToReturn->index.oids = currentOIDIndex;
memcpy(rowToReturn->openserSIPStringIndex, currentOIDIndex, NUM_IP_OCTETS + 3);
rowToReturn->openserSIPStringIndex_len = NUM_IP_OCTETS + 3;
/* Insert the new row into the table */
CONTAINER_INSERT(cb.container, rowToReturn);
return rowToReturn;
}
开发者ID:KISSMonX,项目名称:opensips,代码行数:58,代码来源:openserSIPPortTable.c
示例19: _check_for_updates
/**
* check entry for update
*/
static void
_check_for_updates(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
netsnmp_container *stats)
{
netsnmp_systemstats_entry *ifstats_entry;
/*
* check for matching entry. works because indexes are the same.
*/
ifstats_entry = (netsnmp_systemstats_entry*)CONTAINER_FIND(stats, rowreq_ctx->data);
if (NULL == ifstats_entry) {
DEBUGMSGTL(("ipIfStatsTable:access",
"updating missing entry\n"));
/*
* mark row as missing, so we can set discontinuity
* when it comes back.
*
* what else should we do? set refresh to 0? that's not quite right...
*/
rowreq_ctx->known_missing = 1;
} else {
DEBUGMSGTL(("ipIfStatsTable:access",
"updating existing entry\n"));
/*
* Check for changes & update
*/
netsnmp_access_systemstats_entry_update(rowreq_ctx->data,
ifstats_entry);
/*
* set discontinuity if previously missing.
*/
if (1 == rowreq_ctx->known_missing) {
rowreq_ctx->known_missing = 0;
rowreq_ctx->ipIfStatsDiscontinuityTime =
netsnmp_get_agent_uptime();
ipIfStatsTable_lastChange_set(netsnmp_get_agent_uptime());
}
/*
* remove entry from container
*/
CONTAINER_REMOVE(stats, ifstats_entry);
netsnmp_access_systemstats_entry_free(ifstats_entry);
}
}
开发者ID:liquidradio,项目名称:net-snmp,代码行数:51,代码来源:ipIfStatsTable_data_access.c
示例20: netsnmp_access_systemstats_entry_get_by_index
netsnmp_systemstats_entry *
netsnmp_access_systemstats_entry_get_by_index(netsnmp_container *container, oid index)
{
netsnmp_index tmp;
DEBUGMSGTL(("access:systemstats:entry", "by_index\n"));
if (NULL == container) {
snmp_log(LOG_ERR,
"invalid container for netsnmp_access_systemstats_entry_get_by_index\n");
return NULL;
}
tmp.len = 1;
tmp.oids = &index;
return (netsnmp_systemstats_entry *) CONTAINER_FIND(container, &tmp);
}
开发者ID:schestowitz,项目名称:Cyrus,代码行数:18,代码来源:systemstats_common.c
注:本文中的CONTAINER_FIND函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论