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

C++ read_objid函数代码示例

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

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



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

示例1: snmp_init

void snmp_init(void) {
	console_log("snmp: init\n");

	init_snmp(APPNAME);
	conv_utf16_utf8 = iconv_open("UTF-8","UTF-16LE");

	oid_rssi_ts1_length = MAX_OID_LEN;
	if (!read_objid(OID_RSSI_TS1, oid_rssi_ts1, &oid_rssi_ts1_length))
		console_log("snmp error: can't parse ts1 rssi oid (%s)\n", OID_RSSI_TS1);
	oid_rssi_ts2_length = MAX_OID_LEN;
	if (!read_objid(OID_RSSI_TS2, oid_rssi_ts2, &oid_rssi_ts2_length))
		console_log("snmp error: can't parse ts2 rssi oid (%s)\n", OID_RSSI_TS2);

	oid_id_length = MAX_OID_LEN;
	if (!read_objid(OID_ID, oid_id, &oid_id_length))
		console_log("snmp error: can't parse id oid (%s)\n", OID_ID);
	oid_repeatertype_length = MAX_OID_LEN;
	if (!read_objid(OID_REPEATERTYPE, oid_repeatertype, &oid_repeatertype_length))
		console_log("snmp error: can't parse repeatertype oid (%s)\n", OID_REPEATERTYPE);
	oid_fwversion_length = MAX_OID_LEN;
	if (!read_objid(OID_FWVERSION, oid_fwversion, &oid_fwversion_length))
		console_log("snmp error: can't parse fwversion oid (%s)\n", OID_FWVERSION);
	oid_callsign_length = MAX_OID_LEN;
	if (!read_objid(OID_CALLSIGN, oid_callsign, &oid_callsign_length))
		console_log("snmp error: can't parse callsign oid (%s)\n", OID_CALLSIGN);
	oid_dlfreq_length = MAX_OID_LEN;
	if (!read_objid(OID_DLFREQ, oid_dlfreq, &oid_dlfreq_length))
		console_log("snmp error: can't parse callsign oid (%s)\n", OID_DLFREQ);
	oid_ulfreq_length = MAX_OID_LEN;
	if (!read_objid(OID_ULFREQ, oid_ulfreq, &oid_ulfreq_length))
		console_log("snmp error: can't parse callsign oid (%s)\n", OID_ULFREQ);
}
开发者ID:n8ohu,项目名称:dmrshark,代码行数:32,代码来源:snmp.c


示例2: setupmib

/* 
 * This routine loads MIB files, and computes the key-OID values.
 * We defer this until the mib-definition is actually being referred to 
 * in snmphosts.cfg, because lots of MIB's are not being used
 * (and probably do not exist on the host where we're running) and
 * to avoid spending a lot of time to load MIB's that are not used.
 */
void setupmib(mibdef_t *mib, int verbose)
{
	mibidx_t *iwalk;
	size_t sz, len;

	if (mib->loadstatus != MIB_STATUS_NOTLOADED) return;

	if (mib->mibfn && (read_mib(mib->mibfn) == NULL)) {
		mib->loadstatus = MIB_STATUS_LOADFAILED;
		if (verbose) {
			errprintf("Failed to read MIB file %s\n", mib->mibfn);
			snmp_perror("read_objid");
		}
	}

	for (iwalk = mib->idxlist; (iwalk); iwalk = iwalk->next) {
		iwalk->rootoid = calloc(MAX_OID_LEN, sizeof(oid));
		iwalk->rootoidlen = MAX_OID_LEN;
		if (read_objid(iwalk->keyoid, iwalk->rootoid, &iwalk->rootoidlen)) {
			/* Re-use the iwalk->keyoid buffer */
			sz = strlen(iwalk->keyoid) + 1; len = 0;
			sprint_realloc_objid((unsigned char **)&iwalk->keyoid, &sz, &len, 1, iwalk->rootoid, iwalk->rootoidlen);
		}
		else {
			mib->loadstatus = MIB_STATUS_LOADFAILED;
			if (verbose) {
				errprintf("Cannot determine OID for %s\n", iwalk->keyoid);
				snmp_perror("read_objid");
			}
		}
	}

	mib->loadstatus = MIB_STATUS_LOADED;
}
开发者ID:gvsurenderreddy,项目名称:xymon-2,代码行数:41,代码来源:xymon-snmpcollect.c


