• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snmp_set_var_value函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: nsModuleTable_get_first_data_point

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;
}
开发者ID:TheTypoMaster,项目名称:AH4222,代码行数:35,代码来源:nsModuleTable.c


示例2: udpTable_next_entry

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;
}
开发者ID:smx-smx,项目名称:dsl-n55u,代码行数:34,代码来源:udpTable.c


示例3: 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


示例4: ipCidrRouteTable_set_indexes

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;
}
开发者ID:DYFeng,项目名称:infinidb,代码行数:28,代码来源:ipCidrRouteTable.c


示例5: 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


示例6: 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


示例7: nsVacmAccessTable_get_next_data_point

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;
    }
}
开发者ID:duniansampa,项目名称:SigLog,代码行数:51,代码来源:nsVacmAccessTable.cpp


示例8: tcpTable_next_entry

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;
}
开发者ID:jnfeinstein,项目名称:asuswrt-merlin,代码行数:48,代码来源:tcpTable.c


示例9: 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


示例10: 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


示例11: 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


示例12: snmp_set_var_typed_value

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);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:7,代码来源:snmp_client.c


示例13: pcapFilterTable_getFirst

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;
}
开发者ID:dennisjenkins75,项目名称:pcap-snmp-monitor,代码行数:28,代码来源:snmp-mib.c


示例14: later

/** 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;
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:38,代码来源:LHAMembershipTable.c


示例15: later

/** 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;
}
开发者ID:BillTheBest,项目名称:pacemaker-mgmt,代码行数:38,代码来源:LHANodeTable.c


示例16: register_string_index

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;
    }
}
开发者ID:duniansampa,项目名称:SigLog,代码行数:27,代码来源:agent_index.cpp


示例17: nsTransactionTable_get_next_data_point

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;
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:26,代码来源:nsTransactionTable.c


示例18: unregister_string_index

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));
}
开发者ID:duniansampa,项目名称:SigLog,代码行数:11,代码来源:agent_index.cpp


示例19: dot11VlanAbilityTable_get_next_data_point

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;
}
开发者ID:inibir,项目名称:daemongroup,代码行数:21,代码来源:dot11VlanAbilityTable.c


示例20: unregister_oid_index

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));
}
开发者ID:duniansampa,项目名称:SigLog,代码行数:13,代码来源:agent_index.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snmp_synch_response函数代码示例发布时间:2022-05-30
下一篇:
C++ snmp_set_var_typed_value函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap