SNMP mib库Mapping成java类收藏(转载自baiboy4493)

package com.regaltec.nma.collector.common.snmp;

 

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.HashMap;

import java.util.Hashtable;

import java.util.Iterator;

 

import uk.co.westhawk.snmp.pdu.BlockPdu;

import uk.co.westhawk.snmp.stack.AsnInteger;

import uk.co.westhawk.snmp.stack.AsnNull;

import uk.co.westhawk.snmp.stack.AsnObject;

import uk.co.westhawk.snmp.stack.AsnObjectId;

import uk.co.westhawk.snmp.stack.AsnOctets;

import uk.co.westhawk.snmp.stack.AsnUnsInteger;

import uk.co.westhawk.snmp.stack.AsnUnsInteger64;

import uk.co.westhawk.snmp.stack.PduException;

import uk.co.westhawk.snmp.stack.SnmpConstants;

import uk.co.westhawk.snmp.stack.SnmpContext;

import uk.co.westhawk.snmp.stack.SnmpContextBasisFace;

import uk.co.westhawk.snmp.stack.SnmpContextv2c;

import uk.co.westhawk.snmp.stack.SnmpContextv3;

import uk.co.westhawk.snmp.stack.SnmpContextv3Pool;

import uk.co.westhawk.snmp.stack.varbind;

 

import com.regaltec.nma.collector.common.NmaLog4jProxy;

 

/**

 * <p>

 * Title: SNMP协议驱动,版本包括SNMP v1,v2c,v3

 * </p>

 * 提供上层(SO层)访问SNMP代理时用 用到的外部包:snmp4_13.jar

 * 

 * <p>

 * Description:

 * </p>

 * 

 * <p>

 * Copyright: Copyright (c) 2005

 * </p>

 * 

 * <p>

 * Company:

 * </p>

 * 

* @version 1.0

 */

public class NmaCollectorSnmp {

    // 自定义SNMP数据类型变量

    public final static int DTYPE_AsnInteger = 0; // AsnInteger类型

    public final static int DTYPE_AsnNull = 10; // AsnNull类型

    public final static int DTYPE_AsnObjectId = 20; // AsnObjectId类型

    public final static int DTYPE_AsnOctets = 30; // AsnOctets类型

    public final static int DTYPE_AsnPrimitive = 40; // AsnPrimitive类型

    public final static int DTYPE_AsnUnsInteger = 50; // AsnUnsInteger类型

    public final static int DTYPE_AsnTIMETICKS = 51; // SnmpConstants.TIMETICKS类型

    public final static int DTYPE_AsnCOUNTER = 52; // SnmpConstants.COUNTER类型

    public final static int DTYPE_AsnGAUGE = 53; // SnmpConstants.GAUGE类型

    public final static int DTYPE_AsnUnsInteger64 = 60; // AsnUnsInteger64类型

 

    // 内部变量

    /*

     * private SnmpContextPool contextv1 = null; private SnmpContextv2cPool

     * contextv2c = null; private SnmpContextv3Pool contextv3 = null;

     */

    private SnmpContext contextv1 = null;

    private SnmpContextv2c contextv2c = null;

    private SnmpContextv3 contextv3 = null;

    private String host = "127.0.0.1"; // SNMP主机IP地址

    private int port = SnmpContextBasisFace.DEFAULT_PORT; // SNMP端口号,缺省为161

    private String comm = "public"; // community 串

    boolean openFlag = false;

    int snmpVersion = 1; // SNMP 版本号 1-SNMPv1, 2-SNMPv2c, 3-SNMPv3

    // SNMP v3 专用参数

    byte[] 

 

阅读更多
文章标签: Java C C++ C#
个人分类: 转载文章
上一篇Mibble - Free SNMP MIB Browser/Parser 基于Java的跨平台MI
下一篇SNMP协议详解
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