2 * jFCPlib - FpcListener.java - Copyright © 2008 David Roden
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package net.pterodactylus.fcp;
21 import java.util.EventListener;
24 * Interface for objects that want to be notified on certain FCP events.
26 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
28 public interface FcpListener extends EventListener {
31 * Notifies a listener that a “NodeHello” message was received.
33 * @param fcpConnection
34 * The connection that received the message
36 * The “NodeHello” message
38 public void receivedNodeHello(FcpConnection fcpConnection, NodeHello nodeHello);
41 * Notifies a listener that a “CloseConnectionDuplicateClientName” message
44 * @param fcpConnection
45 * The connection that received the message
46 * @param closeConnectionDuplicateClientName
47 * The “CloseConnectionDuplicateClientName” message
49 public void receivedCloseConnectionDuplicateClientName(FcpConnection fcpConnection, CloseConnectionDuplicateClientName closeConnectionDuplicateClientName);
52 * Notifies a listener that a “SSKKeypair” message was received.
54 * @param fcpConnection
55 * The connection that received themessage
57 * The “SSKKeypair” message
59 public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair);
62 * Notifies a listener that a “Peer” message was received.
64 * @param fcpConnection
65 * The connection that received the message
69 public void receivedPeer(FcpConnection fcpConnection, Peer peer);
72 * Notifies a listener that an “EndListPeers” message was received.
74 * @param fcpConnection
75 * The connection that recevied the message
77 * The “EndListPeers” message
79 public void receivedEndListPeers(FcpConnection fcpConnection, EndListPeers endListPeers);
82 * Notifies a listener that a “PeerNote” message was received.
84 * @param fcpConnection
85 * The connection that received the message
87 * The “PeerNote” message
89 public void receivedPeerNote(FcpConnection fcpConnection, PeerNote peerNote);
92 * Notifies a listener that an “EndListPeerNotes” message was received.
94 * @param fcpConnection
95 * The connection that received the message
96 * @param endListPeerNotes
97 * The “EndListPeerNotes” message
99 public void receivedEndListPeerNotes(FcpConnection fcpConnection, EndListPeerNotes endListPeerNotes);
102 * Notifies a listener that a “PeerRemoved” message was received.
104 * @param fcpConnection
105 * The connection that received the message
107 * The “PeerRemoved” message
109 public void receivedPeerRemoved(FcpConnection fcpConnection, PeerRemoved peerRemoved);
112 * Notifies a listener that a “NodeData” message was received.
114 * @param fcpConnection
115 * The connection that received the message
117 * The “NodeData” message
119 public void receivedNodeData(FcpConnection fcpConnection, NodeData nodeData);
122 * Notifies a listener that a “TestDDAReply” message was received.
124 * @param fcpConnection
125 * The connection that received the message
126 * @param testDDAReply
127 * The “TestDDAReply” message
129 public void receivedTestDDAReply(FcpConnection fcpConnection, TestDDAReply testDDAReply);
132 * Notifies a listener that a “TestDDAComplete” was received.
134 * @param fcpConnection
135 * The connection that received the message
136 * @param testDDAComplete
137 * The “TestDDAComplete” message
139 public void receivedTestDDAComplete(FcpConnection fcpConnection, TestDDAComplete testDDAComplete);
142 * Notifies a listener that a “PersistentGet” was received.
144 * @param fcpConnection
145 * The connection that received the message
146 * @param persistentGet
147 * The “PersistentGet” message
149 public void receivedPersistentGet(FcpConnection fcpConnection, PersistentGet persistentGet);
152 * Notifies a listener that a “PersistentPut” was received.
154 * @param fcpConnection
155 * The connection that received the message
156 * @param persistentPut
157 * The “PersistentPut” message
159 public void receivedPersistentPut(FcpConnection fcpConnection, PersistentPut persistentPut);
162 * Notifies a listener that a “EndListPersistentRequests” was received.
164 * @param fcpConnection
165 * The connection that received the message
166 * @param endListPersistentRequests
167 * The “EndListPersistentRequests” message
169 public void receivedEndListPersistentRequests(FcpConnection fcpConnection, EndListPersistentRequests endListPersistentRequests);
172 * Notifies a listener that a “URIGenerated” was received.
174 * @param fcpConnection
175 * The connection that received the message
176 * @param uriGenerated
177 * The “URIGenerated” message
179 public void receivedURIGenerated(FcpConnection fcpConnection, URIGenerated uriGenerated);
182 * Notifies a listener that a “DataFound” was received.
184 * @param fcpConnection
185 * The connection that received the message
187 * The “DataFound” message
189 public void receivedDataFound(FcpConnection fcpConnection, DataFound dataFound);
192 * Notifies a listener that an “AllData” was received.
194 * @param fcpConnection
195 * The connection that received the message
197 * The “AllData” message
199 public void receivedAllData(FcpConnection fcpConnection, AllData allData);
202 * Notifies a listener that a “SimpleProgress” was received.
204 * @param fcpConnection
205 * The connection that received the message
206 * @param simpleProgress
207 * The “SimpleProgress” message
209 public void receivedSimpleProgress(FcpConnection fcpConnection, SimpleProgress simpleProgress);
212 * Notifies a listener that a “StartedCompression” was received.
214 * @param fcpConnection
215 * The connection that received the message
216 * @param startedCompression
217 * The “StartedCompression” message
219 public void receivedStartedCompression(FcpConnection fcpConnection, StartedCompression startedCompression);
222 * Notifies a listener that a “FinishedCompression” was received.
224 * @param fcpConnection
225 * The connection that received the message
226 * @param finishedCompression
227 * The “FinishedCompression” message
229 public void receivedFinishedCompression(FcpConnection fcpConnection, FinishedCompression finishedCompression);
232 * Notifies a listener that an “UnknownPeerNoteType” was received.
234 * @param fcpConnection
235 * The connection that received the message
236 * @param unknownPeerNoteType
237 * The “UnknownPeerNoteType” message
239 public void receivedUnknownPeerNoteType(FcpConnection fcpConnection, UnknownPeerNoteType unknownPeerNoteType);
242 * Notifies a listener that a “UnknownNodeIdentifier” message was received.
244 * @param fcpConnection
245 * The connection that received the message
246 * @param unknownNodeIdentifier
247 * The “UnknownNodeIdentifier” message
249 public void receivedUnknownNodeIdentifier(FcpConnection fcpConnection, UnknownNodeIdentifier unknownNodeIdentifier);
252 * Notifies a listener that a “ConfigData” message was received.
254 * @param fcpConnection
255 * The connection that received the message
257 * The “ConfigData” message
259 public void receivedConfigData(FcpConnection fcpConnection, ConfigData configData);
262 * Notifies a listener that a “GetFailed” message was recevied.
264 * @param fcpConnection
265 * The connection that received the message
267 * The “GetFailed” message
269 public void receivedGetFailed(FcpConnection fcpConnection, GetFailed getFailed);
272 * Notifies a listener that a “PutFailed” message was received.
274 * @param fcpConnection
275 * The connection that received the message
277 * The “PutFailed” message
279 public void receivedPutFailed(FcpConnection fcpConnection, PutFailed putFailed);
282 * Notifies a listener that an “IdentifierCollision” message was receied.
284 * @param fcpConnection
285 * The connection that received the message
286 * @param identifierCollision
287 * The “IdentifierCollision” message
289 public void receivedIdentifierCollision(FcpConnection fcpConnection, IdentifierCollision identifierCollision);
292 * Notifies a listener that a “PersistentPutDir” message was received.
294 * @param fcpConnection
295 * The connection that received the message
296 * @param persistentPutDir
297 * The “PersistentPutDir” message
299 public void receivedPersistentPutDir(FcpConnection fcpConnection, PersistentPutDir persistentPutDir);
302 * Notifies a listener that a “PersistentRequestRemoved” message was
305 * @param fcpConnection
306 * The connection that received the message
307 * @param persistentRequestRemoved
308 * The “PersistentRequestRemoved” message
310 public void receivedPersistentRequestRemoved(FcpConnection fcpConnection, PersistentRequestRemoved persistentRequestRemoved);
313 * Notifies a listener that a “SubscribedUSKUpdate” message was received.
315 * @param fcpConnection
316 * The connection that recevied the message
317 * @param subscribedUSKUpdate
318 * The “SubscribedUSKUpdate” message
320 public void receivedSubscribedUSKUpdate(FcpConnection fcpConnection, SubscribedUSKUpdate subscribedUSKUpdate);
323 * Notifies a listener that a “PluginInfo” message was received.
325 * @param fcpConnection
326 * The connection that received the message
328 * The “PluginInfo” message
330 public void receivedPluginInfo(FcpConnection fcpConnection, PluginInfo pluginInfo);
333 * Notifies a listener that an “FCPPluginReply“ message was received.
335 * @param fcpConnection
336 * The connection that received the message
337 * @param fcpPluginReply
338 * The “FCPPluginReply” message
340 public void receivedFCPPluginReply(FcpConnection fcpConnection, FCPPluginReply fcpPluginReply);
343 * Notifies a listener that a “PersistentRequestModified” message was
346 * @param fcpConnection
347 * The connection that received the message
348 * @param persistentRequestModified
349 * The “PersistentRequestModified” message
351 public void receivedPersistentRequestModified(FcpConnection fcpConnection, PersistentRequestModified persistentRequestModified);
354 * Notifies a listener that a “PutSuccessful” message was received.
356 * @param fcpConnection
357 * The connection that received the message
358 * @param putSuccessful
359 * The “PutSuccessful” message
361 public void receivedPutSuccessful(FcpConnection fcpConnection, PutSuccessful putSuccessful);
364 * Notifies a listener that a “PutFetchable” message was received.
366 * @param fcpConnection
367 * The connection that received the message
368 * @param putFetchable
369 * The “PutFetchable” message
371 public void receivedPutFetchable(FcpConnection fcpConnection, PutFetchable putFetchable);
374 * Notifies a listener that a feed was sent to a peer.
377 * The connection that received the message
379 * The “SentFeed” message
381 public void receivedSentFeed(FcpConnection source, SentFeed sentFeed);
384 * Notifies a listener that a bookmark was updated.
386 * @param fcpConnection
387 * The connection that received the message
388 * @param receivedBookmarkFeed
389 * The “ReceivedBookmarkFeed” message
391 public void receivedBookmarkFeed(FcpConnection fcpConnection, ReceivedBookmarkFeed receivedBookmarkFeed);
394 * Notifies a listener that a “ProtocolError” was received.
396 * @param fcpConnection
397 * The connection that received the message
398 * @param protocolError
399 * The “ProtocolError” message
401 public void receivedProtocolError(FcpConnection fcpConnection, ProtocolError protocolError);
404 * Notifies a listener that a message has been received. This method is only
405 * called if {@link FcpConnection#handleMessage(FcpMessage)} does not
406 * recognize the message. Should that ever happen, please file a bug report!
408 * @param fcpConnection
409 * The connection that received the message
411 * The message that was received
413 public void receivedMessage(FcpConnection fcpConnection, FcpMessage fcpMessage);
416 * Notifies a listener that a connection was closed. A closed connection can
417 * be reestablished by calling {@link FcpConnection#connect()} on the same
420 * @param fcpConnection
421 * The connection that was closed.
423 * The exception that caused the disconnect, or <code>null</code>
424 * if there was no exception
426 public void connectionClosed(FcpConnection fcpConnection, Throwable throwable);