当前位置: 首页>>代码示例>>C++>>正文


C++ snmp_set_var_typed_integer函数代码示例

本文整理汇总了C++中snmp_set_var_typed_integer函数的典型用法代码示例。如果您正苦于以下问题:C++ snmp_set_var_typed_integer函数的具体用法?C++ snmp_set_var_typed_integer怎么用?C++ snmp_set_var_typed_integer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了snmp_set_var_typed_integer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: expErrorTable_handler

/** handles requests for the expExpressionErrorTable table */
int
expErrorTable_handler(netsnmp_mib_handler *handler,
                      netsnmp_handler_registration *reginfo,
                      netsnmp_agent_request_info *reqinfo,
                      netsnmp_request_info *requests)
{

    netsnmp_request_info       *request;
    netsnmp_table_request_info *tinfo;
    struct expExpression       *entry;

    DEBUGMSGTL(("disman:expr:mib", "Expression Error Table handler (%d)\n",
                                    reqinfo->mode));

    switch (reqinfo->mode) {
        /*
         * Read-support (also covers GetNext requests)
         */
    case MODE_GET:
        for (request = requests; request; request = request->next) {
            entry = (struct expExpression *)
                    netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);
            if (!entry || !(entry->flags & EXP_FLAG_VALID))
                continue;

            /*
             * "Entries only appear in this table ... when there
             *  has been an error for that [matching] expression"
             */
            if (entry->expErrorCount == 0)
                continue;

            switch (tinfo->colnum) {
            case COLUMN_EXPERRORTIME:
                snmp_set_var_typed_integer(request->requestvb, ASN_TIMETICKS,
                                           entry->expErrorTime);
                break;
            case COLUMN_EXPERRORINDEX:
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
                                           entry->expErrorIndex);
                break;
            case COLUMN_EXPERRORCODE:
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
                                           entry->expErrorCode);
                break;
            case COLUMN_EXPERRORINSTANCE:
                snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
                              (u_char *) entry->expErrorInstance,
                                         entry->expErrorInst_len*sizeof(oid));
                break;
            }
        }
        break;
    }
    DEBUGMSGTL(("disman:expr:mib", "Expression Error handler - done \n"));
    return SNMP_ERR_NOERROR;
}
开发者ID:RasmusKoldsoe,项目名称:performand.k70.2,代码行数:59,代码来源:expErrorTable.c

示例2: psu_status_handler__

static void
psu_status_handler__(netsnmp_request_info *req,
                     uint32_t index,
                     onlp_snmp_sensor_t *ss )
{
    int value;
    onlp_psu_info_t *pi = &ss->sensor_info.pi;

    if (!ss->info_valid) {
        return;
    }

    value = ONLP_SNMP_SENSOR_STATUS_MISSING;
    if (pi->status & ONLP_PSU_STATUS_PRESENT) {
        value = ONLP_SNMP_SENSOR_STATUS_GOOD;

        /* failed or good is always reported */
        if (pi->status & ONLP_PSU_STATUS_FAILED) {
            value = ONLP_SNMP_SENSOR_STATUS_FAILED;
        }

        /* if additional unplugged status is reported */
        if (pi->status & ONLP_PSU_STATUS_UNPLUGGED) {
            value = ONLP_SNMP_SENSOR_STATUS_FAILED;
        }

    }

    snmp_set_var_typed_integer(req->requestvb,
                               ASN_INTEGER,
                               value);
}
开发者ID:Lewis-Kang,项目名称:OpenNetworkLinux,代码行数:32,代码来源:onlp_snmp_sensors.c

示例3: handle_autoRespawn

int
handle_autoRespawn(netsnmp_mib_handler *handler,
                          netsnmp_handler_registration *reginfo,
                          netsnmp_agent_request_info   *reqinfo,
                          netsnmp_request_info         *requests)
{
    /* We are never called for a GETNEXT if it's registered as a
       "instance", as it's "magically" handled for us.  */

    /* a instance handler also only hands us one request at a time, so
       we don't need to loop over a list of requests; we'll only get one. */
    
    switch(reqinfo->mode) {

        case MODE_GET:
            snmp_set_var_typed_integer(requests->requestvb, ASN_INTEGER,
            		cm->getGlobal()->get<ConfigBoolean>("auto-respawn")->read());
            
            break;


        default:
            /* we should never get here, so this is a really bad error */
            snmp_log(LOG_ERR, "unknown mode (%d) in handle_autoRespawn\n", reqinfo->mode );
            return SNMP_ERR_GENERR;
    }

    return SNMP_ERR_NOERROR;
}
开发者ID:BelledonneCommunications,项目名称:flexisip,代码行数:29,代码来源:flexisipMIB.c