示例3: prsnmpstr

void prsnmpstr(char *stroid) {
    struct snmp_pdu *pdu, *resp;
    oid tmp_oid[MAX_OID_LEN];
    size_t tmp_oid_len=MAX_OID_LEN;
    int stat;
    char *tmp;

    pdu=snmp_pdu_create(SNMP_MSG_GET);
    read_objid(stroid, tmp_oid, &tmp_oid_len);
    snmp_add_null_var(pdu, tmp_oid, tmp_oid_len);
    stat=snmp_synch_response(ses, pdu, &resp);

    if (stat != STAT_SUCCESS || resp->errstat != SNMP_ERR_NOERROR) 
        perr(resp);

    if(resp->variables->val_len && strlen((char *)resp->variables->val.string)) {
        tmp=malloc((resp->variables->val_len+1) * sizeof(char));
        memcpy(tmp, resp->variables->val.string, resp->variables->val_len);
        tmp[resp->variables->val_len]=0;
        printf("%s", tmp);
        free(tmp);
    }
    
    if(resp)
            snmp_free_pdu(resp);

}
开发者ID:xiongshaogang,项目名称:NetAndSysMonitor,代码行数:27,代码来源:ttg-snmp.cpp


示例4: system_parse_config_sysObjectID

void system_parse_config_sysObjectID(const char *token, char *cptr)
{
    char tmpbuf[1024];

    sysObjectIDLength = MAX_OID_LEN;
    if (!read_objid(cptr, sysObjectID, &sysObjectIDLength)) {
        snprintf(tmpbuf,
                 sizeof(tmpbuf),
                 "sysobjectid token not a parsable OID:\n\t%s",
                 cptr);
        config_perror(tmpbuf);
        // Modified by Gavin Lin, 2008/10/30
        //memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
        //sysObjectIDLength = version_sysoid_len;
#ifdef CONFIG_MODEL_LRTXXX
				/* purpose      :  0012697 author :  Gavin.Lin  date :  2010-06-22         */
				/* description  :  Customer requirements                                   */
				kd_doCommand("VERSION MODEL", CMD_PRINT, ASH_DO_NOTHING, tmpbuf);
				if (!strcmp("LRT214", tmpbuf))
				{
					memcpy(sysObjectID, nk_sysobjectid_214, nk_sysobjectid_len * sizeof(oid));
				}
				if (!strcmp("LRT224", tmpbuf))
				{
					memcpy(sysObjectID, nk_sysobjectid_224, nk_sysobjectid_len * sizeof(oid));
				}
#else
        memcpy(sysObjectID, nk_sysobjectid, nk_sysobjectid_len * sizeof(oid));
#endif
        sysObjectIDLength = nk_sysobjectid_len;
    }
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:32,代码来源:system_mib.c


示例5: csnmp_config_add_data_instance

static int csnmp_config_add_data_instance (data_definition_t *dd, oconfig_item_t *ci)
{
  char buffer[DATA_MAX_NAME_LEN];
  int status;

  status = cf_util_get_string_buffer(ci, buffer, sizeof(buffer));
  if (status != 0)
    return status;

  if (dd->is_table)
  {
    /* Instance is an OID */
    dd->instance.oid.oid_len = MAX_OID_LEN;

    if (!read_objid (buffer,
          dd->instance.oid.oid, &dd->instance.oid.oid_len))
    {
      ERROR ("snmp plugin: read_objid (%s) failed.", buffer);
      return (-1);
    }
  }
  else
  {
    /* Instance is a simple string */
    sstrncpy (dd->instance.string, buffer,
        sizeof (dd->instance.string));
  }

  return (0);
} /* int csnmp_config_add_data_instance */
开发者ID:kmiku7,项目名称:collectd,代码行数:30,代码来源:snmp.c


示例6: snmpInitialize

/*
 * initialize
 */
void snmpInitialize(tInterfaceList *interfaceList)
{
    tOidList *oidList;

	/* initialize library */
	init_snmp("snmppoller");
	netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, TRUE);

	unsigned int i = 0;
	while (i < interfaceList->count) {
		syslog(LOG_DEBUG, "snmpInitialize: %s", interfaceList->interface[i].ip);
        oidList = &interfaceList->interface[i].oidList;

        unsigned int o = 0;
        while (o < oidList->count) {
            syslog(LOG_DEBUG, "snmpInitialize: * %s", oidList->oid[o].oidName);
			oidList->oid[o].OidLen = sizeof(oidList->oid[o].Oid)/sizeof(oidList->oid[o].Oid[0]);
			if (!read_objid(oidList->oid[o].oidName, oidList->oid[o].Oid, &oidList->oid[o].OidLen)) {
				syslog(LOG_ERR, "snmpInitialize: read_objid failed for: %d %s", interfaceList->interface[i].id_interface, oidList->oid[o].oidName);
				exit(1);
			}
            o++;
        }
        i++;
    }
}
开发者ID:fbn-dd,项目名称:netplan,代码行数:29,代码来源:snmp.c


