Class TransportAuditEvent
java.lang.Object
java.util.EventObject
org.snmp4j.transport.TransportAuditEvent
- All Implemented Interfaces:
Serializable
The
TransportAuditEvent describes a transport level operation that is about to be executed
(or, for TransportAuditEvent.TransportOperation.CLOSE, has been executed) by a
TransportMapping. It is passed to all registered
TransportAuditListeners through
AbstractTransportMapping.fireTransportAuditEvent(TransportAuditEvent), which lets the
listeners control (allow or deny) and audit the transport's communication.- Since:
- 3.12.0
- Version:
- 3.12.0
- Author:
- Frank Fock
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTheTransportOperationenumerates the transport operations that can be audited. -
Field Summary
Fields inherited from class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionTransportAuditEvent(Object source, TransportAuditEvent.TransportOperation operation, Address peerAddress, Address localAddress, byte[] message) Creates aTransportAuditEvent. -
Method Summary
Modifier and TypeMethodDescriptionGets the local (listen) address associated with this event.byte[]Gets the message associated with this event.Gets the audited transport operation.Gets the remote address associated with this event.toString()Methods inherited from class EventObject
getSource
-
Constructor Details
-
TransportAuditEvent
public TransportAuditEvent(Object source, TransportAuditEvent.TransportOperation operation, Address peerAddress, Address localAddress, byte[] message) Creates aTransportAuditEvent.- Parameters:
source- theTransportMappingthat fired this event.operation- the auditedTransportAuditEvent.TransportOperation.peerAddress- the remote address associated with the operation, ornullif the operation does not refer to a remote peer (for exampleTransportAuditEvent.TransportOperation.LISTEN). ForTransportAuditEvent.TransportOperation.SENDthis is the target address, forTransportAuditEvent.TransportOperation.RECEIVEthe source address of the received message.localAddress- the local (listen) address associated with the operation, ornullif not available.message- the message associated with the operation forTransportAuditEvent.TransportOperation.SENDandTransportAuditEvent.TransportOperation.RECEIVE, ornullotherwise.
-
-
Method Details
-
getOperation
Gets the audited transport operation.- Returns:
- the
TransportAuditEvent.TransportOperation.
-
getPeerAddress
Gets the remote address associated with this event.- Returns:
- the target address for
TransportAuditEvent.TransportOperation.SEND, the source address forTransportAuditEvent.TransportOperation.RECEIVE, the closed peer address for a connectionTransportAuditEvent.TransportOperation.CLOSE, ornullif no remote peer is associated with the operation.
-
getLocalAddress
Gets the local (listen) address associated with this event.- Returns:
- the local address or
nullif not available.
-
getMessage
public byte[] getMessage()Gets the message associated with this event.- Returns:
- the message bytes for
TransportAuditEvent.TransportOperation.SENDandTransportAuditEvent.TransportOperation.RECEIVE, ornullforTransportAuditEvent.TransportOperation.LISTENandTransportAuditEvent.TransportOperation.CLOSE.
-
toString
- Overrides:
toStringin classEventObject
-