示例4: delayed_response

//********************************************************************************
//********************************************************************************
static void delayed_response(unsigned int clientreg, void * clientarg)
{
    syslog(LOG_DEBUG, "Enter: delayed_response, %s.", HANDLER_NAME); 

    netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
    if(!netsnmp_handler_check_cache(cache))
    {
        syslog(LOG_ERR, "%s", "illegal call to return delayed response.");
        return;
    }
    syslog(LOG_DEBUG, "delayed_instance, continuing delayed request, mode = %d.",
        cache->reqinfo->mode);

    cache->requests->delegated = 0;

    switch(cache->reqinfo->mode)
    {
        case MODE_GET:
        case MODE_GETNEXT:
        int32_t redirect = redirect_count();
        snmp_set_var_typed_integer(cache->requests->requestvb,
            ASN_COUNTER, redirect);
    }
    netsnmp_free_delegated_cache(cache);

    syslog(LOG_DEBUG, "Exit: delayed_response, %s.", HANDLER_NAME); 
    syslog(LOG_DEBUG,"%s",
        "===============================================================");
    return;
}
开发者ID:BillTheBest,项目名称:laguna,代码行数:32,代码来源:redirectCount.cpp

示例5: misc_index_handler__

static void
misc_index_handler__(netsnmp_request_info *req,
                     uint32_t index,
                     onlp_snmp_sensor_t *ss)
{
    snmp_set_var_typed_integer(req->requestvb,
                               ASN_INTEGER,
                               index);
}
开发者ID:Lewis-Kang,项目名称:OpenNetworkLinux,代码行数:9,代码来源:onlp_snmp_sensors.c

示例6: handle_sysUpTime

static int
handle_sysUpTime(netsnmp_mib_handler *handler,
                   netsnmp_handler_registration *reginfo,
                   netsnmp_agent_request_info *reqinfo,
                   netsnmp_request_info *requests)
{
    snmp_set_var_typed_integer(requests->requestvb, ASN_TIMETICKS,
                               netsnmp_get_agent_uptime());
    return SNMP_ERR_NOERROR;
}
开发者ID:fenner,项目名称:net-snmp,代码行数:10,代码来源:system_mib.c

示例7: neIeee8021BridgeBasePortTable_getNext

netsnmp_variable_list *
neIeee8021BridgeBasePortTable_getNext (
	void **my_loop_context, void **my_data_context,
	netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata)
{
	ieee8021BridgeBasePortEntry_t *poEntry = NULL;
	netsnmp_variable_list *idx = put_index_data;
	
	if (*my_loop_context == NULL)
	{
		return NULL;
	}
	poEntry = xBTree_entry (*my_loop_context, ieee8021BridgeBasePortEntry_t, oBTreeNode);
	
	snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32ComponentId);
	idx = idx->next_variable;
	snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32Port);
	*my_data_context = (void*) poEntry;
	*my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021BridgeBasePortTable_BTree);
	return put_index_data;
}
开发者ID:nes-repo,项目名称:NES-Open-Switch,代码行数:21,代码来源:neIeee8021BridgeMIB.c

示例8: sctpLookupRemPortTable_handler

/** handles requests for the sctpLookupRemPortTable table */
int
sctpLookupRemPortTable_handler(netsnmp_mib_handler *handler,
                               netsnmp_handler_registration *reginfo,
                               netsnmp_agent_request_info *reqinfo,
                               netsnmp_request_info *requests)
{

    netsnmp_request_info *request;
    netsnmp_table_request_info *table_info;
    sctpLookupRemPortTable_entry *table_entry;

    switch (reqinfo->mode) {
        /*
         * Read-support (also covers GetNext requests)
         */
    case MODE_GET:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;
            table_entry = (sctpLookupRemPortTable_entry *)
                netsnmp_container_table_extract_context(request);
            table_info = netsnmp_extract_table_info(request);
            if ((NULL == table_entry) || (NULL == table_info)) {
                snmp_log(LOG_ERR,
                         "could not extract table entry or info for sctpLookupRemPortTable\n");
                snmp_set_var_typed_value(request->requestvb,
                                         SNMP_ERR_GENERR, NULL, 0);
                continue;
            }

            switch (table_info->colnum) {
            case COLUMN_SCTPLOOKUPREMPORTSTARTTIME:
                if (!table_entry) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer(request->requestvb,
                                           ASN_TIMETICKS,
                                           table_entry->sctpLookupRemPortStartTime);
                break;
            default:
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_NOSUCHOBJECT);
                break;
            }
        }
        break;

    }
    return SNMP_ERR_NOERROR;
}
开发者ID:ClausKlein,项目名称:net-snmp,代码行数:53,代码来源:sctpLookupRemPortTable.c

