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

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

?? snmp.java

?? /*_############################################################################ _## _## SNMP4J -
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/*_############################################################################
  _##
  _##  SNMP4J - Snmp.java
  _##
  _##  Copyright 2003-2007  Frank Fock and Jochen Katz (SNMP4J.org)
  _##
  _##  Licensed under the Apache License, Version 2.0 (the "License");
  _##  you may not use this file except in compliance with the License.
  _##  You may obtain a copy of the License at
  _##
  _##      http://www.apache.org/licenses/LICENSE-2.0
  _##
  _##  Unless required by applicable law or agreed to in writing, software
  _##  distributed under the License is distributed on an "AS IS" BASIS,
  _##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  _##  See the License for the specific language governing permissions and
  _##  limitations under the License.
  _##
  _##########################################################################*/

package org.snmp4j;

import java.io.IOException;
import java.util.*;

import org.snmp4j.event.*;
import org.snmp4j.log.*;
import org.snmp4j.mp.*;
import org.snmp4j.security.*;
import org.snmp4j.smi.*;
import org.snmp4j.transport.TransportMappings;
import org.snmp4j.transport.ConnectionOrientedTransportMapping;

/**
 * The <code>Snmp</code> class is the core of SNMP4J. It provides functions to
 * send and receive SNMP PDUs. All SNMP PDU types can be send. Confirmed
 * PDUs can be sent synchronously and asynchronously.
 * <p>
 * The <code>Snmp</code> class is transport protocol independent. Support for
 * a specific {@link TransportMapping} instance is added by calling the
 * {@link #addTransportMapping(TransportMapping transportMapping)} method or
 * creating a <code>Snmp</code> instance by using the non-default constructor
 * with the corresponding transport mapping. Transport mappings are used
 * for incoming and outgoing messages.
 * <p>
 * To setup a default SNMP session for UDP transport and with SNMPv3 support
 * the following code snippet can be used:
 * <p>
 * <pre>
 *   Address targetAddress = GenericAddress.parse("udp:127.0.0.1/161");
 *   TransportMapping transport = new DefaultUdpTransportMapping();
 *   snmp = new Snmp(transport);
 *   USM usm = new USM(SecurityProtocols.getInstance(),
 *                     new OctetString(MPv3.createLocalEngineID()), 0);
 *   SecurityModels.getInstance().addSecurityModel(usm);
 *   transport.listen();
 * </pre>
 * <p>
 * How a synchronous SNMPv3 message with authentication and privacy is then
 * sent illustrates the following code snippet:
 * <p>
 * <pre>
 *   // add user to the USM
 *   snmp.getUSM().addUser(new OctetString("MD5DES"),
 *                         new UsmUser(new OctetString("MD5DES"),
 *                                     AuthMD5.ID,
 *                                     new OctetString("MD5DESUserAuthPassword"),
 *                                     PrivDES.ID,
 *                                     new OctetString("MD5DESUserPrivPassword")));
 *   // create the target
 *   UserTarget target = new UserTarget();
 *   target.setAddress(targetAddress);
 *   target.setRetries(1);
 *   target.setTimeout(5000);
 *   target.setVersion(SnmpConstants.version3);
 *   target.setSecurityLevel(SecurityLevel.AUTH_PRIV);
 *   target.setSecurityName(new OctetString("MD5DES"));
 *
 *   // create the PDU
 *   PDU pdu = new ScopedPDU();
 *   pdu.add(new VariableBinding(new OID("1.3.6")));
 *   pdu.setType(PDU.GETNEXT);
 *
 *   // send the PDU
 *   ResponseEvent response = snmp.send(pdu, target);
 *   // extract the response PDU (could be null if timed out)
 *   PDU responsePDU = response.getResponse();
 *   // extract the address used by the agent to send the response:
 *   Address peerAddress = response.getPeerAddress();
 * </pre>
 * <p>
 * An asynchronous SNMPv1 request is sent by the following code:
 * <pre>
 *   // setting up target
 *   CommunityTarget target = new CommunityTarget();
 *   target.setCommunity(new OctetString("public"));
 *   target.setAddress(targetAddress);
 *   target.setRetries(2);
 *   target.setTimeout(1500);
 *   target.setVersion(SnmpConstants.version1);
 *   // creating PDU
 *   PDU pdu = new PDU();
 *   pdu.add(new VariableBinding(new OID(new int[] {1,3,6,1,2,1,1,1})));
 *   pdu.add(new VariableBinding(new OID(new int[] {1,3,6,1,2,1,1,2})));
 *   pdu.setType(PDU.GETNEXT);
 *   // sending request
 *   ResponseListener listener = new ResponseListener() {
 *     public void onResponse(ResponseEvent event) {
 *       // Always cancel async request when response has been received
 *       // otherwise a memory leak is created! Not canceling a request
 *       // immediately can be useful when sending a request to a broadcast
 *       // address.
 *       ((Snmp)event.getSource()).cancel(event.getRequest(), this);
 *       System.out.println("Received response PDU is: "+event.getResponse());
 *     }
 *   };
 *   snmp.sendPDU(pdu, target, null, listener);
 * </pre>
 * </p>
 * Traps (notifications) and other SNMP PDUs can be received by adding the
 * folling code to the first code snippet above:
 * <pre>
 *   CommandResponder trapPrinter = new CommandResponder() {
 *     public synchronized void processPdu(CommandResponderEvent e) {
 *       PDU command = e.getPdu();
 *       if (command != null) {
 *         System.out.println(command.toString());
 *       }
 *     }
 *   };
 *   snmp.addCommandResponder(trapPrinter);
 * </pre>
 * </p>
 *
 * @author Frank Fock
 * @version 1.8
 */