示例7: csnmp_config_add_data_instance

static int csnmp_config_add_data_instance (data_definition_t *dd, oconfig_item_t *ci)
{
  if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
  {
    WARNING ("snmp plugin: `Instance' needs exactly one string argument.");
    return (-1);
  }

  if (dd->is_table)
  {
    /* Instance is an OID */
    dd->instance.oid.oid_len = MAX_OID_LEN;

    if (!read_objid (ci->values[0].value.string,
	  dd->instance.oid.oid, &dd->instance.oid.oid_len))
    {
      ERROR ("snmp plugin: read_objid (%s) failed.",
	  ci->values[0].value.string);
      return (-1);
    }
  }
  else
  {
    /* Instance is a simple string */
    sstrncpy (dd->instance.string, ci->values[0].value.string,
	sizeof (dd->instance.string));
  }

  return (0);
} /* int csnmp_config_add_data_instance */
开发者ID:haojunyu,项目名称:collectd,代码行数:30,代码来源:snmp.c


示例8: snmp_get_bulk

int snmp_get_bulk( struct snmp_session *ss, 
		   const char *bulk_objid, 
		   struct snmp_pdu *bulk_pdu, 
		   struct snmp_pdu **bulk_response )
{
	size_t anOID_len = MAX_OID_LEN;
	oid anOID[MAX_OID_LEN];
	int status;


	/* Create the PDU for theenrty_count data for our request. */
	read_objid(bulk_objid, anOID, &anOID_len);

	bulk_pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
 	
	bulk_pdu->non_repeaters = 0; 
	
	bulk_pdu->max_repetitions = NUM_REPITIONS;
	
	snmp_add_null_var(bulk_pdu, anOID, anOID_len);
	
	/* Send the Request out.*/
	status = snmp_synch_response(ss, bulk_pdu, bulk_response);

	return(status);

}
开发者ID:openhpi1,项目名称:testrepo,代码行数:27,代码来源:snmp_client_discover.c


示例9: snmp_get_item

static struct snmp_pdu *
snmp_get_item(char *host, char *community, char *mib_item)
{
	struct snmp_session session, *ss;
	struct snmp_pdu *request = NULL, *result = NULL;
	oid Oid[MAX_OID_LEN];
	unsigned int oid_len = MAX_OID_LEN;

	/* initialize the SNMP session */
	snmp_sess_init(&session);
	session.peername = host;
	session.community = (uchar_t *)community;
	session.community_len = strlen((const char *)session.community);
	session.version = SNMP_VERSION_1;
	session.retries = 0;

	if ((ss = snmp_open(&session)) == NULL)
		return (NULL);

	/* add the requested data */
	if (!read_objid(mib_item, Oid, &oid_len))
		snmp_perror(mib_item);

	/* initialize the request PDU */
	request = snmp_pdu_create(SNMP_MSG_GET);
	snmp_add_null_var(request, Oid, oid_len);

	(void) snmp_synch_response(ss, request, &result);

	snmp_close(ss);

	return (result);
}
开发者ID:drscream,项目名称:illumos-joyent,代码行数:33,代码来源:probe-snmp.c


示例10: mp_snmp_values_fetch2

