您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ snmp_reset_var_buffers函数代码示例

51自学网 2021-06-03 08:04:10
  C++
这篇教程C++ snmp_reset_var_buffers函数代码示例写得很实用,希望能帮到您。

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

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

示例1: dmfTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intdmfTable_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,


示例2: sctpAssocTable_entry_update_index

intsctpAssocTable_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,


示例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. */intsaHpiAutoInsertTimeoutTable_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,


示例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,


示例5: saHpiSensorTable_extract_index

/* * the *_extract_index routine */intsaHpiSensorTable_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,


示例6: dot11WtpDataPktsTable_index_from_oid

/** * extract dot11WtpDataPktsTable indexes from a netsnmp_index * * @retval SNMP_ERR_NOERROR  : no error * @retval SNMP_ERR_GENERR   : error */intdot11WtpDataPktsTable_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,


示例7: dot11WtpIfTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intdot11WtpIfTable_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,


示例8: sctpAssocLocalAddrTable_entry_update_index

intsctpAssocLocalAddrTable_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,


示例9: ipv6ScopeZoneIndexTable_index_from_oid

/** * extract ipv6ScopeZoneIndexTable indexes from a netsnmp_index * * @retval SNMP_ERR_NOERROR  : no error * @retval SNMP_ERR_GENERR   : error */intipv6ScopeZoneIndexTable_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,


示例10: jmfcNamespaceHttpServerTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intjmfcNamespaceHttpServerTable_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,


示例11: ipv6ScopeZoneIndexTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intipv6ScopeZoneIndexTable_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,


示例12: dot11SsidTeminalTable_index_from_oid

/** * extract dot11SsidTeminalTable indexes from a netsnmp_index * * @retval SNMP_ERR_NOERROR  : no error * @retval SNMP_ERR_GENERR   : error */intdot11SsidTeminalTable_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,


示例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,


示例14: dessertAppStatsTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intdessertAppStatsTable_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,


示例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,


示例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,


示例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. */intsaHpiEventTable_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,


示例18: dot11SsidTeminalTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intdot11SsidTeminalTable_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,


示例19: dot11WtpWAPIPerformanceStatsTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intdot11WtpWAPIPerformanceStatsTable_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,


示例20: pgsqlPgAmTable_index_from_oid

/** * extract pgsqlPgAmTable indexes from a netsnmp_index * * @retval SNMP_ERR_NOERROR  : no error * @retval SNMP_ERR_GENERR   : error */intpgsqlPgAmTable_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,