示例9: pgsqlPgAmopTable_get_next_data_point

netsnmp_variable_list *
pgsqlPgAmopTable_get_next_data_point(void **my_loop_context,
                          void **my_data_context,
                          netsnmp_variable_list *put_index_data,
                          netsnmp_iterator_info *mydata)
{
    struct pgsqlPgAmopTable_entry *entry = (struct pgsqlPgAmopTable_entry *)*my_loop_context;
    netsnmp_variable_list *idx = put_index_data;

    snmp_log(LOG_INFO, "*** get_next called\n");
    if ( entry ) {
        snmp_set_var_value( idx, entry->pgsnmpdConnID, sizeof(entry->pgsnmpdConnID) );
        idx = idx->next_variable;
        snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->rdbmsDbIndex );
        idx = idx->next_variable;
        snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->pgsqlPgAmopEntryOID );
        idx = idx->next_variable;
        *my_data_context = (void *)entry;
        *my_loop_context = (void *)entry->next;
        return put_index_data;
    } else {
        return NULL;
    }
}
开发者ID:GunioRobot,项目名称:pgsnmpd,代码行数:24,代码来源:pgsqlPgAmopTable.c

示例10: _mteEvent_fire_set

int _mteEvent_fire_set (struct mteEvent *entry,    /* The event to fire */
                        struct mteTrigger *trigger,    /* Trigger that fired */
                        oid * suffix, size_t sfx_len)    /* Matching instance */
{
    netsnmp_variable_list var;

    oid set_oid[MAX_OID_LEN];

    size_t set_len;

    /*
     * Set the basic assignment OID...
     */
    memset (set_oid, 0, sizeof (set_oid));
    memcpy (set_oid, entry->mteSetOID, entry->mteSetOID_len * sizeof (oid));
    set_len = entry->mteSetOID_len;

    /*
     * ... if the trigger value is wildcarded (sfx_len > 0),
     *       *and* the SET event entry is wildcarded,
     *        then add the supplied instance suffix...
     */
    if (sfx_len && entry->flags & MTE_SET_FLAG_OBJWILD)
    {
        memcpy (&set_oid[set_len], suffix, sfx_len * sizeof (oid));
        set_len += sfx_len;
    }

    /*
     * ... finally build the assignment varbind,
     *        and pass it to be acted on.
     *
     * XXX: Need to handle (remote) targets and non-default contexts
     */
    memset (&var, 0, sizeof (var));
    snmp_set_var_objid (&var, set_oid, set_len);
    snmp_set_var_typed_integer (&var, ASN_INTEGER, entry->mteSetValue);
    if (entry->session)
        return netsnmp_query_set (&var, entry->session);
    else
        return netsnmp_query_set (&var, trigger->session);

    /* XXX - Need to check result */
}
开发者ID:274914765,项目名称:C,代码行数:44,代码来源:mteEvent.c

示例11: raidSetTable_get_next_data_point

netsnmp_variable_list *
raidSetTable_get_next_data_point(void **my_loop_context,
                          void **my_data_context,
                          netsnmp_variable_list *put_index_data,
                          netsnmp_iterator_info *mydata)
{
    struct raidSetTable_entry *entry = (struct raidSetTable_entry *)*my_loop_context;
    netsnmp_variable_list *idx = put_index_data;

    if ( entry ) {
        snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->raidSetIndex );
        idx = idx->next_variable;
        *my_data_context = (void *)entry;
        *my_loop_context = (void *)entry->next;
        return put_index_data;
    } else {
        return NULL;
    }
}
开发者ID:Jaharmi,项目名称:Xsnmp,代码行数:19,代码来源:raidSetTable.c

示例12: snmp_set_var_typed_integer

