01: /*_############################################################################
02: _##
03: _## SNMP4J-AgentX - AgentXMessageDispatcher.java
04: _##
05: _## Copyright (C) 2005-2007 Frank Fock (SNMP4J.org)
06: _##
07: _## This program is free software; you can redistribute it and/or modify
08: _## it under the terms of the GNU General Public License version 2 as
09: _## published by the Free Software Foundation.
10: _##
11: _## This program is distributed in the hope that it will be useful,
12: _## but WITHOUT ANY WARRANTY; without even the implied warranty of
13: _## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: _## GNU General Public License for more details.
15: _##
16: _## You should have received a copy of the GNU General Public License
17: _## along with this program; if not, write to the Free Software
18: _## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19: _## MA 02110-1301 USA
20: _##
21: _##########################################################################*/
22:
23: package org.snmp4j.agent.agentx;
24:
25: import java.util.Collection;
26: import org.snmp4j.TransportMapping;
27: import org.snmp4j.transport.TransportListener;
28: import org.snmp4j.smi.Address;
29: import java.io.IOException;
30: import org.snmp4j.mp.PduHandle;
31: import org.snmp4j.mp.PduHandleCallback;
32:
33: public interface AgentXMessageDispatcher extends TransportListener {
34:
35: /**
36: * Adds a {@link TransportMapping} to the dispatcher. The transport mapping
37: * is used to send and receive messages to/from the network.
38: * @param transport
39: * a <code>TransportMapping</code> instance.
40: */
41: void addTransportMapping(TransportMapping transport);
42:
43: /**
44: * Removes a previously added {@link TransportMapping} from
45: * the dispatcher.
46: * @param transport
47: * a <code>TransportMapping</code> instance.
48: * @return
49: * the <code>TransportMapping</code> instance supplied if it
50: * could be successfully removed, <code>null</code> otherwise.
51: */
52: TransportMapping removeTransportMapping(TransportMapping transport);
53:
54: /**
55: * Gets the <code>Collection</code> of transport mappings in this message
56: * dispatcher.
57: * @return Collection
58: */
59: Collection getTransportMappings();
60:
61: void addCommandListener(AgentXCommandListener listener);
62:
63: void removeCommandListener(AgentXCommandListener listener);
64:
65: /**
66: * Sends a AgentX PDU to the specified address using the specified transport
67: * mapping.
68: * @param transport
69: * a TransportMapping supported by the AgentX protocol.
70: * @param address
71: * the target Address.
72: * @param message
73: * the AgentXPDU to send.
74: * @param pduHandleCallback
75: * an optional callback reference. If not <code>null</code> then the
76: * callback will be informed about the assigned PduHandle just before the
77: * request is sent out.
78: * @return
79: * the PduHandle associated with the PDU.
80: * @throws IOException
81: */
82: PduHandle send(TransportMapping transport, Address address,
83: AgentXPDU message, PduHandleCallback pduHandleCallback)
84: throws IOException;
85:
86: }
|