示例21: usmDHUserKeyTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intusmDHUserKeyTable_index_to_oid(netsnmp_index * oid_idx,                               usmDHUserKeyTable_mib_index * mib_idx){    int             err = SNMP_ERR_NOERROR;    /*     * temp storage for parsing indexes     */    /*     * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h     */    netsnmp_variable_list var_usmUserEngineID;    /*     * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H     */    netsnmp_variable_list var_usmUserName;    /*     * set up varbinds     */    memset(&var_usmUserEngineID, 0x00, sizeof(var_usmUserEngineID));    var_usmUserEngineID.type = ASN_OCTET_STR;    memset(&var_usmUserName, 0x00, sizeof(var_usmUserName));    var_usmUserName.type = ASN_OCTET_STR;    /*     * chain temp index varbinds together     */    var_usmUserEngineID.next_variable = &var_usmUserName;    var_usmUserName.next_variable = NULL;    DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_index_to_oid",                "called/n"));    /*     * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h      */    snmp_set_var_value(&var_usmUserEngineID,                       (u_char *) & mib_idx->usmUserEngineID,                       mib_idx->usmUserEngineID_len *                       sizeof(mib_idx->usmUserEngineID[0]));    /*     * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H      */    snmp_set_var_value(&var_usmUserName, (u_char *) & mib_idx->usmUserName,                       mib_idx->usmUserName_len *                       sizeof(mib_idx->usmUserName[0]));    err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,                            NULL, 0, &var_usmUserEngineID);    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_usmUserEngineID);    return err;}                               /* usmDHUserKeyTable_index_to_oid */
开发者ID:jnfeinstein,项目名称:asuswrt-merlin,代码行数:68,


示例22: ipDefaultRouterTable_index_from_oid

/** * extract ipDefaultRouterTable indexes from a netsnmp_index * * @retval SNMP_ERR_NOERROR  : no error * @retval SNMP_ERR_GENERR   : error */intipDefaultRouterTable_index_from_oid(netsnmp_index * oid_idx,                                    ipDefaultRouterTable_mib_index *                                    mib_idx){    int             err = SNMP_ERR_NOERROR;    /*     * temp storage for parsing indexes     */    /*     * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h     */    netsnmp_variable_list var_ipDefaultRouterAddressType;    /*     * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h     */    netsnmp_variable_list var_ipDefaultRouterAddress;    /*     * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H     */    netsnmp_variable_list var_ipDefaultRouterIfIndex;    /*     * set up varbinds     */    memset(&var_ipDefaultRouterAddressType, 0x00,           sizeof(var_ipDefaultRouterAddressType));    var_ipDefaultRouterAddressType.type = ASN_INTEGER;    memset(&var_ipDefaultRouterAddress, 0x00,           sizeof(var_ipDefaultRouterAddress));    var_ipDefaultRouterAddress.type = ASN_OCTET_STR;    memset(&var_ipDefaultRouterIfIndex, 0x00,           sizeof(var_ipDefaultRouterIfIndex));    var_ipDefaultRouterIfIndex.type = ASN_INTEGER;    /*     * chain temp index varbinds together     */    var_ipDefaultRouterAddressType.next_variable =        &var_ipDefaultRouterAddress;    var_ipDefaultRouterAddress.next_variable = &var_ipDefaultRouterIfIndex;    var_ipDefaultRouterIfIndex.next_variable = NULL;    DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_index_from_oid", "called/n"));    /*     * parse the oid into the individual index components     */    err = parse_oid_indexes(oid_idx->oids, oid_idx->len,                            &var_ipDefaultRouterAddressType);    if (err == SNMP_ERR_NOERROR) {        /*         * copy out values         */        mib_idx->ipDefaultRouterAddressType =            *((u_long *) var_ipDefaultRouterAddressType.val.string);        /*         * NOTE: val_len is in bytes, ipDefaultRouterAddress_len might not be         */        if (var_ipDefaultRouterAddress.val_len >            sizeof(mib_idx->ipDefaultRouterAddress))            err = SNMP_ERR_GENERR;        else {            memcpy(mib_idx->ipDefaultRouterAddress,                   var_ipDefaultRouterAddress.val.string,                   var_ipDefaultRouterAddress.val_len);            mib_idx->ipDefaultRouterAddress_len =                var_ipDefaultRouterAddress.val_len /                sizeof(mib_idx->ipDefaultRouterAddress[0]);        }        mib_idx->ipDefaultRouterIfIndex =            *((long *) var_ipDefaultRouterIfIndex.val.string);    }    /*     * parsing may have allocated memory. free it.     */    snmp_reset_var_buffers(&var_ipDefaultRouterAddressType);    return err;}                               /* ipDefaultRouterTable_index_from_oid */
开发者ID:prak5192,项目名称:C_Project,代码行数:91,


示例23: saHpiHotSwapTable_extract_index

//.........这里部分代码省略.........    /** TODO: add storage for external index(s)! */    netsnmp_variable_list var_saHpiDomainId;    netsnmp_variable_list var_saHpiResourceId;    netsnmp_variable_list var_saHpiResourceIsHistorical;    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 */#ifdef TABLE_CONTAINER_TODO    snmp_log(LOG_ERR, "saHpiHotSwapTable_extract_index index list not implemented!/n" );    return 0;#else       var_saHpiDomainId.next_variable = &var_XX;#endif       memset( &var_saHpiResourceId, 0x00, sizeof(var_saHpiResourceId) );       var_saHpiResourceId.type = ASN_UNSIGNED; /* type hint for parse_oid_indexes */       /** TODO: link this index to the next, or NULL for the last one */#ifdef TABLE_CONTAINER_TODO    snmp_log(LOG_ERR, "saHpiHotSwapTable_extract_index index list not implemented!/n" );    return 0;#else       var_saHpiResourceId.next_variable = &var_XX;#endif       memset( &var_saHpiResourceIsHistorical, 0x00, sizeof(var_saHpiResourceIsHistorical) );       var_saHpiResourceIsHistorical.type = ASN_INTEGER; /* type hint for parse_oid_indexes */       /** TODO: link this index to the next, or NULL for the last one */#ifdef TABLE_CONTAINER_TODO    snmp_log(LOG_ERR, "saHpiHotSwapTable_extract_index index list not implemented!/n" );    return 0;#else       var_saHpiResourceIsHistorical.next_variable = &var_XX;#endif    /*     * 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 */                 /*            * TODO: check index for valid values. For EXAMPLE:            *              * if ( *var_saHpiDomainId.val.integer != XXX ) {          *    err = -1;          * }          */           /*            * TODO: check index for valid values. For EXAMPLE:            *              * if ( *var_saHpiResourceId.val.integer != XXX ) {          *    err = -1;          * }          */           /*            * TODO: check index for valid values. For EXAMPLE:            *              * if ( *var_saHpiResourceIsHistorical.val.integer != XXX ) {          *    err = -1;          * }          */    }    /*     * parsing may have allocated memory. free it.     */    snmp_reset_var_buffers( &var_saHpiDomainId );    return err;}
开发者ID:openhpi1,项目名称:testrepo,代码行数:101,


示例24: ipDefaultRouterTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intipDefaultRouterTable_index_to_oid(netsnmp_index * oid_idx,                                  ipDefaultRouterTable_mib_index * mib_idx){    int             err = SNMP_ERR_NOERROR;    /*     * temp storage for parsing indexes     */    /*     * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h     */    netsnmp_variable_list var_ipDefaultRouterAddressType;    /*     * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h     */    netsnmp_variable_list var_ipDefaultRouterAddress;    /*     * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H     */    netsnmp_variable_list var_ipDefaultRouterIfIndex;    /*     * set up varbinds     */    memset(&var_ipDefaultRouterAddressType, 0x00,           sizeof(var_ipDefaultRouterAddressType));    var_ipDefaultRouterAddressType.type = ASN_INTEGER;    memset(&var_ipDefaultRouterAddress, 0x00,           sizeof(var_ipDefaultRouterAddress));    var_ipDefaultRouterAddress.type = ASN_OCTET_STR;    memset(&var_ipDefaultRouterIfIndex, 0x00,           sizeof(var_ipDefaultRouterIfIndex));    var_ipDefaultRouterIfIndex.type = ASN_INTEGER;    /*     * chain temp index varbinds together     */    var_ipDefaultRouterAddressType.next_variable =        &var_ipDefaultRouterAddress;    var_ipDefaultRouterAddress.next_variable = &var_ipDefaultRouterIfIndex;    var_ipDefaultRouterIfIndex.next_variable = NULL;    DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_index_to_oid", "called/n"));    /*     * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h      */    snmp_set_var_value(&var_ipDefaultRouterAddressType,                       (u_char *) & mib_idx->ipDefaultRouterAddressType,                       sizeof(mib_idx->ipDefaultRouterAddressType));    /*     * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h      */    snmp_set_var_value(&var_ipDefaultRouterAddress,                       (u_char *) & mib_idx->ipDefaultRouterAddress,                       mib_idx->ipDefaultRouterAddress_len *                       sizeof(mib_idx->ipDefaultRouterAddress[0]));    /*     * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H      */    snmp_set_var_value(&var_ipDefaultRouterIfIndex,                       (u_char *) & mib_idx->ipDefaultRouterIfIndex,                       sizeof(mib_idx->ipDefaultRouterIfIndex));    err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,                            NULL, 0, &var_ipDefaultRouterAddressType);    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_ipDefaultRouterAddressType);    return err;}                               /* ipDefaultRouterTable_index_to_oid */
开发者ID:prak5192,项目名称:C_Project,代码行数:85,


示例25: openserSIPStatusCodesTable_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 the indexes aren't * returned if they are invalid.  An index is invalid if it is not between  * 100 and 699 (Inclusive). */int openserSIPStatusCodesTable_extract_index( 		openserSIPStatusCodesTable_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_openserSIPStatusCodeMethod;	netsnmp_variable_list var_openserSIPStatusCodeValue;	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;	} 	/* Initialize the two variables responsible for holding our two indices.	 */	memset(&var_openserSIPStatusCodeMethod, 0x00, 			 sizeof(var_openserSIPStatusCodeMethod));	memset( &var_openserSIPStatusCodeValue, 0x00, 			sizeof(var_openserSIPStatusCodeValue) );	var_openserSIPStatusCodeMethod.type = ASN_UNSIGNED; 	var_openserSIPStatusCodeValue.type  = ASN_UNSIGNED;	var_openserSIPStatusCodeMethod.next_variable = 		&var_openserSIPStatusCodeValue;	var_openserSIPStatusCodeValue.next_variable = NULL;	/* parse the oid into the individual index components */	err = parse_oid_indexes( hdr->oids, hdr->len, 			&var_openserSIPStatusCodeMethod );	if (err == SNMP_ERR_NOERROR) {		/* copy index components into the context structure */		ctx->openserSIPStatusCodeMethod = 			*var_openserSIPStatusCodeMethod.val.integer;		ctx->openserSIPStatusCodeValue  = 			*var_openserSIPStatusCodeValue.val.integer;      		if (*var_openserSIPStatusCodeMethod.val.integer < 1)		{			err = -1;		}		if (*var_openserSIPStatusCodeValue.val.integer < 100 ||		    *var_openserSIPStatusCodeValue.val.integer > 699) {			err = -1;		}	}		/* parsing may have allocated memory. free it. */	snmp_reset_var_buffers( &var_openserSIPStatusCodeMethod );	return err;}
开发者ID:KISSMonX,项目名称:opensips,代码行数:90,


示例26: pgsqlPgAmTable_index_to_oid

/** * @internal * convert the index component stored in the context to an oid */intpgsqlPgAmTable_index_to_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_to_oid","called/n"));        /* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */    snmp_set_var_value(&var_pgsnmpdConnID, (u_char*)&mib_idx->pgsnmpdConnID,                       mib_idx->pgsnmpdConnID_len * sizeof(mib_idx->pgsnmpdConnID[0]));        /* rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */    snmp_set_var_value(&var_rdbmsDbIndex, (u_char*)&mib_idx->rdbmsDbIndex,                       sizeof(mib_idx->rdbmsDbIndex));        /* pgsqlPgAmEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h */    snmp_set_var_value(&var_pgsqlPgAmEntryOID, (u_char*)&mib_idx->pgsqlPgAmEntryOID,                       sizeof(mib_idx->pgsqlPgAmEntryOID));    err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,                           NULL, 0, &var_pgsnmpdConnID);    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_pgsnmpdConnID );    return err;} /* pgsqlPgAmTable_index_to_oid */
开发者ID:GunioRobot,项目名称:pgsnmpd,代码行数:69,


示例27: netsnmp_assert

/** * 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  saHpiSensorThdPosHysteresisTable_extract_index  (saHpiSensorThdPosHysteresisTable_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_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;    }  /*   * 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.   */  memset (&var_saHpiDomainID, 0x00, sizeof (var_saHpiDomainID));  var_saHpiDomainID.type = ASN_UNSIGNED;	/* type hint for parse_oid_indexes */  var_saHpiDomainID.next_variable = &var_saHpiResourceID;  memset (&var_saHpiResourceID, 0x00, sizeof (var_saHpiResourceID));  var_saHpiResourceID.type = ASN_UNSIGNED;	/* type hint for parse_oid_indexes */  var_saHpiResourceID.next_variable = &var_saHpiSensorIndex;  memset (&var_saHpiSensorIndex, 0x00, sizeof (var_saHpiSensorIndex));  var_saHpiSensorIndex.type = ASN_UNSIGNED;	/* type hint for parse_oid_indexes */  var_saHpiSensorIndex.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       */	ctx->domain_id  = *var_saHpiDomainID.val.integer;	ctx->resource_id = *var_saHpiResourceID.val.integer;	ctx->sensor_id = *var_saHpiSensorIndex.val.integer;    }  /*   * parsing may have allocated memory. free it.   */  snmp_reset_var_buffers (&var_saHpiDomainID);  return err;}
开发者ID:openhpi1,项目名称:testrepo,代码行数:78,


示例28: dot11NewNeighborAPTable_index_from_oid

/** * extract dot11NewNeighborAPTable indexes from a netsnmp_index * * @retval SNMP_ERR_NOERROR  : no error * @retval SNMP_ERR_GENERR   : error */intdot11NewNeighborAPTable_index_from_oid(netsnmp_index *oid_idx,                         dot11NewNeighborAPTable_mib_index *mib_idx){    int err = SNMP_ERR_NOERROR;        /*     * temp storage for parsing indexes     */    /*     * wtpMacAddr(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H     */    netsnmp_variable_list var_wtpMacAddr;    /*     * wtpWirelessIfIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h     */    netsnmp_variable_list var_wtpWirelessIfIndex;    /*     * neighborAPIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h     */    netsnmp_variable_list var_neighborAPIndex;    /*     * set up varbinds     */    memset( &var_wtpMacAddr, 0x00, sizeof(var_wtpMacAddr) );    var_wtpMacAddr.type = ASN_OCTET_STR;    memset( &var_wtpWirelessIfIndex, 0x00, sizeof(var_wtpWirelessIfIndex) );    var_wtpWirelessIfIndex.type = ASN_INTEGER;    memset( &var_neighborAPIndex, 0x00, sizeof(var_neighborAPIndex) );    var_neighborAPIndex.type = ASN_INTEGER;    /*     * chain temp index varbinds together     */    var_wtpMacAddr.next_variable =  &var_wtpWirelessIfIndex; var_wtpWirelessIfIndex.next_variable =  &var_neighborAPIndex; var_neighborAPIndex.next_variable =  NULL;    DEBUGMSGTL(("verbose:dot11NewNeighborAPTable:dot11NewNeighborAPTable_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]);         }    mib_idx->wtpWirelessIfIndex = *((long *)var_wtpWirelessIfIndex.val.string);    mib_idx->neighborAPIndex = *((long *)var_neighborAPIndex.val.string);    }    /*     * parsing may have allocated memory. free it.     */    snmp_reset_var_buffers( &var_wtpMacAddr );    return err;} /* dot11NewNeighborAPTable_index_from_oid */
开发者ID:inibir,项目名称:daemongroup,代码行数:77,


示例29: memTable_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. */intmemTable_extract_index(memTable_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_memIndex;    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.     */    memset(&var_memIndex, 0x00, sizeof(var_memIndex));    var_memIndex.type = ASN_INTEGER;    /* type hint for parse_oid_indexes */       /** TODO: link this index to the next, or NULL for the last one */#ifdef TABLE_CONTAINER_TODO    log_print(LOGN_CRI,             "memTable_extract_index index list not implemented!/n");    return 0;#else    //var_memIndex.next_variable = &var_XX;    var_memIndex.next_variable = NULL;#endif    /*     * parse the oid into the individual index components     */    err = parse_oid_indexes(hdr->oids, hdr->len, &var_memIndex);    if (err == SNMP_ERR_NOERROR) {        /*         * copy index components into the context structure         */        ctx->memIndex = *var_memIndex.val.integer;        /*         * TODO: check index for valid values. For EXAMPLE:         *         * if ( *var_memIndex.val.integer != XXX ) {         *    err = -1;         * }         */    }    /*     * parsing may have allocated memory. free it.     */    snmp_reset_var_buffers(&var_memIndex);    return err;}
开发者ID:lanian09,项目名称:mysource,代码行数:77,


示例30: usmDHUserKeyTable_index_from_oid

/** * extract usmDHUserKeyTable indexes from a netsnmp_index * * @retval SNMP_ERR_NOERROR  : no error * @retval SNMP_ERR_GENERR   : error */intusmDHUserKeyTable_index_from_oid(netsnmp_index * oid_idx,                                 usmDHUserKeyTable_mib_index * mib_idx){    int             err = SNMP_ERR_NOERROR;    /*     * temp storage for parsing indexes     */    /*     * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h     */    netsnmp_variable_list var_usmUserEngineID;    /*     * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H     */    netsnmp_variable_list var_usmUserName;    /*     * set up varbinds     */    memset(&var_usmUserEngineID, 0x00, sizeof(var_usmUserEngineID));    var_usmUserEngineID.type = ASN_OCTET_STR;    memset(&var_usmUserName, 0x00, sizeof(var_usmUserName));    var_usmUserName.type = ASN_OCTET_STR;    /*     * chain temp index varbinds together     */    var_usmUserEngineID.next_variable = &var_usmUserName;    var_usmUserName.next_variable = NULL;    DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_index_from_oid", "called/n"));    /*     * parse the oid into the individual index components     */    err = parse_oid_indexes(oid_idx->oids, oid_idx->len,                            &var_usmUserEngineID);    if (err == SNMP_ERR_NOERROR) {        /*         * copy out values         */        /*         * NOTE: val_len is in bytes, usmUserEngineID_len might not be         */        if (var_usmUserEngineID.val_len > sizeof(mib_idx->usmUserEngineID))            err = SNMP_ERR_GENERR;        else {            memcpy(mib_idx->usmUserEngineID,                   var_usmUserEngineID.val.string,                   var_usmUserEngineID.val_len);            mib_idx->usmUserEngineID_len =                var_usmUserEngineID.val_len /                sizeof(mib_idx->usmUserEngineID[0]);        }        /*         * NOTE: val_len is in bytes, usmUserName_len might not be         */        if (var_usmUserName.val_len > sizeof(mib_idx->usmUserName))            err = SNMP_ERR_GENERR;        else {            memcpy(mib_idx->usmUserName, var_usmUserName.val.string,                   var_usmUserName.val_len);            mib_idx->usmUserName_len =                var_usmUserName.val_len / sizeof(mib_idx->usmUserName[0]);        }    }    /*     * parsing may have allocated memory. free it.     */    snmp_reset_var_buffers(&var_usmUserEngineID);    return err;}                               /* usmDHUserKeyTable_index_from_oid */
开发者ID:jnfeinstein,项目名称:asuswrt-merlin,代码行数:85,



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


C++ snmp_sess_init函数代码示例
C++ snmp_perror函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。