|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.netsnmp.NetSNMPSession
A session with a remote agent. Data, as a PDU is sent to
the remote agent. The remote agent will respond with a PDU
| Nested Class Summary | |
static class |
NetSNMPSession.readInterrupt
Deprecated. |
static interface |
NetSNMPSession.serialEncryption
|
| Constructor Summary | |
NetSNMPSession()
Creates a new instance of Session |
|
NetSNMPSession(String peerName,
String community)
Creates and opens an SNMPv2c session to a remote host |
|
| Method Summary | |
void |
addListener(NetSNMPAction listener)
Adds a listener that responds to PDUs from the remote agents. |
NetSNMPAction |
deleteListener(NetSNMPAction listener)
Delete the listenen from the list of listeners. |
protected void |
finalize()
|
String |
getAuthPassword()
|
String |
getCommunity()
|
byte[] |
getContextEngineID()
|
String |
getContextName()
|
String |
getPeerName()
|
String |
getPrivPassword()
|
long |
getRcvMsgMaxSize()
|
int |
getRetries()
|
byte[] |
getSecurityAuthKey()
|
OID |
getSecurityAuthOID()
|
byte[] |
getSecurityEngineID()
|
SecurityLevel |
getSecurityLevel()
|
int |
getSecurityModel()
|
String |
getSecurityName()
|
byte[] |
getSecurityPrivKey()
|
OID |
getSecurityPrivOID()
|
Exception |
getSerializeException()
|
long |
getSessionHandle()
The session handle is the native pointer to data specific to this session. |
long |
getSndMsgMaxSize()
|
SNMPVersion |
getSnmpVersion()
Getter for property snmpVersion. |
long |
getTimeout()
|
SNMPVersion |
getVersion()
|
int |
hashCode()
|
static void |
interrupt()
Deprecated. |
boolean |
isOpen()
|
protected void |
nativeFinalize()
|
void |
open()
Opens the session given the current set of properties |
static void |
read(double timeout)
Deprecated. operation has been moved to an internal thread. Further use is now an error |
void |
send(PDU thePdu,
Object o)
Sends the pdu to the peer |
void |
setAuthenticationProtocol(OID oid)
Setter for authentication protocol corresponds to the -a option for snmpcmd(1) |
void |
setAuthPassword(String string)
|
void |
setCommunity(String string)
|
void |
setContextEngineID(byte[] bs)
|
void |
setContextName(String string)
|
static NetSNMPSession.serialEncryption |
setDefaultEncryptor(NetSNMPSession.serialEncryption cryptor)
Set a new default encryptor |
void |
setPeerName(String hostname)
Format of the hostname can be as follows: |
void |
setPrivacyProtocol(OID oid)
Setter for privacy protocol corresponds to the -x DES option for snmpcmd(1) |
void |
setPrivPassword(String string)
|
void |
setRcvMsgMaxSize(long l)
|
void |
setRetries(int i)
|
void |
setSecurityAuthKey(byte[] bs)
|
void |
setSecurityAuthOID(OID oid)
|
void |
setSecurityEngineID(byte[] bs)
|
void |
setSecurityLevel(SecurityLevel level)
|
void |
setSecurityModel(int i)
|
void |
setSecurityName(String string)
|
void |
setSecurityPrivKey(byte[] key)
|
void |
setSecurityPrivOID(OID oid)
|
void |
setSerialEncryptor(NetSNMPSession.serialEncryption encryption)
Sets the encryption object to use to encrypt/decrypt v1/v2 community names and v3 auth/priv passwords during serialization/deserialization |
void |
setSndMsgMaxSize(long size)
|
void |
setSNMPVersion(SNMPVersion version)
|
void |
setTimeout(long t)
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public NetSNMPSession()
public NetSNMPSession(String peerName,
String community)
throws IllegalStateException
peerName - host name of the remote agent, may be in any format acceptable to
net-snmp utilties. Typically in the format ofcommunity - community of the remote agent| Method Detail |
public void addListener(NetSNMPAction listener)
NetSNMPAction.actionPerformed(int, org.netsnmp.NetSNMPSession, org.netsnmp.PDU, java.lang.Object) method is called
listener - object that implements the NetSNMPAction.actionPerformed(int, org.netsnmp.NetSNMPSession, org.netsnmp.PDU, java.lang.Object)
method to process the information returned from the agentpublic NetSNMPAction deleteListener(NetSNMPAction listener)
listener - listener to be deleted
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic String getAuthPassword()
public String getCommunity()
public byte[] getContextEngineID()
public String getContextName()
public String getPeerName()
public String getPrivPassword()
public long getRcvMsgMaxSize()
public int getRetries()
public byte[] getSecurityAuthKey()
public OID getSecurityAuthOID()
public byte[] getSecurityEngineID()
public SecurityLevel getSecurityLevel()
public int getSecurityModel()
public String getSecurityName()
public byte[] getSecurityPrivKey()
public OID getSecurityPrivOID()
public Exception getSerializeException()
public long getSessionHandle()
public long getSndMsgMaxSize()
public SNMPVersion getSnmpVersion()
NetSNMP.SNMPv1,
NetSNMP.SNMPv2c,
NetSNMP.SNMPv3public long getTimeout()
public SNMPVersion getVersion()
public int hashCode()
hashCode in class Objectpublic boolean isOpen()
protected void nativeFinalize()
public void open()
throws IllegalStateException
IllegalStateException - if the peername or community name
have not been set, or the lookup on the peer fails
public void send(PDU thePdu,
Object o)
throws NetSNMPSendError,
IllegalStateException
thePdu - pdu to sendo - object to be passed to the SNMPEventListener when a response
to this pdu is received.
NetSNMPSendError - if an error occurs in sending the pdu
IllegalStateException - if the session is not openpublic void setAuthenticationProtocol(OID oid)
oid - Identifier for the authentication protocol to useNetSNMP.usmNoAuthOID,
NetSNMP.usmMD5AuthOID,
NetSNMP.usmSHAAuthOIDpublic void setAuthPassword(String string)
string - authorization passwordpublic void setCommunity(String string)
string - the V1/V2c communitypublic void setContextEngineID(byte[] bs)
bs - public void setContextName(String string)
string - public void setPeerName(String hostname)
transport:hostname:portNumber
hostname:portNumber (defaults to UDP transport)
hostname (defaults to UDP transport and port 161)
hostname - name of the remote agent to connect topublic void setPrivacyProtocol(OID oid)
oid - NetSNMP.usmNoPrivOID,
NetSNMP.usmDESPrivOIDpublic void setPrivPassword(String string)
string - public void setRcvMsgMaxSize(long l)
l - public void setRetries(int i)
i - public void setSecurityAuthKey(byte[] bs)
bs - public void setSecurityAuthOID(OID oid)
oid - public void setSecurityEngineID(byte[] bs)
bs - public void setSecurityLevel(SecurityLevel level)
NetSNMP.noAuth,
NetSNMP.authNoPriv,
NetSNMP.authPrivpublic void setSecurityModel(int i)
i - public void setSecurityName(String string)
string - security name corresponds to the snmpget -u user
optionpublic void setSecurityPrivKey(byte[] key)
key - encryption key to use for V3 privacy correpsonds to the
snmpget -X key optionpublic void setSecurityPrivOID(OID oid)
oid - identifier of the privacy protocol to useNetSNMP.usmDESPrivOIDpublic void setSerialEncryptor(NetSNMPSession.serialEncryption encryption)
encryption - to usepublic void setSndMsgMaxSize(long size)
size - largest message to sendpublic void setSNMPVersion(SNMPVersion version)
version - sets the SNMPVersion to be used.NetSNMP.SNMPv1,
NetSNMP.SNMPv2c,
NetSNMP.SNMPv3public void setTimeout(long t)
t - timeout in microseconds before the first timeoutpublic static void interrupt()
public static void read(double timeout)
throws IOException,
NetSNMPSession.readInterrupt
timeout - time in seconds to wait for an event(micro second)
effective granularity
an - IOException if an error occurs
IOException
NetSNMPSession.readInterruptpublic static NetSNMPSession.serialEncryption setDefaultEncryptor(NetSNMPSession.serialEncryption cryptor)
cryptor - new default encyprtor
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||