亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? snmpwalkthreads.cpp

?? JdonFramework need above jdk 1.4.0 This version has passed under Tomcat 4.x/5.x JBoss 3.x/JBoss 4.0
?? CPP
字號:
/*_############################################################################  _##   _##  snmpWalkThreads.cpp    _##  _##  SNMP++v3.2.21a  _##  -----------------------------------------------  _##  Copyright (c) 2001-2006 Jochen Katz, Frank Fock  _##  _##  This software is based on SNMP++2.6 from Hewlett Packard:  _##    _##    Copyright (c) 1996  _##    Hewlett-Packard Company  _##    _##  ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.  _##  Permission to use, copy, modify, distribute and/or sell this software   _##  and/or its documentation is hereby granted without fee. User agrees   _##  to display the above copyright notice and this license notice in all   _##  copies of the software and any documentation of the software. User   _##  agrees to assume all liability for the use of the software;   _##  Hewlett-Packard and Jochen Katz make no representations about the   _##  suitability of this software for any purpose. It is provided   _##  "AS-IS" without warranty of any kind, either express or implied. User   _##  hereby grants a royalty-free license to any and all derivatives based  _##  upon this software code base.   _##    _##  Stuttgart, Germany, Tue Nov 21 22:12:16 CET 2006   _##    _##########################################################################*//*  snmpWalk.cpp     Copyright (c) 1996  Hewlett-Packard Company  ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.  Permission to use, copy, modify, distribute and/or sell this software  and/or its documentation is hereby granted without fee. User agrees  to display the above copyright notice and this license notice in all  copies of the software and any documentation of the software. User  agrees to assume all liability for the use of the software; Hewlett-Packard  makes no representations about the suitability of this software for any  purpose. It is provided "AS-IS" without warranty of any kind,either express  or implied. User hereby grants a royalty-free license to any and all  derivatives based upon this software code base.  Peter E. Mellquist*/char snmpwalkthreads_cpp_version[]="@(#) SNMP++ $Id: snmpWalkThreads.cpp,v 1.9 2006/06/16 20:53:15 fock Exp $";#include "snmp_pp/snmp_pp.h"#include "snmp_pp/reentrant.h"#include <stdlib.h>#include <stdio.h>#ifdef SNMP_PP_NAMESPACEusing namespace Snmp_pp;#endif#if (__GNUC__ > 2)#include <iostream>using std::cerr;using std::cout;using std::endl;using std::flush;#else#include <iostream.h>#endif#ifdef _THREADSstatic pthread_attr_t* attr = 0;#ifdef _WIN32THREADS#error "This example is not available on WIN32 platforms!"#endif#endifUdpAddress address[1000];Snmp* snmp = 0;snmp_version version=version1;                       // default is v1int retries=1;                                       // default retries is 1int timeout=100;                                     // default is 1 secondu_short port=161;                                    // default snmp port is 161OctetStr community("public");                        // read community#ifdef _SNMPv3OctetStr privPassword("");OctetStr authPassword("");OctetStr securityName("");int securityModel = SecurityModel_USM;int securityLevel = SecurityLevel_authPriv;OctetStr contextName("");OctetStr contextEngineID("");long authProtocol = SNMPv3_usmNoAuthProtocol;long privProtocol = SNMPv3_usmNoPrivProtocol;#endif#define BULK_MAX 10SnmpSynchronized ssync;void* runable(void *data) {  //--------[ build up SNMP++ object needed ]-------------------------------  ssync.lock();  printf("HELLO:%s\n", community.get_printable());  int t = *((int*)data);  Pdu pdu;                              // construct a Pdu object  Vb vb;                                // construct a Vb object  vb.set_oid("1");                     // set the Oid portion of the Vb  pdu += vb;                            // add the vb to the Pdu  CTarget ctarget(address[t]);            // make a target using the address#ifdef _SNMPv3  UTarget utarget(address[t]);  if (version == version3) {    utarget.set_version( version);          // set the SNMP version SNMPV1 or V2 or V3    utarget.set_retry( retries);            // set the number of auto retries    utarget.set_timeout( timeout);          // set timeout    utarget.set_security_model( securityModel);    utarget.set_security_name( securityName);    pdu.set_security_level( securityLevel);    pdu.set_context_name (contextName);    pdu.set_context_engine_id(contextEngineID);  }  else {#endif    ctarget.set_version( version);          // set the SNMP version SNMPV1 or V2 or V3    ctarget.set_retry( retries);            // set the number of auto retries    ctarget.set_timeout( timeout);          // set timeout    ctarget.set_readcommunity( community);  // set the read community to use    ctarget.set_writecommunity( community);#ifdef _SNMPv3  }#endif  //-------[ issue the request, blocked mode ]-----------------------------  cout << "(" << t << "): "        << "SNMP++ snmpWalk to " << address[t].get_printable() << " SNMPV" #ifdef _SNMPv3       << ((version==version3) ? (version) : (version+1)) #else       << (version+1) #endif       << " Retries=" << retries       << " Timeout=" << timeout * 10 <<"ms";#ifdef _SNMPv3  if (version == version3)    cout << endl 	 << "securityName= " << securityName.get_printable()	 << ", securityLevel= " << securityLevel	 << ", securityModel= " << securityModel << endl	 << "contextName= " << contextName.get_printable()	 << ", contextEngineID= " << contextEngineID.get_printable()	 << endl;  else#endif    cout << " Community=" << community.get_printable() << endl << flush;  SnmpTarget *target;#ifdef _SNMPv3  if (version == version3)    target = &utarget;  else#endif    target = &ctarget;  int status = 0;  int requests = 0;  int objects = 0;  ssync.unlock();  while (( status = snmp->get_bulk( pdu,*target,0,BULK_MAX))	 == SNMP_CLASS_SUCCESS)  {    requests++;    ssync.lock();    for ( int z=0;z<pdu.get_vb_count(); z++) {      pdu.get_vb( vb,z);#ifdef _SNMPv3      if (pdu.get_type() == REPORT_MSG) {	Oid tmp;	vb.get_oid(tmp);	cout << "(" << t << "): " << "Received a reportPdu: "	     << snmp->error_msg( tmp) 	     << endl	     << vb.get_printable_oid() << " = "	     << vb.get_printable_value() << endl;	ssync.unlock();	return 0;      }#endif      objects++;      // look for var bind exception, applies to v2 only         if ( vb.get_syntax() != sNMP_SYNTAX_ENDOFMIBVIEW) {	cout <<  "(" << t << "): " 	     << vb.get_printable_oid() << " = ";	cout << vb.get_printable_value() << "\n";      }      else {	cout <<  "(" << t << "): " 	     << "End of MIB Reached\n";	cout <<  "(" << t << "): " 	     << "Total # of Requests = " << requests << "\n";	cout <<  "(" << t << "): "	     << "Total # of Objects  = " << objects  << "\n";	ssync.unlock();	return 0;      }    }    ssync.unlock();    // last vb becomes seed of next rquest    pdu.set_vblist(&vb, 1);  }  if ( status != SNMP_ERROR_NO_SUCH_NAME)    cout <<  "(" << t << "): "	 << "SNMP++ snmpWalk Error, " << snmp->error_msg( status) << "\n";  cout <<  "(" << t << "): "       << "Total # of Requests = " << requests << "\n";  cout <<  "(" << t << "): "       << "Total # of Objects  = " << objects  << "\n";  return 0;}  // end Walk int main(int argc, char **argv){  //---------[ check the arg count ]----------------------------------------  if ( argc < 2) {	  cout << "Usage:\n";	  cout << "snmpWalkThreads host/port [host/port]... [options]\n";	  cout << "StartOid: 1\n";	  cout << "options: -vN , use SNMP version 1, 2 or 3, default is 1\n";	  cout << "         -PPort , remote port to use\n";	  cout << "         -CCommunity_name, specify community default is 'public' \n";	  cout << "         -rN , retries default is N = 1 retry\n";	  cout << "         -tN , timeout in hundredths of seconds; default is N = 100\n";#ifdef _SNMPv3          cout << "         -snSecurityName, " << endl;          cout << "         -slN , securityLevel to use, default N = 3 = authPriv" << endl;          cout << "         -smN , securityModel to use, only default N = 3 = USM possible\n";          cout << "         -cnContextName, default empty string" << endl;          cout << "         -ceContextEngineID, as hex e.g. 800007E580, default empty string" << endl;          cout << "         -authPROT, use authentication protocol NONE, SHA or MD5\n";          cout << "         -privPROT, use privacy protocol NONE, DES, 3DESEDE, IDEA, AES128, AES192 or AES256\n";          cout << "         -uaAuthPassword\n";          cout << "         -upPrivPassword\n";#endif          return 0;  }  Snmp::socket_startup();  // Initialize socket subsystem  //---------[ make a GenAddress and Oid object to retrieve ]---------------  address[0] = UdpAddress(argv[1]);  if ( !address[0].valid()) {           // check validity of address    cout << "Invalid Address or DNS Name, " << argv[1] << "\n";    return -1;  }  int x=2;  while ((x<argc) && (x<100) && (strstr(argv[x],"-")==0)) {    address[x-1] = UdpAddress(argv[x]);    if ( !address[x-1].valid()) {           // check validity of address      cout << "Invalid Address or DNS Name, " << argv[x] << "\n";      return -1;    }         x++;  }  int threads = x-1;  cout << community.get_printable() << endl;   //---------[ determine options to use ]-----------------------------------   char *ptr;   for(;x<argc;x++) {                           // parse for version     if ( strstr( argv[x],"-v2")!= 0) {       version = version2c;       continue;     }     if ( strstr( argv[x],"-r")!= 0) {                 // parse for retries       ptr = argv[x]; ptr++; ptr++;       retries = atoi(ptr);       if (( retries<0)|| (retries>5)) retries=1;        continue;     }     if ( strstr( argv[x], "-t")!=0) {                 // parse for timeout       ptr = argv[x]; ptr++; ptr++;       timeout = atoi( ptr);       if (( timeout < 100)||( timeout>500)) timeout=100;       continue;     }     if ( strstr( argv[x],"-C")!=0) {       ptr = argv[x]; ptr++; ptr++;       community = ptr;       continue;     }     if ( strstr( argv[x],"-P")!=0) {       ptr = argv[x]; ptr++; ptr++;       sscanf(ptr, "%hu", &port);       continue;     }#ifdef _SNMPv3     if ( strstr( argv[x],"-v3")!= 0) {       version = version3;       continue;     }     if ( strstr( argv[x],"-auth") != 0) {       ptr = argv[x]; ptr+=5;       if (strcasecmp(ptr, "SHA") == 0)	   authProtocol = SNMP_AUTHPROTOCOL_HMACSHA;       else if (strcasecmp(ptr, "MD5") == 0)	   authProtocol = SNMP_AUTHPROTOCOL_HMACMD5;       else	   authProtocol = SNMP_AUTHPROTOCOL_NONE;       continue;     }     if ( strstr( argv[x],"-priv") != 0) {       ptr = argv[x]; ptr+=5;       if (strcasecmp(ptr, "DES") == 0)	   privProtocol = SNMP_PRIVPROTOCOL_DES;       else if (strcasecmp(ptr, "3DESEDE") == 0)	   privProtocol = SNMP_PRIVPROTOCOL_3DESEDE;       else if (strcasecmp(ptr, "IDEA") == 0)	   privProtocol = SNMP_PRIVPROTOCOL_IDEA;       else if (strcasecmp(ptr, "AES128") == 0)	   privProtocol = SNMP_PRIVPROTOCOL_AES128;       else if (strcasecmp(ptr, "AES192") == 0)	   privProtocol = SNMP_PRIVPROTOCOL_AES192;       else if (strcasecmp(ptr, "AES256") == 0)	   privProtocol = SNMP_PRIVPROTOCOL_AES256;       else	   privProtocol = SNMP_PRIVPROTOCOL_NONE;       printf("\n\nPrivProt : %ld\n", privProtocol);       continue;     }     if ( strstr( argv[x],"-sn")!=0) {       ptr = argv[x]; ptr+=3;       securityName = ptr;       continue;      }     if ( strstr( argv[x], "-sl")!=0) {       ptr = argv[x]; ptr+=3;       securityLevel = atoi( ptr);       if (( securityLevel < SecurityLevel_noAuthNoPriv) ||           ( securityLevel > SecurityLevel_authPriv))         securityLevel = SecurityLevel_authPriv;       continue;     }     if ( strstr( argv[x], "-sm")!=0) {       ptr = argv[x]; ptr+=3;       securityModel = atoi( ptr);       if (( securityModel < SecurityModel_v1) ||           ( securityModel > SecurityModel_USM))         securityModel = SecurityModel_USM;       continue;     }     if ( strstr( argv[x],"-cn")!=0) {       ptr = argv[x]; ptr+=3;       contextName = ptr;       continue;     }     if ( strstr( argv[x],"-ce")!=0) {       ptr = argv[x]; ptr+=3;       contextEngineID = OctetStr::from_hex_string(ptr);       continue;     }     if ( strstr( argv[x],"-ua")!=0) {       ptr = argv[x]; ptr+=3;       authPassword = ptr;       continue;     }     if ( strstr( argv[x],"-up")!=0) {       ptr = argv[x]; ptr+=3;       privPassword = ptr;       continue;     }#endif   }   //----------[ create a SNMP++ session ]-----------------------------------   int status;   // bind to any port and use IPv6 if enabled#ifdef SNMP_PP_IPv6   snmp = new Snmp(status, 0, true);#else   snmp = new Snmp(status);#endif   if ( status != SNMP_CLASS_SUCCESS) {     cout << "SNMP++ Session Create Fail, " 	  << snmp->error_msg(status) << "\n";     return -3;   }#ifdef _SNMPv3   //---------[ init SnmpV3 ]--------------------------------------------   v3MP *v3_MP;   if (version == version3) {     char *engineId = "snmpWalk";     char *filename = "snmpv3_boot_counter";     unsigned int snmpEngineBoots = 0;     int status;     status = getBootCounter(filename, engineId, snmpEngineBoots);     if ((status != SNMPv3_OK) && (status < SNMPv3_FILEOPEN_ERROR))     {       cout << "Error loading snmpEngineBoots counter: " << status << endl;       return 1;     }     snmpEngineBoots++;     status = saveBootCounter(filename, engineId, snmpEngineBoots);     if (status != SNMPv3_OK)     {       cout << "Error saving snmpEngineBoots counter: " << status << endl;       return 1;     }     int construct_status;     v3_MP = new v3MP(engineId, snmpEngineBoots, construct_status);     USM *usm = v3_MP->get_usm();     usm->add_usm_user(securityName,		       authProtocol, privProtocol,		       authPassword, privPassword);   }   else   {     // MUST create a dummy v3MP object if _SNMPv3 is enabled!     int construct_status;     v3_MP = new v3MP("dummy", 0, construct_status);   }#endif#ifdef _THREADS  pthread_t thread[100];  int started = threads;#endif  while (threads) {#ifdef _THREADS    if (!attr) {      attr = new pthread_attr_t;      pthread_attr_init(attr);      pthread_attr_setdetachstate(attr, PTHREAD_CREATE_JOINABLE);    }    pthread_create(&thread[threads-1], 0, 		   &runable,		   (void*)new int(threads-1));#else    int n = threads - 1;    runable(&n);#endif    threads--;  }#ifdef _THREADS  // wait for threads to terminate  for (int i=0; i<started; i++) {    cout << "JOINING THREAD " << i << endl;    pthread_join(thread[i], 0);  }#endif  cout << "END" << endl;  Snmp::socket_cleanup();  // Shut down socket subsystem}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美性猛交xxxx黑人交| 一二三四社区欧美黄| 狠狠狠色丁香婷婷综合激情| 欧美日韩国产综合一区二区| 视频一区在线播放| 日韩欧美国产1| 国产一区亚洲一区| 国产精品麻豆欧美日韩ww| 99久久99久久久精品齐齐| 一区二区三区欧美久久| 欧美日韩一二区| 美女www一区二区| 国产婷婷一区二区| 色一区在线观看| 丝袜美腿高跟呻吟高潮一区| 欧美电视剧在线看免费| 成人av资源在线| 亚洲va欧美va人人爽午夜| 日韩视频一区二区在线观看| 国产suv精品一区二区三区| 亚洲女子a中天字幕| 69堂成人精品免费视频| 国产麻豆精品久久一二三| 亚洲精品视频自拍| 欧美电视剧在线观看完整版| 成人av中文字幕| 日韩精品免费视频人成| 国产丝袜欧美中文另类| 91福利视频网站| 国产露脸91国语对白| 一区二区高清视频在线观看| 精品少妇一区二区三区日产乱码| 99re在线视频这里只有精品| 日韩成人伦理电影在线观看| 中文字幕久久午夜不卡| 欧美日韩国产精品自在自线| 国产馆精品极品| 午夜影视日本亚洲欧洲精品| 中文字幕精品在线不卡| 欧美一二三区精品| 色婷婷av一区二区三区大白胸 | 国产精品第13页| 91精品在线免费观看| 成人福利电影精品一区二区在线观看| 亚洲一二三四区| 欧美高清在线一区二区| 欧美一二区视频| 91论坛在线播放| 国产不卡在线一区| 久久精品国产99国产精品| 一区二区在线观看视频在线观看| 久久综合九色综合97婷婷女人| 欧美视频在线观看一区二区| 99天天综合性| 国产在线精品一区二区不卡了| 午夜精品一区二区三区电影天堂| 自拍偷拍国产亚洲| 国产精品久久久久影院老司| 精品国产乱码久久久久久免费| 色婷婷久久99综合精品jk白丝| 成人v精品蜜桃久久一区| 国产麻豆精品一区二区| 麻豆国产欧美一区二区三区| 舔着乳尖日韩一区| 亚洲成人av免费| 亚洲夂夂婷婷色拍ww47| 一区二区三区日韩在线观看| 亚洲欧洲另类国产综合| 国产精品美女视频| 国产精品国产自产拍在线| 久久久久综合网| 久久综合色一综合色88| 欧美成人一区二区三区在线观看| 69堂成人精品免费视频| 欧美日韩国产综合草草| 欧美日韩一区在线观看| 欧美日韩免费视频| 欧美日韩国产区一| 91精品国产乱码| 日韩亚洲电影在线| 精品国产青草久久久久福利| 精品人在线二区三区| 日韩三级电影网址| 精品欧美一区二区久久| 久久影院午夜论| 亚洲国产精华液网站w| 国产精品亲子伦对白| 国产精品久久综合| 一区二区免费在线播放| 日欧美一区二区| 蓝色福利精品导航| 国产高清精品网站| 成人黄色a**站在线观看| 日本久久一区二区三区| 欧美精品自拍偷拍| 精品国产91乱码一区二区三区| 久久久久久久久99精品| ㊣最新国产の精品bt伙计久久| 最新不卡av在线| 日日摸夜夜添夜夜添亚洲女人| 免费xxxx性欧美18vr| 东方欧美亚洲色图在线| 日本韩国欧美三级| 日韩三级在线观看| 国产精品美女一区二区三区| 亚洲一区二区影院| 免费成人小视频| av在线一区二区三区| 欧美四级电影网| 久久久久97国产精华液好用吗| 亚洲人成在线播放网站岛国| 亚洲成人免费在线观看| 国产在线精品一区二区三区不卡 | 美国av一区二区| 国产不卡视频在线播放| 欧美在线小视频| 久久日韩精品一区二区五区| 亚洲欧美日韩国产一区二区三区 | 日韩欧美一级二级三级久久久| 国产亚洲欧美一区在线观看| 一级做a爱片久久| 狠狠色综合日日| 欧美综合在线视频| 久久久久久久久99精品| 性做久久久久久久免费看| 国产伦精品一区二区三区在线观看| 91网站最新网址| 欧美大片国产精品| 亚洲一区在线电影| 成人国产一区二区三区精品| 在线播放欧美女士性生活| 国产精品电影一区二区| 久久精品国产亚洲一区二区三区| 色婷婷国产精品| 国产日韩亚洲欧美综合| 日韩黄色一级片| 色哟哟国产精品| 国产精品久99| 国产综合久久久久影院| 欧美精品九九99久久| 亚洲图片欧美激情| 国产免费成人在线视频| www.亚洲人| 精品国产91洋老外米糕| 黑人精品欧美一区二区蜜桃| 成人国产精品免费| 91精品国产乱码久久蜜臀| 亚洲男人的天堂av| 国产成人精品www牛牛影视| 91精品国产综合久久国产大片 | 精品日韩99亚洲| 午夜久久久久久久久| 色欧美日韩亚洲| 一区在线播放视频| 国产高清不卡二三区| 精品粉嫩超白一线天av| 日韩综合小视频| 在线欧美一区二区| 亚洲欧洲综合另类| 9色porny自拍视频一区二区| 国产性色一区二区| 狠狠色丁香婷综合久久| 日韩女优制服丝袜电影| 蜜臀a∨国产成人精品| 欧美日韩国产123区| 夜夜爽夜夜爽精品视频| 波多野结衣中文字幕一区| 国产片一区二区| 国产欧美一区二区在线观看| 91一区二区三区在线观看| 久久国产精品99久久人人澡| 亚洲午夜一区二区三区| 91福利小视频| 亚洲国产日韩精品| 欧美日韩黄色影视| 蜜桃一区二区三区在线| 精品成人一区二区三区| 国产精品一区在线| 国产精品久久久久久一区二区三区 | 成人免费电影视频| 亚洲国产精品高清| 97久久精品人人做人人爽50路| 国产精品福利一区| 91美女片黄在线观看91美女| 亚洲小说欧美激情另类| 在线播放中文一区| 久久99精品视频| 欧美激情综合网| 91色porny蝌蚪| 爽爽淫人综合网网站| 欧美zozo另类异族| 国产69精品久久久久777| 中文久久乱码一区二区| 91在线观看污| 日韩专区欧美专区| 7777女厕盗摄久久久| 欧美精品亚洲二区| 一区二区中文视频| 精品视频1区2区3区| 久久精品72免费观看|