public class Snmp implements Session, CommandResponder {

  private static final LogAdapter logger = LogFactory.getLogger(Snmp.class);

  // Message processing implementation
  private MessageDispatcher messageDispatcher;

  /**
   * The <code>pendingRequests</code> table contains pending requests
   * accessed trough the key <code>PduHandle</code>
   */
  private Hashtable pendingRequests = new Hashtable(50);

  /**
   * The <code>asyncRequests</code> table contains pending requests
   * accessed trough the key userObject
   */
  private Hashtable asyncRequests = new Hashtable(50);

  // Timer for retrying pending requests
  private Timer timer = new Timer(true);

  // Listeners for request and trap PDUs
  private transient Vector commandResponderListeners;

  private TimeoutModel timeoutModel = new DefaultTimeoutModel();

  // Dispatcher for notification listeners - not needed by default
  private NotificationDispatcher notificationDispatcher = null;

  // Default ReportHandler
  private ReportHandler reportHandler = new ReportProcessor();

  /**
   * Creates a <code>Snmp</code> instance that uses a
   * <code>MessageDispatcherImpl</code> with no message processing
   * models and no security protols (by default). You will have to add
   * those by calling the appropriate methods on
   * {@link #getMessageDispatcher()}.
   * <p>
   * At least one transport mapping has to be added before {@link #listen()}
   * is called in order to be able to send and receive SNMP messages.
   */
  public Snmp() {
    this.messageDispatcher = new MessageDispatcherImpl();
  }

  /**
   * Interface for handling reports.
   *
   * @author Frank Fock
   * @version 1.6
   * @since 1.6
   */
  public static interface ReportHandler {
    void processReport(PduHandle pduHandle, CommandResponderEvent event);
  }

  protected final void initMessageDispatcher() {
    this.messageDispatcher.addCommandResponder(this);
    this.messageDispatcher.addMessageProcessingModel(new MPv2c());
    this.messageDispatcher.addMessageProcessingModel(new MPv1());
    this.messageDispatcher.addMessageProcessingModel(new MPv3());
    SecurityProtocols.getInstance().addDefaultProtocols();
  }

  /**
   * Creates a <code>Snmp</code> instance that uses a
   * <code>MessageDispatcherImpl</code> with all supported message processing
   * models and the default security protols for dispatching.
   *
   * @param transportMapping TransportMapping
   *    the initial <code>TransportMapping</code>. You can add more or remove
   *    the same later.
   */
  public Snmp(TransportMapping transportMapping) {
    this();
    initMessageDispatcher();
    if (transportMapping != null) {
      addTransportMapping(transportMapping);
    }
  }

  /**
   * Creates a <code>Snmp</code> instance by supplying a <code>
   * MessageDispatcher</code> and a <code>TransportMapping</code>.
   * <p>
   * As of version 1.1, the supplied message dispatcher is not altered
   * in terms of adding any message processing models to it. This has to be
   * done now outside the Snmp class.
   *
   * @param messageDispatcher
   *    a <code>MessageDispatcher</code> instance that will be used to
   *    dispatch incoming and outgoing messages.
   * @param transportMapping
   *    the initial <code>TransportMapping</code>,
   *    which may be <code>null</code>. You can add or remove transport
   *    mappings later using {@link #addTransportMapping} and
   *    {@link #removeTransportMapping} respectively.
   */
  public Snmp(MessageDispatcher messageDispatcher,
              TransportMapping transportMapping) {
    this.messageDispatcher = messageDispatcher;
    this.messageDispatcher.addCommandResponder(this);
    if (transportMapping != null) {
      addTransportMapping(transportMapping);
    }
  }