int mp_snmp_values_fetch2(netsnmp_session *ss,
                          const mp_snmp_value *values) {
    const mp_snmp_value *vp1;
    mp_snmp_query_cmd *vp2;
    size_t count;
    mp_snmp_query_cmd *oid_values = NULL;
    int rc = 0;

    for (count = 0, vp1 = values; vp1->oid; vp1++, count++)
        ;

    oid_values = (mp_snmp_query_cmd *)
        mp_malloc(count * sizeof(mp_snmp_query_cmd));

    for (vp1 = values, vp2 = oid_values; vp1->oid; vp1++, vp2++) {
        vp2->oid_len = MAX_OID_LEN;
        if (!read_objid(vp1->oid, vp2->oid, &vp2->oid_len)) {
            if (mp_verbose > 3)
                printf("Invalid OID: %s\n", vp1->oid);
            goto done;
        }
        vp2->type       = vp1->type;
        vp2->target     = vp1->target;
        vp2->target_len = vp1->target_len;
    }

    rc = mp_snmp_values_fetch1(ss, oid_values);

 done:
    free(oid_values);
    return rc;
}
开发者ID:MonitoringPlug,项目名称:monitoringplug,代码行数:32,代码来源:snmp_utils.c


示例11: main

int main(
    int argc,
    char **argv)
{
    OPEN_LOG("check_signature", LOG_USER);
    if (argc != 3)
        FATAL(MSG_USAGE);
    struct Certificate locert,
        hicert;
    struct CertificateRevocationList crl;
    Certificate(&locert, (ushort) 0);
    Certificate(&hicert, (ushort) 0);
    CertificateRevocationList(&crl, (ushort) 0);
    struct Blob blob;
    Blob(&blob, (ushort) 0);
    struct casn *tbsp,
       *sigp;
    struct AlgorithmIdentifier *algp;
    char *sfx = strchr(argv[1], (int)'.');
    int ansr;
    if (!strcmp(sfx, ".cer"))
    {
        tbsp = &locert.toBeSigned.self;
        algp = &locert.algorithm;
        sigp = &locert.signature;
        ansr = get_casn_file(&locert.self, argv[1], 0);
    }
    else if (!strcmp(sfx, ".crl"))
    {
        tbsp = &crl.toBeSigned.self;
        algp = &crl.algorithm;
        sigp = &crl.signature;
        ansr = get_casn_file(&crl.self, argv[1], 0);
    }
    else if (!strcmp(sfx, ".blb"))
    {
        tbsp = &blob.toBeSigned;
        algp = &blob.algorithm;
        sigp = &blob.signature;
        ansr = get_casn_file(&blob.self, argv[1], 0);
    }
    else
        FATAL(MSG_TYPE, argv[1]);
    if (ansr < 0)
        FATAL(MSG_GET, argv[1]);
    if (get_casn_file(&hicert.self, argv[2], 0) < 0)
        FATAL(MSG_GET, argv[2]);
    if (diff_objid(&algp->algorithm, id_sha_256WithRSAEncryption))
    {
        char oidbuf[80];
        read_objid(&algp->algorithm, oidbuf);
        FATAL(MSG_ALG, oidbuf);
    }
    if (!check_signature(tbsp, &hicert, sigp))
        fprintf(stderr, "Signature failed\n");
    fprintf(stderr, "Signature succeeded\n");
    return 0;
}
开发者ID:dseomn,项目名称:rpstir,代码行数:58,代码来源:check_signature.c


示例12: processSnmpGet

void processSnmpGet(char * oid){
	read_objid(oid, id_oid, &id_len);
    snmp_add_null_var(pdu, id_oid, id_len);
    int status = snmp_synch_response(session_handle, pdu, &response);
	for(vars = response->variables; vars; vars = vars->next_variable){
        snprint_variable(outbuff, 256, vars->name, vars->name_length, vars);
        resultString = strrchr(outbuff, ':');
    }
}
开发者ID:und3ath,项目名称:centreon_plugins,代码行数:9,代码来源:check_netapp_native.c


示例13: system_parse_config_sysObjectID

static void
system_parse_config_sysObjectID(const char *token, char *cptr)
{
    size_t sysObjectIDLength = MAX_OID_LEN;
    if (!read_objid(cptr, sysObjectID, &sysObjectIDLength)) {
	netsnmp_config_error("sysobjectid token not a parsable OID:\n\t%s",
			     cptr);
        sysObjectIDByteLength = version_sysoid_len  * sizeof(oid);
        memcpy(sysObjectID, version_sysoid, sysObjectIDByteLength);
    } else
        sysObjectIDByteLength = sysObjectIDLength * sizeof(oid);
}
开发者ID:RasmusKoldsoe,项目名称:performand.k70.2,代码行数:12,代码来源:system_mib.c


示例14: main

