?? snmpproperty.java
字號:
package yww.snmpif;
/**
* 保存SNMP屬性
* @author Administrator
*
*/
public class SnmpProperty {
private String ipAddress;
private String community;
private String writeCommunity;
private int port;
private int timeout;
private int version;
/**
* 構(gòu)建SnmpPorperty
* </br>設(shè)置SNMP屬性默認(rèn)值
* </br>community = "public";
* </br>writeCommunity = "private";
* </br>port = 161;
* </br>timeout = 5000;
* </br>version = 0;
*/
public SnmpProperty()
{
community = "public";
writeCommunity = "private";
port = 161;
timeout = 5000;
version = 0;
}
/**
* 獲得只讀共同體名
* @return 只讀共同體名
*/
public String getCommunity() {
return community;
}
/**
* 設(shè)置只讀共同體名
* @param community
*/
public void setCommunity(String community) {
this.community = community;
}
/**
* 獲得IP地址
* @return IP地址
*/
public String getIpAddress() {
return ipAddress;
}
/**
* 設(shè)置IP地址
* @param ipAddress
*/
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
/**
* 獲得SNMP端口
* @return SNMP端口
*/
public int getPort() {
return port;
}
/**
* 設(shè)置SNMP端口
* @param port
*/
public void setPort(int port) {
this.port = port;
}
/**
* 獲得超時(shí)時(shí)間
* @return 超時(shí)時(shí)間(ms)
*/
public int getTimeout() {
return timeout;
}
/**
* 設(shè)置超時(shí)時(shí)間 單位(ms)
* @param timeout
*/
public void setTimeout(int timeout) {
this.timeout = timeout;
}
/**
* 獲得版本號,版本號參考RFC1157和RFC1901中的定義
* RFC1157-SNMP DEFINITIONS
IMPORTS FROM RFC1155-SMI;
-- top-level message
Message ::=
SEQUENCE {
version -- version-1 for this RFC
INTEGER {
version-1(0)
},
community -- community name
OCTET STRING,
data -- e.g., PDUs if trivial
ANY -- authentication is being used
}
-- From RFC 1901:
COMMUNITY-BASED-SNMPv2 DEFINITIONS ::= BEGIN
-- top-level message
Message ::=
SEQUENCE {
version
INTEGER {
version(1) -- modified from RFC 1157
},
community -- community name
OCTET STRING,
data -- PDUs as defined in [4]
ANY
}
}
END
* @return 版本號
*/
public int getVersion() {
return version;
}
/**
* 設(shè)置版本號,版本號見getVersion()
* @param version
*/
public void setVersion(int version) {
this.version = version;
}
/**
* 獲得讀寫共同體名
* @return 讀寫共同體名
*/
public String getWriteCommunity() {
return writeCommunity;
}
/**
* 設(shè)置讀寫共同體名
* @param writeCommunity
*/
public void setWriteCommunity(String writeCommunity) {
this.writeCommunity = writeCommunity;
}
/**
* 根據(jù)RFC1157和RFC1901中定義設(shè)定.
*/
public static int SNMPv1 = 0;
public static int SNMPv2 = 1;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -