|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface MessageDispatcher
The MessageDispatcher interface defines common services of
instances that process incoming SNMP messages and dispatch them to
interested CommandResponder instances. It also provides a service
to send out outgoing SNMP messages.
A MessageDispatcher needs at least one TransportMapping
and at least one MessageProcessingModel in order to be able to
process any messages.
| Method Summary | |
|---|---|
void |
addCommandResponder(CommandResponder listener)
Adds a CommandResponder instance to the message dispatcher. |
void |
addMessageProcessingModel(MessageProcessingModel model)
Adds a MessageProcessingModel to the dispatcher. |
void |
addTransportMapping(TransportMapping transport)
Adds a TransportMapping to the dispatcher. |
MessageProcessingModel |
getMessageProcessingModel(int messageProcessingModel)
Gets the MessageProcessingModel for the supplied message
processing model ID. |
int |
getNextRequestID()
Gets the next unique request ID. |
TransportMapping |
getTransport(Address destAddress)
Returns a transport mapping that can handle the supplied address. |
java.util.Collection |
getTransportMappings()
Gets the Collection of transport mappings in this message
dispatcher. |
void |
processMessage(TransportMapping sourceTransport,
Address incomingAddress,
BERInputStream wholeMessage)
Deprecated. Use processMessage(TransportMapping,Address,ByteBuffer)
instead. |
void |
processMessage(TransportMapping sourceTransport,
Address incomingAddress,
java.nio.ByteBuffer wholeMessage)
Process an incoming SNMP message. |
void |
releaseStateReference(int messageProcessingModel,
PduHandle pduHandle)
Release any state references associated with the supplied PduHandle in the specified message processing model. |
void |
removeCommandResponder(CommandResponder listener)
Removes a previously added CommandResponder instance from
the message dispatcher. |
void |
removeMessageProcessingModel(MessageProcessingModel model)
Removes a previously added MessageProcessingModel from
the dispatcher. |
TransportMapping |
removeTransportMapping(TransportMapping transport)
Removes a previously added TransportMapping from
the dispatcher. |
int |
returnResponsePdu(int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
int maxSizeResponseScopedPDU,
StateReference stateReference,
StatusInformation statusInformation)
Returns a response PDU to the sender of the corresponding request PDU. |
PduHandle |
sendPdu(Address transportAddress,
int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
boolean expectResponse)
Sends a PDU to the supplied transport address. |
PduHandle |
sendPdu(TransportMapping transportMapping,
Address transportAddress,
int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
boolean expectResponse)
Sends a PDU to the supplied transport address. |
PduHandle |
sendPdu(TransportMapping transportMapping,
Address transportAddress,
int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
boolean expectResponse,
PduHandleCallback callback)
Sends a PDU to the supplied transport address and returns the PduHandle that uniquely identifies the request as response
after the request has been sent and otional, if a
PduHandleCallback is given, it returns also the
PduHandle just before the request is sent through the
the callback interface. |
| Method Detail |
|---|
int getNextRequestID()
void addMessageProcessingModel(MessageProcessingModel model)
MessageProcessingModel to the dispatcher. In order to
support a specific SNMP protocol version, the message dispatcher needs
a message processing model to process messages before they can be
dispatched.
model - a MessageProcessingModel instance.void removeMessageProcessingModel(MessageProcessingModel model)
MessageProcessingModel from
the dispatcher.
model - a MessageProcessingModel instance.MessageProcessingModel getMessageProcessingModel(int messageProcessingModel)
MessageProcessingModel for the supplied message
processing model ID.
messageProcessingModel - a message processing model ID
(see MessageProcessingModel.getID()).
nullvoid addTransportMapping(TransportMapping transport)
TransportMapping to the dispatcher. The transport mapping
is used to send and receive messages to/from the network.
transport - a TransportMapping instance.TransportMapping removeTransportMapping(TransportMapping transport)
TransportMapping from
the dispatcher.
transport - a TransportMapping instance.
TransportMapping instance supplied if it
could be successfully removed, null otherwise.java.util.Collection getTransportMappings()
Collection of transport mappings in this message
dispatcher.
TransportMapping getTransport(Address destAddress)
destAddress - an Address instance.
TransportMapping instance that can be used to sent
a SNMP message to destAddress or null if
such a transport mapping does not exists.void addCommandResponder(CommandResponder listener)
CommandResponder instance to the message dispatcher.
Successfully processed SNMP messages will be presented to all command
responder (in the order in which they have been added) until a responder
uses the CommandResponderEvent.setProcessed(boolean processed)
to set the processed status of the event to true.
listener - a CommandResponder instance.void removeCommandResponder(CommandResponder listener)
CommandResponder instance from
the message dispatcher.
listener - a CommandResponder instance.
PduHandle sendPdu(TransportMapping transportMapping,
Address transportAddress,
int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
boolean expectResponse)
throws MessageException
transportMapping - the TransportMapping to be used to send the PDU. If
transportMapping is null the message
dispatcher will determine the appropriate transport mapping for the
given transport address.transportAddress - the target transport address.messageProcessingModel - typically the SNMP version.securityModel - Security Model to use.securityName - on behalf of this principal.securityLevel - Level of Security requested.pdu - the SNMP Protocol Data UnitexpectResponse - true if a response is expected and a state reference should
be saved (if needed for the supplied message processing model).
PduHandle that uniquely identifies this request.
MessageException
PduHandle sendPdu(TransportMapping transportMapping,
Address transportAddress,
int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
boolean expectResponse,
PduHandleCallback callback)
throws MessageException
PduHandle that uniquely identifies the request as response
after the request has been sent and otional, if a
PduHandleCallback is given, it returns also the
PduHandle just before the request is sent through the
the callback interface.
transportMapping - the TransportMapping to be used to send the PDU. If
transportMapping is null the message
dispatcher will determine the appropriate transport mapping for the
given transport address.transportAddress - the target transport address.messageProcessingModel - typically the SNMP version.securityModel - Security Model to use.securityName - on behalf of this principal.securityLevel - Level of Security requested.pdu - the SNMP Protocol Data UnitexpectResponse - true if a response is expected and a state reference should
be saved (if needed for the supplied message processing model).callback - an optional callback instance that is informed (if not
null) about the newly assigned PduHandle just before the
message is sent out.
PduHandle that uniquely identifies this request.
MessageException
PduHandle sendPdu(Address transportAddress,
int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
boolean expectResponse)
throws MessageException
sendPdu(TransportMapping transportMapping,
Address transportAddress, int messageProcessingModel,
int securityModel, byte[] securityName, int securityLevel, PDU pdu,
boolean expectResponse) with transportMapping set to
null.
transportAddress - the target transport address.messageProcessingModel - typically the SNMP version.securityModel - Security Model to use.securityName - on behalf of this principal.securityLevel - Level of Security requested.pdu - the SNMP Protocol Data UnitexpectResponse - true if a response is expected and a state reference should
be saved (if needed for the supplied message processing model).
PduHandle that uniquely identifies this request.
MessageException
int returnResponsePdu(int messageProcessingModel,
int securityModel,
byte[] securityName,
int securityLevel,
PDU pdu,
int maxSizeResponseScopedPDU,
StateReference stateReference,
StatusInformation statusInformation)
throws MessageException
messageProcessingModel - intsecurityModel - intsecurityName - byte[]securityLevel - intpdu - PDUmaxSizeResponseScopedPDU - intstateReference - StateReferencestatusInformation - StatusInformation
MessageException
void processMessage(TransportMapping sourceTransport,
Address incomingAddress,
BERInputStream wholeMessage)
processMessage(TransportMapping,Address,ByteBuffer)
instead.
sourceTransport - a TransportMapping instance denoting the transport that
received the message and that will be used to send any responses to
this message. The sourceTransport has to support the
incomingAddress's implementation class.incomingAddress - the Address from which the message has been received.wholeMessage - an BERInputStream containing the received SNMP message.
The supplied input stream must support marks, otherwise an
IllegalArgumentException is thrown.
void processMessage(TransportMapping sourceTransport,
Address incomingAddress,
java.nio.ByteBuffer wholeMessage)
processMessage in interface TransportListenersourceTransport - a TransportMapping instance denoting the transport that
received the message and that will be used to send any responses to
this message. The sourceTransport has to support the
incomingAddress's implementation class.incomingAddress - the Address from which the message has been received.wholeMessage - an ByteBuffer containing the received SNMP message.
void releaseStateReference(int messageProcessingModel,
PduHandle pduHandle)
PduHandle in the specified message processing model.
messageProcessingModel - a message processing model ID.pduHandle - the PduHandle that identifies a confirmed class message.MessageProcessingModel
|
Copyright 2003-2009 Frank Fock and Jochen Katz (SNMP4J.org) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||