package net.pterodactylus.util.fcp;
import java.util.EventListener;
-import java.util.Map;
-
/**
- * TODO
+ * Interface for objects that want to be notified on certain FCP events.
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
* @version $Id$
*/
public interface FcpListener extends EventListener {
- public void fcpConnected(FcpConnection fcpConnection);
- public void fcpDisconnected(FcpConnection fcpConnection);
-
- //
- // connection setup
- //
-
- public void fcpNodeHello(FcpConnection fcpConnection, Map<String, String> nodeProperties);
- public void fcpCloseConnectionDuplicateName(FcpConnection fcpConnection);
-
-
+ /**
+ * Notifies a listener that a “NodeHello” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param nodeHello
+ * The “NodeHello” message
+ */
+ public void receivedNodeHello(FcpConnection fcpConnection, NodeHello nodeHello);
+
+ /**
+ * Notifies a listener that a “CloseConnectionDuplicateClientName” message
+ * was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param closeConnectionDuplicateClientName
+ * The “CloseConnectionDuplicateClientName” message
+ */
+ public void receivedCloseConnectionDuplicateClientName(FcpConnection fcpConnection, CloseConnectionDuplicateClientName closeConnectionDuplicateClientName);
+
+ /**
+ * Notifies a listener that a “SSKKeypair” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received themessage
+ * @param sskKeypair
+ * The “SSKKeypair” message
+ */
+ public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair);
+
+ /**
+ * Notifies a listener that a “Peer” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param peer
+ * The “Peer” message
+ */
+ public void receivedPeer(FcpConnection fcpConnection, Peer peer);
+
+ /**
+ * Notifies a listener that an “EndListPeers” message was received.
+ *
+ * @param fcpConnection
+ * The connection that recevied the message
+ * @param endListPeers
+ * The “EndListPeers” message
+ */
+ public void receivedEndListPeers(FcpConnection fcpConnection, EndListPeers endListPeers);
+
+ /**
+ * Notifies a listener that a “PeerNote” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param peerNote
+ * The “PeerNote” message
+ */
+ public void receivedPeerNote(FcpConnection fcpConnection, PeerNote peerNote);
+
+ /**
+ * Notifies a listener that an “EndListPeerNotes” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param endListPeerNotes
+ * The “EndListPeerNotes” message
+ */
+ public void receivedEndListPeerNotes(FcpConnection fcpConnection, EndListPeerNotes endListPeerNotes);
+
+ /**
+ * Notifies a listener that a “PeerRemoved” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param peerRemoved
+ * The “PeerRemoved” message
+ */
+ public void receivedPeerRemoved(FcpConnection fcpConnection, PeerRemoved peerRemoved);
+
+ /**
+ * Notifies a listener that a “NodeData” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param nodeData
+ * The “NodeData” message
+ */
+ public void receivedNodeData(FcpConnection fcpConnection, NodeData nodeData);
+
+ /**
+ * Notifies a listener that a “TestDDAReply” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param testDDAReply
+ * The “TestDDAReply” message
+ */
+ public void receivedTestDDAReply(FcpConnection fcpConnection, TestDDAReply testDDAReply);
+
+ /**
+ * Notifies a listener that a “TestDDAComplete” was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param testDDAComplete
+ * The “TestDDAComplete” message
+ */
+ public void receivedTestDDAComplete(FcpConnection fcpConnection, TestDDAComplete testDDAComplete);
+
+ /**
+ * Notifies a listener that a “PersistentPut” was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param persistentPut
+ * The “PersistentPut” message
+ */
+ public void receivedPersistentPut(FcpConnection fcpConnection, PersistentPut persistentPut);
+
+ /**
+ * Notifies a listener that a “ProtocolError” was received.
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param protocolError
+ * The “ProtocolError” message
+ */
+ public void receivedProtocolError(FcpConnection fcpConnection, ProtocolError protocolError);
+
+ /**
+ * Notifies a listener that a message has been received. This method is only
+ * called if {@link FcpConnection#handleMessage(FcpMessage)} does not
+ * recognize the message. Should that ever happen, please file a bug report!
+ *
+ * @param fcpConnection
+ * The connection that received the message
+ * @param fcpMessage
+ * The message that was received
+ */
+ public void receivedMessage(FcpConnection fcpConnection, FcpMessage fcpMessage);
+
}