|
SNMP Stack 5_1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
This interface contains the SNMP context interface that is needed by every PDU to send a SNMP v1, v2c and v3 request. The context also provides functionality to receive incoming PDUs.
SnmpContext,
SnmpContextv2c,
SnmpContextv3| Field Summary | |
static int |
DEFAULT_PORT
The default port number where SNMP requests are sent to (161). |
static java.lang.String |
KVM_SOCKET
The KVM Socket type. |
static int |
MAXPDU
The Maximum number of outstanding PDUs one context can handle at a given moment in time. |
static int |
MSS
The Maximum size of a message in octets (1300). |
static java.lang.String |
NETSCAPE_SOCKET
The Netscape Socket type. |
static java.lang.String |
STANDARD_SOCKET
The Standard Socket type. |
static java.lang.String |
TCP_SOCKET
The TCP Socket type. |
static java.lang.String |
version_id
|
| Method Summary | |
boolean |
addPdu(Pdu pdu)
Adds a PDU to the context. |
void |
addRequestPduListener(RequestPduListener l)
Adds the specified request pdu listener to receive PDUs on the default request pdu port 161 from the host that matches this context. |
void |
addRequestPduListener(RequestPduListener l,
int port)
Adds the specified request pdu listener to receive PDUs on the specified port from the host that matches this context. |
void |
addRequestPduListener(RequestPduListener l,
ListeningContextPool lcontext)
Adds the specified request pdu listener to receive PDUs on the specified listening context that matches this context. |
void |
addTrapListener(TrapListener l)
Adds the specified trap listener to receive traps on the default trap port 162 from the host that matches this context. |
void |
addTrapListener(TrapListener l,
int port)
Adds the specified trap listener to receive traps on the specified port from the host that matches this context. |
void |
addTrapListener(TrapListener l,
ListeningContextPool lcontext)
Adds the specified trap listener to receive traps on the specified listening context that matches this context. |
java.lang.Object |
clone()
Returns a clone of this SnmpContext. |
void |
destroy()
Removes the resouces held by this context. |
byte[] |
encodePacket(byte msg_type,
int rId,
int errstat,
int errind,
java.util.Enumeration ve,
java.lang.Object obj)
Encodes a PDU. |
java.lang.String |
getBindAddress()
Returns the local bind address. |
java.lang.String |
getHashKey()
Returns the hash key. |
java.lang.String |
getHost()
Returns the host. |
int |
getPort()
Returns the port number. |
java.lang.String |
getReceivedFromHostAddress()
Returns the IP address string aaa.bbb.ccc.ddd (IPv4) or a:b:c:d:e:f:g:h (IPv6) of the (latest) host the packets where received from. |
java.lang.String |
getSendToHostAddress()
Returns the IP address string aaa.bbb.ccc.ddd (IPv4) or a:b:c:d:e:f:g:h (IPv6) of the host the packets where sent to. |
java.lang.String |
getTypeSocket()
Returns the type of socket. |
int |
getVersion()
Returns the SNMP version of the context. |
boolean |
isDestroyed()
Returns whether or not this context has been destroyed. |
Pdu |
processIncomingPdu(byte[] message)
Processes an incoming PDU. |
boolean |
removePdu(int requestId)
Removes a PDU from the context. |
void |
removeRequestPduListener(RequestPduListener l)
Removes the specified request pdu listener from listening for packets on the default request pdu port 161. |
void |
removeRequestPduListener(RequestPduListener l,
int port)
Removes the specified request pdu listener from listening for packets on the specified port. |
void |
removeRequestPduListener(RequestPduListener l,
ListeningContextPool lcontext)
Removes the specified request pdu listener from listening for packets on the specified listening context. |
void |
removeTrapListener(TrapListener l)
Removes the specified trap listener from listening for packets on the default trap port 162. |
void |
removeTrapListener(TrapListener l,
int port)
Removes the specified trap listener from listening for packets on the specified port. |
void |
removeTrapListener(TrapListener l,
ListeningContextPool lcontext)
Removes the specified trap listener from listening for packets on the specified listening context. |
void |
sendPacket(byte[] packet)
Sends an encoded PDU. |
| Field Detail |
public static final java.lang.String version_id
public static final int DEFAULT_PORT
public static final java.lang.String STANDARD_SOCKET
public static final java.lang.String TCP_SOCKET
public static final java.lang.String NETSCAPE_SOCKET
public static final java.lang.String KVM_SOCKET
public static final int MAXPDU
public static final int MSS
| Method Detail |
public int getVersion()
SnmpConstants.SNMP_VERSION_1,
SnmpConstants.SNMP_VERSION_2c,
SnmpConstants.SNMP_VERSION_3public java.lang.String getHost()
public int getPort()
public java.lang.String getBindAddress()
public java.lang.String getTypeSocket()
STANDARD_SOCKET,
TCP_SOCKET,
NETSCAPE_SOCKET,
KVM_SOCKETpublic java.lang.String getSendToHostAddress()
ContextSocketFace.getSendToHostAddress()public java.lang.String getReceivedFromHostAddress()
ContextSocketFace.getReceivedFromHostAddress()
public boolean addPdu(Pdu pdu)
throws java.io.IOException,
PduException
pdu - the PDU
java.io.IOException
PduExceptionpublic boolean removePdu(int requestId)
public byte[] encodePacket(byte msg_type,
int rId,
int errstat,
int errind,
java.util.Enumeration ve,
java.lang.Object obj)
throws java.io.IOException,
EncodingException
msg_type - The message typerId - The message iderrstat - The error statuserrind - The error indexve - The varbind listobj - Additional object (only used in SNMPv3)
java.io.IOException
EncodingExceptionpublic void sendPacket(byte[] packet)
packet - The encoded packetpublic void destroy()
public boolean isDestroyed()
public void addTrapListener(TrapListener l)
throws java.io.IOException
The ListeningContext class will do the actual listening for traps. This context will add itself to a ListeningContextPool object and will only pass the event to its listeners if the pdu matches this context and is a trap pdu.
l - The trap listener
java.io.IOExceptionaddTrapListener(TrapListener, int),
ListeningContextFace.DEFAULT_TRAP_PORT
public void removeTrapListener(TrapListener l)
throws java.io.IOException
The listener will not be removed from all ListeningContext objects that are in the ListeningContextPool. In order to do that, use ListeningContextPool.removeTrapListenerFromPool()
l - The trap listener
java.io.IOExceptionremoveTrapListener(TrapListener, int),
ListeningContextFace.DEFAULT_TRAP_PORT
public void addTrapListener(TrapListener l,
int port)
throws java.io.IOException
The ListeningContext class will do the actual listening for traps. This context will add itself to a ListeningContextPool object and will only pass the event to its listeners if the pdu matches this context and is a trap pdu.
l - The trap listenerport - The port the traps are received on
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.addRawPduListener(RawPduListener)
public void removeTrapListener(TrapListener l,
int port)
throws java.io.IOException
The listener will not be removed from all ListeningContext objects that are in the ListeningContextPool. In order to do that, use ListeningContextPool.removeTrapListenerFromPool()
l - The trap listenerport - The port the traps are received on
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.removeRawPduListener(RawPduListener),
ListeningContextPool.removeRawPduListenerFromPool(RawPduListener)
public void addTrapListener(TrapListener l,
ListeningContextPool lcontext)
throws java.io.IOException
The ListeningContext class will do the actual listening for traps. This context will add itself to a ListeningContextPool object and will only pass the event to its listeners if the pdu matches this context and is a trap pdu.
l - The trap listenerlcontext - The listening context
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.addRawPduListener(RawPduListener)
public void removeTrapListener(TrapListener l,
ListeningContextPool lcontext)
throws java.io.IOException
The listener will not be removed from all ListeningContext objects that are in the ListeningContextPool. In order to do that, use ListeningContextPool.removeTrapListenerFromPool()
l - The trap listenerlcontext - The listening context
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.removeRawPduListener(RawPduListener),
ListeningContextPool.removeRawPduListenerFromPool(RawPduListener)
public void addRequestPduListener(RequestPduListener l)
throws java.io.IOException
The ListeningContext class will do the actual listening for PDUs. This context will add itself to a ListeningContextPool object and will only pass the event to its listeners if the pdu matches this context and is a request pdu.
Don't use the TCP_SOCKET when listening for request PDUs. It doesn't provide functionality to send a response back.
l - The request PDU listener
java.io.IOExceptionaddRequestPduListener(RequestPduListener, int),
DEFAULT_PORT
public void removeRequestPduListener(RequestPduListener l)
throws java.io.IOException
The listener will not be removed from all ListeningContext objects that are in the ListeningContextPool. In order to do that, use ListeningContextPool.removeRequestPduListenerFromPool()
l - The request PDU listener
java.io.IOExceptionremoveRequestPduListener(RequestPduListener, int),
DEFAULT_PORT
public void addRequestPduListener(RequestPduListener l,
int port)
throws java.io.IOException
The ListeningContext class will do the actual listening for PDUs. This context will add itself to a ListeningContextPool object and will only pass the event to its listeners if the pdu matches this context and is a request pdu.
Don't use the TCP_SOCKET when listening for request PDUs. It doesn't provide functionality to send a response back.
l - The request PDU listenerport - The port the request PDUs are received on
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.addRawPduListener(RawPduListener)
public void removeRequestPduListener(RequestPduListener l,
int port)
throws java.io.IOException
The listener will not be removed from all ListeningContext objects that are in the ListeningContextPool. In order to do that, use ListeningContextPool.removeRequestPduListenerFromPool()
l - The request PDU listenerport - The port the request PDUs are received on
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.removeRawPduListener(RawPduListener),
ListeningContextPool.removeRawPduListenerFromPool(RawPduListener)
public void addRequestPduListener(RequestPduListener l,
ListeningContextPool lcontext)
throws java.io.IOException
The ListeningContext class will do the actual listening for PDUs. This context will add itself to a ListeningContextPool object and will only pass the event to its listeners if the pdu matches this context and is a request pdu.
Don't use the TCP_SOCKET when listening for request PDUs. It doesn't provide functionality to send a response back.
l - The request PDU listenerlcontext - The listening context
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.addRawPduListener(RawPduListener)
public void removeRequestPduListener(RequestPduListener l,
ListeningContextPool lcontext)
throws java.io.IOException
The listener will not be removed from all ListeningContext objects that are in the ListeningContextPool. In order to do that, use ListeningContextPool.removeRequestPduListenerFromPool()
l - The request PDU listenerlcontext - The listening context
java.io.IOExceptionListeningContextPool.ListeningContextPool(int, String, String),
ListeningContextPool.removeRawPduListener(RawPduListener),
ListeningContextPool.removeRawPduListenerFromPool(RawPduListener)
public Pdu processIncomingPdu(byte[] message)
throws DecodingException,
java.io.IOException
DecodingException
java.io.IOException
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException - Thrown when the constructor
generates an IOException or when in one of the Pool classes.public java.lang.String getHashKey()
|
SNMP Stack 5_1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||