static netsnmp_variable_list *mib_ipRouteTable_get_next(void **my_loop_context,
                                  void **my_data_context,
                                  netsnmp_variable_list *put_index_data,
                                  netsnmp_iterator_info *iinfo)
{
    struct ipRouteTable_entry *entry = (struct ipRouteTable_entry *)*my_loop_context;
    netsnmp_variable_list *idx = put_index_data;

    if ( entry )
    {
        snmp_set_var_typed_integer( idx, ASN_IPADDRESS, entry->ipRouteDest );
        idx = idx->next_variable;
        *my_data_context = (void *)entry;
        *my_loop_context = (void *)entry->next;
        return put_index_data;
    }
    else
    {
        return NULL;
    }
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:21,代码来源:mib_ipRouteTable.c

示例13: snmp_set_var_typed_integer

/*******************************************************************************
 函数名称  : mib_dot1qPortVlanTable_get_next
 功能描述  :
 输入参数  :
 输出参数  :
 返 回 值  :
 --------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   :
 修改目的   :
 修改日期   :
*******************************************************************************/
static netsnmp_variable_list *mib_dot1qPortVlanTable_get_next(void **my_loop_context,
                                  void **my_data_context,
                                  netsnmp_variable_list *put_index_data,
                                  netsnmp_iterator_info *iinfo)
{
    struct dot1qPortVlanTable_entry *entry = (struct dot1qPortVlanTable_entry *)*my_loop_context;
    netsnmp_variable_list *idx = put_index_data;

    if ( entry )
    {
        snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->ifIndex );
        idx = idx->next_variable;
        *my_data_context = (void *)entry;
        *my_loop_context = (void *)entry->next;
        return put_index_data;
    }
    else
    {
        return NULL;
    }
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:33,代码来源:mib_dot1qPortVlanTable.c

示例14: fan_status_handler__

static void
fan_status_handler__(netsnmp_request_info *req,
                     uint32_t index,
                     onlp_snmp_sensor_t *ss)
{
    int value;
    onlp_fan_info_t *fi = &ss->sensor_info.fi;

    if (!ss->info_valid) {
        return;
    }

    value = ONLP_SNMP_SENSOR_STATUS_MISSING;
    if (fi->status & ONLP_FAN_STATUS_PRESENT) {
        value = ONLP_SNMP_SENSOR_STATUS_GOOD;
        if (fi->status & ONLP_FAN_STATUS_FAILED) {
            value = ONLP_SNMP_SENSOR_STATUS_FAILED;
        }
    }

    snmp_set_var_typed_integer(req->requestvb,
                               ASN_INTEGER,
                               value);
}
开发者ID:Lewis-Kang,项目名称:OpenNetworkLinux,代码行数:24,代码来源:onlp_snmp_sensors.c

示例15: mteEventTable_handler

/** handles requests for the mteEventTable table */
int
mteEventTable_handler(netsnmp_mib_handler *handler,
                      netsnmp_handler_registration *reginfo,
                      netsnmp_agent_request_info *reqinfo,
                      netsnmp_request_info *requests)
{

    netsnmp_request_info       *request;
    netsnmp_table_request_info *tinfo;
    netsnmp_tdata_row          *row;
    struct mteEvent            *entry;
    char mteOwner[MTE_STR1_LEN+1];
    char mteEName[MTE_STR1_LEN+1];
    long ret;

    DEBUGMSGTL(("disman:event:mib", "Event Table handler (%d)\n",
                                     reqinfo->mode));

    switch (reqinfo->mode) {
        /*
         * Read-support (also covers GetNext requests)
         */
    case MODE_GET:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);
            if (!entry || !(entry->flags & MTE_EVENT_FLAG_VALID))
                continue;

            switch (tinfo->colnum) {
            case COLUMN_MTEEVENTCOMMENT:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->mteEventComment,
                                  strlen(entry->mteEventComment));
                break;
            case COLUMN_MTEEVENTACTIONS:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                        &entry->mteEventActions, 1);
                break;
            case COLUMN_MTEEVENTENABLED:
                ret = (entry->flags & MTE_EVENT_FLAG_ENABLED ) ?
                           TV_TRUE : TV_FALSE;
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
                break;
            case COLUMN_MTEEVENTENTRYSTATUS:
                ret = (entry->flags & MTE_EVENT_FLAG_ACTIVE ) ?
                           RS_ACTIVE : RS_NOTINSERVICE;
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
                break;
            }
        }
        break;


#ifndef NETSNMP_NO_WRITE_SUPPORT
        /*
         * Write-support
         */
    case MODE_SET_RESERVE1:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_MTEEVENTCOMMENT:
                ret = netsnmp_check_vb_type_and_max_size(
                          request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                /*
                 * Can't modify the comment of an active row
                 *   (No good reason for this, but that's what the MIB says!)
                 */
                if (entry &&
                    entry->flags & MTE_EVENT_FLAG_ACTIVE ) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_ERR_INCONSISTENTVALUE);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_MTEEVENTACTIONS:
                ret = netsnmp_check_vb_type_and_size(
                          request->requestvb, ASN_OCTET_STR, 1);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                /*
                 * Can't modify the event types of an active row
                 *   (A little more understandable perhaps,
                 *    but still an unnecessary restriction IMO)
//.........这里部分代码省略.........
开发者ID:ClausKlein,项目名称:net-snmp,代码行数:101,代码来源:mteEventTable.c


注:本文中的snmp_set_var_typed_integer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。