  /**
   * Creates a <code>Snmp</code> instance by supplying a <code>
   * MessageDispatcher</code>.
   * <p>
   * The supplied message dispatcher is not altered
   * in terms of adding any message processing models to it. This has to be
   * done now outside the Snmp class.
   * </p>
   * <p>
   * Do not forget to add at least one transport mapping before calling the
   * listen method!
   * </p>
   * @param messageDispatcher
   *    a <code>MessageDispatcher</code> instance that will be used to
   *    dispatch incoming and outgoing messages.
   * @since 1.5
   */
  public Snmp(MessageDispatcher messageDispatcher) {
    this.messageDispatcher = messageDispatcher;
    this.messageDispatcher.addCommandResponder(this);
  }

  /**
   * Returns the message dispatcher associated with this SNMP session.
   * @return
   *   a <code>MessageDispatcher</code> instance.
   * @since 1.1
   */
  public MessageDispatcher getMessageDispatcher() {
    return messageDispatcher;
  }

  /**
   * Adds a <code>TransportMapping</code> to this SNMP session.
   * @param transportMapping
   *    a <code>TransportMapping</code> instance.
   */
  public void addTransportMapping(TransportMapping transportMapping) {
    // connect transport mapping with message dispatcher
    messageDispatcher.addTransportMapping(transportMapping);
    transportMapping.addTransportListener(messageDispatcher);
  }

  /**
   * Removes the specified transport mapping from this SNMP session.
   * If the transport mapping is not currently part of this SNMP session,
   * this method will have no effect.
   * @param transportMapping
   *    a previously added <code>TransportMapping</code>.
   */
  public void removeTransportMapping(TransportMapping transportMapping) {
    messageDispatcher.removeTransportMapping(transportMapping);
    transportMapping.removeTransportListener(messageDispatcher);
  }