int main(int argc, char ** argv)
{
        struct snmp_session session;
        struct snmp_session *sess_handle;
        struct snmp_pdu *pdu;
        struct snmp_pdu *response;
        struct variable_list *vars;
        oid id_oid[MAX_OID_LEN];
        oid serial_oid[MAX_OID_LEN];
        size_t id_len = MAX_OID_LEN;
        size_t serial_len = MAX_OID_LEN;
        int status;
        struct tree * mib_tree;
        /*********************/
        if(argv[1] == NULL){
        printf("Please supply a hostname\n");
                exit(1);
        }
        init_snmp("Main check");
        snmp_sess_init( &session );
        session.version = SNMP_VERSION_1;
        session.community = "public";
        session.community_len = strlen(session.community);
        session.peername = argv[1];
        sess_handle = snmp_open(&session);
        add_mibdir(".");
        mib_tree = read_mib("mibs/SNMPv2-MIB.txt");
        pdu = snmp_pdu_create(SNMP_MSG_GET);
        read_objid("SNMPv2-MIB::sysDescr.0", id_oid, &id_len);
        snmp_add_null_var(pdu, id_oid, id_len);
        read_objid("SNMPv2-MIB::sysObjectID.0", serial_oid, &serial_len);
        snmp_add_null_var(pdu, serial_oid, serial_len);
        status = snmp_synch_response(sess_handle, pdu, &response);
        for(vars = response->variables; vars; vars = vars->next_variable)
        print_value(vars->name, vars->name_length, vars);
        snmp_free_pdu(response);
        snmp_close(sess_handle);
        return (0);
}
开发者ID:codergs,项目名称:SNMP-MIBS-Downloader,代码行数:39,代码来源:main.c


示例15: copy_word

