2 * jSite2 - FpcListener.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.fcp;
22 import java.util.EventListener;
25 * Interface for objects that want to be notified on certain FCP events.
27 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
30 public interface FcpListener extends EventListener {
33 * Notifies a listener that a “NodeHello” message was received.
35 * @param fcpConnection
36 * The connection that received the message
38 * The “NodeHello” message
40 public void receivedNodeHello(FcpConnection fcpConnection, NodeHello nodeHello);
43 * Notifies a listener that a “CloseConnectionDuplicateClientName” message
46 * @param fcpConnection
47 * The connection that received the message
48 * @param closeConnectionDuplicateClientName
49 * The “CloseConnectionDuplicateClientName” message
51 public void receivedCloseConnectionDuplicateClientName(FcpConnection fcpConnection, CloseConnectionDuplicateClientName closeConnectionDuplicateClientName);
54 * Notifies a listener that a “SSKKeypair” message was received.
56 * @param fcpConnection
57 * The connection that received themessage
59 * The “SSKKeypair” message
61 public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair);
64 * Notifies a listener that a “Peer” message was received.
66 * @param fcpConnection
67 * The connection that received the message
71 public void receivedPeer(FcpConnection fcpConnection, Peer peer);
74 * Notifies a listener that an “EndListPeers” message was received.
76 * @param fcpConnection
77 * The connection that recevied the message
79 * The “EndListPeers” message
81 public void receivedEndListPeers(FcpConnection fcpConnection, EndListPeers endListPeers);
84 * Notifies a listener that a “PeerNote” message was received.
86 * @param fcpConnection
87 * The connection that received the message
89 * The “PeerNote” message
91 public void receivedPeerNote(FcpConnection fcpConnection, PeerNote peerNote);
94 * Notifies a listener that an “EndListPeerNotes” message was received.
96 * @param fcpConnection
97 * The connection that received the message
98 * @param endListPeerNotes
99 * The “EndListPeerNotes” message
101 public void receivedEndListPeerNotes(FcpConnection fcpConnection, EndListPeerNotes endListPeerNotes);
104 * Notifies a listener that a “PeerRemoved” message was received.
106 * @param fcpConnection
107 * The connection that received the message
109 * The “PeerRemoved” message
111 public void receivedPeerRemoved(FcpConnection fcpConnection, PeerRemoved peerRemoved);
114 * Notifies a listener that a “NodeData” message was received.
116 * @param fcpConnection
117 * The connection that received the message
119 * The “NodeData” message
121 public void receivedNodeData(FcpConnection fcpConnection, NodeData nodeData);
124 * Notifies a listener that a “TestDDAReply” message was received.
126 * @param fcpConnection
127 * The connection that received the message
128 * @param testDDAReply
129 * The “TestDDAReply” message
131 public void receivedTestDDAReply(FcpConnection fcpConnection, TestDDAReply testDDAReply);
134 * Notifies a listener that a “TestDDAComplete” was received.
136 * @param fcpConnection
137 * The connection that received the message
138 * @param testDDAComplete
139 * The “TestDDAComplete” message
141 public void receivedTestDDAComplete(FcpConnection fcpConnection, TestDDAComplete testDDAComplete);
144 * Notifies a listener that a “PersistentGet” was received.
146 * @param fcpConnection
147 * The connection that received the message
148 * @param persistentGet
149 * The “PersistentGet” message
151 public void receivedPersistentGet(FcpConnection fcpConnection, PersistentGet persistentGet);
154 * Notifies a listener that a “PersistentPut” was received.
156 * @param fcpConnection
157 * The connection that received the message
158 * @param persistentPut
159 * The “PersistentPut” message
161 public void receivedPersistentPut(FcpConnection fcpConnection, PersistentPut persistentPut);
164 * Notifies a listener that a “EndListPersistentRequests” was received.
166 * @param fcpConnection
167 * The connection that received the message
168 * @param endListPersistentRequests
169 * The “EndListPersistentRequests” message
171 public void receivedEndListPersistentRequests(FcpConnection fcpConnection, EndListPersistentRequests endListPersistentRequests);
174 * Notifies a listener that a “URIGenerated” was received.
176 * @param fcpConnection
177 * The connection that received the message
178 * @param uriGenerated
179 * The “URIGenerated” message
181 public void receivedURIGenerated(FcpConnection fcpConnection, URIGenerated uriGenerated);
184 * Notifies a listener that a “DataFound” was received.
186 * @param fcpConnection
187 * The connection that received the message
189 * The “DataFound” message
191 public void receivedDataFound(FcpConnection fcpConnection, DataFound dataFound);
194 * Notifies a listener that an “AllData” was received.
196 * @param fcpConnection
197 * The connection that received the message
199 * The “AllData” message
201 public void receivedAllData(FcpConnection fcpConnection, AllData allData);
204 * Notifies a listener that a “SimpleProgress” was received.
206 * @param fcpConnection
207 * The connection that received the message
208 * @param simpleProgress
209 * The “SimpleProgress” message
211 public void receivedSimpleProgress(FcpConnection fcpConnection, SimpleProgress simpleProgress);
214 * Notifies a listener that a “StartedCompression” was received.
216 * @param fcpConnection
217 * The connection that received the message
218 * @param startedCompression
219 * The “StartedCompression” message
221 public void receivedStartedCompression(FcpConnection fcpConnection, StartedCompression startedCompression);
224 * Notifies a listener that a “FinishedCompression” was received.
226 * @param fcpConnection
227 * The connection that received the message
228 * @param finishedCompression
229 * The “FinishedCompression” message
231 public void receviedFinishedCompression(FcpConnection fcpConnection, FinishedCompression finishedCompression);
234 * Notifies a listener that an “UnknownPeerNoteType” was received.
236 * @param fcpConnection
237 * The connection that received the message
238 * @param unknownPeerNoteType
239 * The “UnknownPeerNoteType” message
241 public void receivedUnknownPeerNoteType(FcpConnection fcpConnection, UnknownPeerNoteType unknownPeerNoteType);
244 * Notifies a listener that a “UnknownNodeIdentifier” message was received.
246 * @param fcpConnection
247 * The connection that received the message
248 * @param unknownNodeIdentifier
249 * The “UnknownNodeIdentifier” message
251 public void receivedUnknownNodeIdentifier(FcpConnection fcpConnection, UnknownNodeIdentifier unknownNodeIdentifier);
254 * Notifies a listener that a “ConfigData” message was received.
256 * @param fcpConnection
257 * The connection that received the message
259 * The “ConfigData” message
261 public void receivedConfigData(FcpConnection fcpConnection, ConfigData configData);
264 * Notifies a listener that a “GetFailed” message was recevied.
266 * @param fcpConnection
267 * The connection that received the message
269 * The “GetFailed” message
271 public void receivedGetFailed(FcpConnection fcpConnection, GetFailed getFailed);
274 * Notifies a listener that a “PutFailed” message was received.
276 * @param fcpConnection
277 * The connection that received the message
279 * The “PutFailed” message
281 public void receivedPutFailed(FcpConnection fcpConnection, PutFailed putFailed);
284 * Notifies a listener that an “IdentifierCollision” message was receied.
286 * @param fcpConnection
287 * The connection that received the message
288 * @param identifierCollision
289 * The “IdentifierCollision” message
291 public void receivedIdentifierCollision(FcpConnection fcpConnection, IdentifierCollision identifierCollision);
294 * Notifies a listener that a “PersistentPutDir” message was received.
296 * @param fcpConnection
297 * The connection that received the message
298 * @param persistentPutDir
299 * The “PersistentPutDir” message
301 public void receivedPersistentPutDir(FcpConnection fcpConnection, PersistentPutDir persistentPutDir);
304 * Notifies a listener that a “PersistentRequestRemoved” message was
307 * @param fcpConnection
308 * The connection that received the message
309 * @param persistentRequestRemoved
310 * The “PersistentRequestRemoved” message
312 public void receivedPersistentRequestRemoved(FcpConnection fcpConnection, PersistentRequestRemoved persistentRequestRemoved);
315 * Notifies a listener that a “SubscribedUSKUpdate” message was received.
317 * @param fcpConnection
318 * The connection that recevied the message
319 * @param subscribedUSKUpdate
320 * The “SubscribedUSKUpdate” message
322 public void receivedSubscribedUSKUpdate(FcpConnection fcpConnection, SubscribedUSKUpdate subscribedUSKUpdate);
325 * Notifies a listener that a “PluginInfo” message was received.
327 * @param fcpConnection
328 * The connection that received the message
330 * The “PluginInfo” message
332 public void receivedPluginInfo(FcpConnection fcpConnection, PluginInfo pluginInfo);
335 * Notifies a listener that an “FCPPluginReply“ message was received.
337 * @param fcpConnection
338 * The connection that received the message
339 * @param fcpPluginReply
340 * The “FCPPluginReply” message
342 public void receivedFCPPluginReply(FcpConnection fcpConnection, FCPPluginReply fcpPluginReply);
345 * Notifies a listener that a “PersistentRequestModified” message was
348 * @param fcpConnection
349 * The connection that received the message
350 * @param persistentRequestModified
351 * The “PersistentRequestModified” message
353 public void receivedPersistentRequestModified(FcpConnection fcpConnection, PersistentRequestModified persistentRequestModified);
356 * Notifies a listener that a “PutSuccessful” message was received.
358 * @param fcpConnection
359 * The connection that received the message
360 * @param putSuccessful
361 * The “PutSuccessful” message
363 public void receivedPutSuccessful(FcpConnection fcpConnection, PutSuccessful putSuccessful);
366 * Notifies a listener that a “PutFetchable” message was received.
368 * @param fcpConnection
369 * The connection that received the message
370 * @param putFetchable
371 * The “PutFetchable” message
373 public void receivedPutFetchable(FcpConnection fcpConnection, PutFetchable putFetchable);
376 * Notifies a listener that a “ProtocolError” was received.
378 * @param fcpConnection
379 * The connection that received the message
380 * @param protocolError
381 * The “ProtocolError” message
383 public void receivedProtocolError(FcpConnection fcpConnection, ProtocolError protocolError);
386 * Notifies a listener that a message has been received. This method is only
387 * called if {@link FcpConnection#handleMessage(FcpMessage)} does not
388 * recognize the message. Should that ever happen, please file a bug report!
390 * @param fcpConnection
391 * The connection that received the message
393 * The message that was received
395 public void receivedMessage(FcpConnection fcpConnection, FcpMessage fcpMessage);
398 * Notifies a listener that a connection was closed. A closed connection can
399 * be reestablished by calling {@link FcpConnection#connect()} on the same
402 * @param fcpConnection
403 * The connection that was closed.
405 public void connectionClosed(FcpConnection fcpConnection);