  /**
   * Adds a notification listener to this Snmp instance. Calling this method
   * will create a transport mapping for the specified listening address and
   * registers the provided <code>CommandResponder</code> with the internal
   * <code>NotificationDispatcher</code>.
   *
   * @param listenAddress
   *    the <code>Address</code> denoting the transport end-point
   *    (interface and port) to listen for incoming notifications.
   * @param listener
   *    the <code>CommandResponder</code> instance that should handle
   *    the received notifications.
   * @return
   *    <code>true</code> if registration was successful and <code>false</code>
   *    if, for example, the transport mapping for the listen address could not
   *    be created.
   * @since 1.6
   */
  public synchronized boolean addNotificationListener(Address listenAddress,
                                                      CommandResponder listener)
  {
    TransportMapping tm =
        TransportMappings.getInstance().createTransportMapping(listenAddress);
    if (tm == null) {
      if (logger.isInfoEnabled()) {
        logger.info("Failed to add notification listener for address: "+
                    listenAddress);
      }
      return false;
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
2021中文字幕一区亚洲| 日韩电影免费在线观看网站| 亚洲一二三四在线| 精品系列免费在线观看| 色婷婷av一区二区三区软件 | 一区在线播放视频| 三级一区在线视频先锋| av中文字幕一区| 久久一区二区三区四区| 午夜av区久久| 在线观看日韩电影| 中文字幕免费不卡| 国产麻豆精品一区二区| 在线不卡a资源高清| 一区二区欧美视频| 成人av网站在线| 中文字幕精品在线不卡| 精品中文字幕一区二区小辣椒| 欧美婷婷六月丁香综合色| 国产精品毛片大码女人| 国产一区二区三区四| 精品三级av在线| 麻豆一区二区三| 日韩色在线观看| 久久电影国产免费久久电影 | 99久久精品免费观看| 国产亚洲一区二区三区在线观看| 久久国产麻豆精品| 日韩欧美中文字幕精品| 美女视频一区二区| 精品国产一区二区精华| 麻豆国产91在线播放| 欧美一级片在线| 精彩视频一区二区三区| 久久综合久久综合久久| 国产精品一品二品| 中文成人综合网| 97久久超碰国产精品| 亚洲黄色在线视频| 欧美视频在线不卡| 免费看黄色91| 26uuu精品一区二区| 国产成人亚洲精品狼色在线| 国产视频一区在线观看| 成人教育av在线| 亚洲精品美国一| 欧美丰满高潮xxxx喷水动漫| 久久精品99国产精品| 久久久久久免费毛片精品| 国产精品1区二区.| 18欧美乱大交hd1984| 欧美性高清videossexo| 久久精品国产一区二区三区免费看 | 九九**精品视频免费播放| 精品久久国产字幕高潮| 成人av影院在线| 午夜精品久久久久久久久久久| 欧美一区二区视频在线观看2022| 国产精品一区二区在线观看不卡| 国产欧美精品一区二区色综合朱莉| 色综合一个色综合| 日韩和欧美一区二区| 欧美精品一区二区久久久| 不卡视频免费播放| 日韩高清在线电影| 国产精品久久久久久久浪潮网站 | 午夜免费久久看| 久久精品亚洲一区二区三区浴池| 99精品视频一区二区三区| 性久久久久久久| 亚洲国产成人在线| 91精品在线免费| eeuss鲁一区二区三区| 午夜久久电影网| 国产精品久久久久aaaa| 日韩片之四级片| 色悠悠亚洲一区二区| 国内精品久久久久影院色| 亚洲免费观看高清完整版在线 | 中文字幕中文字幕中文字幕亚洲无线 | 欧美一区二区大片| 色综合色综合色综合色综合色综合 | 水野朝阳av一区二区三区| 欧美激情中文不卡| 91精品国产手机| 欧美一a一片一级一片| 成人三级伦理片| 美腿丝袜亚洲一区| 亚洲成av人片| 亚洲精品乱码久久久久久| 国产亚洲福利社区一区| 日韩亚洲欧美成人一区| 欧美午夜一区二区三区免费大片| 不卡欧美aaaaa| 国产成人av电影免费在线观看| 日韩成人av影视| 图片区日韩欧美亚洲| 亚洲免费三区一区二区| 亚洲国产精品高清| 中文文精品字幕一区二区| 久久久亚洲精华液精华液精华液| 欧美一区二区三区小说| 欧美日韩免费一区二区三区| 一本色道久久综合亚洲91| aaa亚洲精品| av在线播放一区二区三区| 国产iv一区二区三区| 国产99久久久精品| 成人禁用看黄a在线| 成人av电影在线播放| 懂色av一区二区三区蜜臀| 国产精品 欧美精品| 国产精品一二三四区| 国产麻豆一精品一av一免费| 国产一区二区三区国产| 国产九色精品成人porny| 国产精品一级二级三级| 成人动漫一区二区在线| 99re成人在线| 精品视频一区 二区 三区| 欧美精品在线视频| 91精品国产91久久综合桃花| 日韩欧美黄色影院| 久久精品欧美日韩精品| 国产精品色一区二区三区| 亚洲免费看黄网站| 午夜国产精品影院在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎| 久久机这里只有精品| 丁香六月综合激情| 欧美性视频一区二区三区| 91精品国产色综合久久ai换脸 | 成人免费观看av| 丁香六月久久综合狠狠色| 色婷婷久久99综合精品jk白丝| 欧美性大战xxxxx久久久| 欧美一区二区视频网站| 国产清纯在线一区二区www| 亚洲女性喷水在线观看一区| 亚洲亚洲精品在线观看| 精品一区二区三区在线播放视频| 成熟亚洲日本毛茸茸凸凹| 欧美性三三影院| 久久九九影视网| 亚洲在线观看免费视频| 久久爱www久久做| 色天使色偷偷av一区二区| 日韩午夜精品电影| 国产精品超碰97尤物18| 日韩国产一区二| 91视频在线观看| 亚洲精品一区二区三区精华液| 最新日韩在线视频| 乱中年女人伦av一区二区| a4yy欧美一区二区三区| 欧美大度的电影原声| 一区二区理论电影在线观看| 国产呦精品一区二区三区网站| 91蝌蚪porny成人天涯| 精品日韩欧美一区二区| 亚洲九九爱视频| 国产精品主播直播| 欧美人与禽zozo性伦| 国产精品欧美精品| 精品一二三四区| 欧美色窝79yyyycom| 中文字幕精品综合| 国内成人精品2018免费看| 欧美日韩中文字幕一区二区| 国产精品毛片久久久久久久| 老色鬼精品视频在线观看播放| 91福利视频网站| 国产精品乱人伦中文| 狠狠色丁香九九婷婷综合五月| 欧美午夜理伦三级在线观看| 国产精品女主播av| 国产在线看一区| 欧美一级高清大全免费观看| 亚洲最新视频在线播放| 91蜜桃网址入口| 欧美高清在线精品一区| 精品亚洲porn| 2欧美一区二区三区在线观看视频| 亚洲综合激情小说| 欧洲日韩一区二区三区| 一区视频在线播放| 成人av集中营| 国产精品久久久久永久免费观看 | 亚洲va欧美va人人爽午夜| 99精品视频中文字幕| 国产精品久久久99| 不卡一区二区中文字幕| 国产精品久久久久精k8| 99久久免费精品高清特色大片| 中文在线一区二区| eeuss鲁片一区二区三区在线看| 国产精品美女久久久久久久网站| 国产精品亚洲专一区二区三区| 精品国产乱码久久久久久老虎 | 美女网站在线免费欧美精品|