/* read_config_read_objid(): reads an objid from a format saved by the above */
char *read_config_read_objid(char *readfrom, oid **objid, size_t *len) {

  if (objid == NULL || readfrom == NULL)
    return NULL;

  if (*objid != NULL) {
    char buf[SPRINT_MAX_LEN];

    if (strncmp(readfrom,"NULL",4) == 0) {
      /* null length oid */
      *len = 0;
    } else {
      /* read_objid is touchy with trailing stuff */
      copy_word(readfrom, buf);

      /* read the oid into the buffer passed to us */
      if (!read_objid(buf, *objid, len)) {
        DEBUGMSGTL(("read_config_read_objid","Invalid OID"));
        return NULL;
      }
    }
    
    readfrom = skip_token(readfrom);
  } else {
    if (strncmp(readfrom,"NULL",4) == 0) {
      /* null length oid */
      *len = 0;
      readfrom = skip_token(readfrom);
    } else {
      /* space needs to be malloced.  Call ourself recursively to figure
       out how long the oid actually is */
      oid obuf[MAX_OID_LEN];
      size_t obuflen = MAX_OID_LEN;
      oid *oidp = obuf;
      oid **oidpp = &oidp;   /* done this way for odd, untrue, gcc warnings */

      readfrom = read_config_read_objid(readfrom, oidpp, &obuflen);

      /* Then malloc and copy the results */
      *len = obuflen;
      if (*len > 0 && (*objid = (oid*)malloc(*len * sizeof(oid))) == NULL)
        return NULL;

      if (obuflen > 0)
        memcpy(*objid, obuf, obuflen*sizeof(oid));
    }
  }
  return readfrom;
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:50,代码来源:read_config.c


示例16: process_stdin

void
process_stdin(void)
{
    char        buf[MAX_LINE_TEMP];
    oid         name[MAX_OID_LEN];
    size_t      name_length;

    while ( NULL != fgets( buf, sizeof( buf ), stdin ) ) {
        char delim = ' ';
        char *nl = strchr(buf, '\n');
        char *rest = strchr(buf, delim);

        if (nl != NULL) {
            *nl = '\0';
        } /* else too-long line: output will look weird.  Too bad. */
        if (rest == NULL) {
            delim = '\t';
            rest = strchr(buf, delim);
        }
        if (rest != NULL) {
            *rest++ = '\0';
        }
        name_length = MAX_OID_LEN;
        /*
         * If it's not the whole line, only try to process buffer
         * longer than 5 characters.
         * The idea is to avoid false positives including, e.g.,
         * a hex dump.
         */
        if ( !(rest && strlen( buf ) <= 5) &&
              read_objid( buf, name, &name_length )) {
            char objbuf[MAX_LINE_TEMP];
            snprint_objid( objbuf, MAX_LINE_TEMP, name, name_length );
            fputs( objbuf, stdout );
        } else {
            fputs( buf, stdout );
        }
        /*
         * For future improvement: if delim == ' ' && rest && *rest == '='
         * see if rest looks like snmpget/snmpwalk output
         * and handle it in the context of the given node
         */
        if (rest) {
            fputc( delim, stdout );
            fputs( rest, stdout );
        }
        fputc( '\n', stdout );
    }
}
开发者ID:ClausKlein,项目名称:net-snmp,代码行数:49,代码来源:snmptranslate.c


示例17: system_parse_config_sysObjectID

void system_parse_config_sysObjectID(const char *token, char *cptr)
{
    char tmpbuf[1024];

    sysObjectIDLength = MAX_OID_LEN;
    if (!read_objid(cptr, sysObjectID, &sysObjectIDLength)) {
        snprintf(tmpbuf,
                 sizeof(tmpbuf),
                 "sysobjectid token not a parsable OID:\n\t%s",
                 cptr);
        config_perror(tmpbuf);
        memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
        sysObjectIDLength = version_sysoid_len;
    }
}
开发者ID:Undrizzle,项目名称:apps,代码行数:15,代码来源:system_mib.c


示例18: mp_snmp_subtree_query_string

int mp_snmp_subtree_query_string(netsnmp_session *ss, const char *subtree_oid,
                           mp_snmp_subtree *subtree) {
    oid subtree_oid_prefix[MAX_OID_LEN];
    size_t subtree_oid_prefix_len = MAX_OID_LEN;

    if (!read_objid(subtree_oid, subtree_oid_prefix, &subtree_oid_prefix_len)) {
        if (mp_verbose > 3)
            printf("Invalid OID: %s\n", subtree_oid);

        return 0;
    }

    return mp_snmp_subtree_query(ss, subtree_oid_prefix,
                                  subtree_oid_prefix_len, subtree);
}
开发者ID:MonitoringPlug,项目名称:monitoringplug,代码行数:15,代码来源:snmp_utils.c


示例19: MPC_write

/*
 * write value of given oid
 */
static int
MPC_write(struct snmp_session *sptr, const char *objname, char type,
          char *value)
{
    oid name[MAX_OID_LEN];
    size_t namelen = MAX_OID_LEN;
    struct snmp_pdu *pdu;
    struct snmp_pdu *resp;

    DEBUGCALL;

    /* convert objname into oid; return FALSE if invalid */
    if (!read_objid(objname, name, &namelen)) {
        LOG(PIL_CRIT, "%s: cannot convert %s to oid.", __FUNCTION__, objname);
        return (FALSE);
    }

    /* create pdu */
    if ((pdu = snmp_pdu_create(SNMP_MSG_SET)) != NULL) {

        /* add to be written value to pdu */
        snmp_add_var(pdu, name, namelen, type, value);

        /* send pdu and get response; return NULL if error */
        if (snmp_synch_response(sptr, pdu, &resp) == STAT_SUCCESS) {

            /* go through the returned vars */
            if (resp->errstat == SNMP_ERR_NOERROR) {

                /* request successful done */
                snmp_free_pdu(resp);
                return (TRUE);

            } else {
                LOG(PIL_CRIT, "%s: error in response packet, reason %ld [%s]."
                    ,   __FUNCTION__, resp->errstat, snmp_errstring(resp->errstat));
            }
        } else {
            MPC_error(sptr, __FUNCTION__, "error sending/receiving pdu");
        }
        /* free pdu (again: necessary?) */
        snmp_free_pdu(resp);
    } else {
        MPC_error(sptr, __FUNCTION__, "cannot create pdu");
    }
    /* error */
    return (FALSE);
}
开发者ID:ingted,项目名称:cluster-glue,代码行数:51,代码来源:wti_mpc.c


示例20:

oid
*snmp_parse_oid(char *argv,
		oid *root,
		int *rootlen)
{
  if (random_access) {
    if (get_node(argv,root,rootlen)) {
      return root;
    }
  } else {
    if (read_objid(argv,root,rootlen)) {
      return root;
    }
  }
  return NULL;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:16,代码来源:snmp_parse_args.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ read_part_sector函数代码示例发布时间:2022-05-30
下一篇:
C++ read_next_x函数代码示例发布时间: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