Package uk.co.westhawk.snmp.stack
Interface ListeningContextFace
- All Known Implementing Classes:
DefaultTrapContext
,ListeningContext
,ListeningContextPool
public interface ListeningContextFace
This interface contains the SNMP listening context methods.
- Since:
- 4_14
- Version:
- $Revision: 3.6 $ $Date: 2006/11/29 16:12:50 $
- Author:
- Birgit Arkesteijn
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The default port number where we listen for traps (162).static final String
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified PDU listener to receive the undecoded PDUs.void
addUnhandledRawPduListener
(RawPduListener listener) Adds the specified PDU listener to receive the undecoded PDUs when it was not handled (i.e. not consumed) by any of the PDU listeners in addRawPduListener().void
destroy()
Removes the resouces held by this context.Returns the local address the server will bind to When the address is null, the socket accepts connections on any/all local addresses.int
Returns the maximum number of bytes this context will read from the socket.int
getPort()
Returns the port number.Returns the type of socket.void
Removes the specified PDU listener.void
removeUnhandledRawPduListener
(RawPduListener listener) Removes the specified unhandled PDU listener.void
setMaxRecvSize
(int no) Sets the maximum number of bytes this context will read from the socket.
-
Field Details
-
version_id
- See Also:
-
DEFAULT_TRAP_PORT
static final int DEFAULT_TRAP_PORTThe default port number where we listen for traps (162).- See Also:
-
-
Method Details
-
getPort
int getPort()Returns the port number.- Returns:
- The port no
-
getBindAddress
String getBindAddress()Returns the local address the server will bind to When the address is null, the socket accepts connections on any/all local addresses.- Returns:
- The bind address
-
getTypeSocket
String getTypeSocket()Returns the type of socket.- Returns:
- The type of socket
- See Also:
-
getMaxRecvSize
int getMaxRecvSize()Returns the maximum number of bytes this context will read from the socket. By default this will be set toMSS
(i.e. 1300).- Returns:
- The number
- See Also:
-
setMaxRecvSize
void setMaxRecvSize(int no) Sets the maximum number of bytes this context will read from the socket. By default this will be set toMSS
(i.e. 1300).- Parameters:
no
- The new size- See Also:
-
destroy
void destroy()Removes the resouces held by this context. This method will stop the thread listening for packets. -
addRawPduListener
Adds the specified PDU listener to receive the undecoded PDUs. When a PDU is received the PDU received event is fired to all listeners, until one of them consumes it.All the SnmpContext objects use this method to listen for PDUs. When a SnmpContext object decodes the PDU succesfully, it will consume it.
Only when a listener is added will this context create a listening socket.
- Parameters:
l
- The listener object- Throws:
IOException
- Thrown when creating a listening socket fails- See Also:
-
removeRawPduListener
Removes the specified PDU listener. When there are no more listeners, calls destroy().- Parameters:
l
- The listener object
-
addUnhandledRawPduListener
Adds the specified PDU listener to receive the undecoded PDUs when it was not handled (i.e. not consumed) by any of the PDU listeners in addRawPduListener().Only when a listener is added will this context create a listening socket.
- Parameters:
listener
- The listener object- Throws:
IOException
- Thrown when creating a listening socket fails- See Also:
-
removeUnhandledRawPduListener
Removes the specified unhandled PDU listener. When there are no more listeners, calls destroy().- Parameters:
listener
- The listener object
-