/**
* Container for ARKs (address resolution keys).
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ARK {
/**
* Creates a new ARK with the given URI and number.
- *
+ *
* @param publicURI
* The public URI of the ARK
* @param number
/**
* Creates a new ARK with the given URIs and number.
- *
+ *
* @param publicURI
* The public URI of the ARK
* @param privateURI
/**
* Returns the public URI of the ARK.
- *
+ *
* @return The public URI of the ARK
*/
public String getPublicURI() {
/**
* Returns the private URI of the ARK.
- *
+ *
* @return The private URI of the ARK
*/
public String getPrivateURI() {
/**
* Returns the number of the ARK.
- *
+ *
* @return The number of the ARK
*/
public int getNumber() {
/**
* The “AddPeer” request adds a peer to the node.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class AddPeer extends FcpMessage {
/**
* Creates a new “AddPeer” request that reads the noderef of the peer from
* the given file.
- *
+ *
* @param file
* The file to read the noderef from
*/
/**
* Creates a new “AddPeer” request that reads the noderef of the peer from
* the given URL.
- *
+ *
* @param url
* The URL to read the noderef from
*/
/**
* Creates a new “AddPeer” request that adds the peer given by the noderef.
- *
+ *
* @param nodeRef
* The noderef of the peer
*/
/**
* Sets the noderef of the peer to add.
- *
+ *
* @param nodeRef
* The noderef of the peer
*/
* {@link #getPayloadInputStream()} to get the data. If an AllData message
* passes through all registered {@link FcpListener}s without the payload being
* consumed, the payload is discarded!
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class AllData extends BaseMessage {
/**
* Creates an “AllData” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
* @param payloadInputStream
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the length of the data.
- *
+ *
* @return The length of the data, or <code>-1</code> if the length could
* not be parsed
*/
/**
* Returns the startup time of the request.
- *
+ *
* @return The startup time of the request (in milliseconds since Jan 1,
* 1970 UTC), or <code>-1</code> if the time could not be parsed
*/
/**
* Returns the completion time of the request.
- *
+ *
* @return The completion time of the request (in milliseconds since Jan 1,
* 1970 UTC), or <code>-1</code> if the time could not be parsed
*/
* Returns the payload input stream. You <strong>have</strong> consume the
* input stream before returning from the
* {@link FcpListener#receivedAllData(FcpConnection, AllData)} method!
- *
+ *
* @return The payload
*/
public InputStream getPayloadInputStream() {
/**
* A basic message abstraction that wraps a received FCP message.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class BaseMessage {
/**
* Creates a new base message that wraps the given message.
- *
+ *
* @param receivedMessage
* The FCP message that was received
*/
/**
* Returns the name of the message.
- *
+ *
* @return The name of the message
*/
public String getName() {
/**
* Returns the content of the field.
- *
+ *
* @param field
* The name of the field
* @return The content of the field, or <code>null</code> if there is no
/**
* Returns all fields from the received message.
- *
+ *
* @see FcpMessage#getFields()
* @return All fields from the message
*/
/**
* A “ClientGet” request is used for download files from the Freenet node.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ClientGet extends FcpMessage {
/**
* Creates a new “ClientGet” request.
- *
+ *
* @param uri
* The URI to get
* @param identifier
/**
* Creates a new “ClientGet” request.
- *
+ *
* @param uri
* The URI to get
* @param identifier
/**
* Sets whether the local data store should be ignored when searching for a
* key.
- *
+ *
* @param ignoreDataStore
* <code>true</code> to ignore the local data store,
* <code>false</code> to include it
/**
* Sets whether the search for the key should be restricted to the local
* data store only.
- *
+ *
* @param dsOnly
* <code>true</code> to restrict the search to the local data
* store, <code>false</code> to search on other nodes, too
/**
* Sets the verbosity of the request.
- *
+ *
* @param verbosity
* The verbosity of the request
*/
/**
* Sets the maximum size of the file to retrieve. If the file is larger than
* this size the request will fail!
- *
+ *
* @param maxSize
* The maximum size of the file to retrieve
*/
/**
* Sets the maximum size of temporary files created by the node. If a
* temporary file is larger than this size the request will fail!
- *
+ *
* @param maxTempSize
* The maximum size of temporary files
*/
/**
* The maximum number of retries in case a block can not be retrieved.
- *
+ *
* @param maxRetries
* The maximum number of retries for failed blocks,
* <code>-1</code> to try forever
/**
* Sets the priority of the request.
- *
+ *
* @param priority
* The priority of the request
*/
/**
* Sets the persistence of the request.
- *
+ *
* @param persistence
* The persistence of the request
*/
/**
* Sets the client token of the request.
- *
+ *
* @param clientToken
* The client token of the request
*/
/**
* Sets whether the request should be visible on the global queue.
- *
+ *
* @param global
* <code>true</code> to make the request visible on the global
* queue, <code>false</code> for client-local queue only
/**
* Sets whether to request the “binary blob” for a key.
- *
+ *
* @param binaryBlob
* <code>true</code> to request the binary blob,
* <code>false</code> to get the “real thing”
* Sets the allowed MIME types of the requested file. If the MIME type of
* the file does not match one of the given MIME types the request will
* fail!
- *
+ *
* @param allowedMimeTypes
* The allowed MIME types
*/
/**
* Sets the filename to download the file to. You should only call this
* method if your return type is {@link ReturnType#disk}!
- *
+ *
* @param filename
* The filename to download the file to
*/
/**
* Sets the name for the temporary file. You should only call this method if
* your return type is {@link ReturnType#disk}!
- *
+ *
* @param tempFilename
* The name of the temporary file
*/
/**
* A “ClientHello” message that <i>must</i> be sent to the node first thing
* after calling {@link FcpConnection#connect()}.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ClientHello extends FcpMessage {
* Creates a new “ClientHello” message with the given client name. The
* client name has to be unique to the node otherwise you will get a
* {@link CloseConnectionDuplicateClientName} response from the node!
- *
+ *
* @param clientName
* The unique client name
*/
* client name has to be unique to the node otherwise you will get a
* {@link CloseConnectionDuplicateClientName} response from the node! The
* expected FCP version is currently ignored by the node.
- *
+ *
* @param clientName
* The unique client name
* @param expectedVersion
* it directly with this messge ({@link UploadFrom#direct}), uploading it from
* disk ({@link UploadFrom#disk}) or by creating a redirect to another URI (
* {@link UploadFrom#redirect}).
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ClientPut extends FcpMessage {
* constructor is the same as using
* {@link #ClientPut(String, String, UploadFrom)} with
* {@link UploadFrom#direct} as third parameter.
- *
+ *
* @param uri
* The URI to insert the file to
* @param identifier
* before using this option! If <code>uploadFrom</code> is
* {@link UploadFrom#redirect}, use {@link #setTargetURI(String)} to set the
* target URI of the redirect.
- *
+ *
* @param uri
* The URI to insert to
* @param identifier
/**
* The MIME type of the content.
- *
+ *
* @param metadataContentType
* The MIME type of the content
*/
* The verbosity of the request. Depending on this parameter you will
* received only the bare minimum of messages for the request (i.e. “it
* completed”) or a whole lot more.
- *
+ *
* @see Verbosity
* @param verbosity
* The verbosity of the request
/**
* The number of retries for a request if the initial try failed.
- *
+ *
* @param maxRetries
* The maximum number of retries after failure, or
* <code>-1</code> to retry forever.
/**
* Sets the priority of the request.
- *
+ *
* @param priority
* The priority of the request
*/
/**
* Determines whether the node should really insert the data or generate the
* final CHK only.
- *
+ *
* @param getCHKOnly
* <code>true</code> to generate the final CHK only,
* <code>false</code> to really insert the data
/**
* Determines whether this request appears on the global queue.
- *
+ *
* @param global
* <code>true</code> to put the request on the global queue,
* <code>false</code> for the client-local queue.
/**
* Determines whether the node should skip compression because the file has
* already been compressed.
- *
+ *
* @param dontCompress
* <code>true</code> to skip compression of the data in the node,
* <code>false</code> to allow compression
* Sets an optional client token. This client token is mentioned in progress
* and other request-related messages and can be used to identify this
* request.
- *
+ *
* @param clientToken
* The client token
*/
/**
* Sets the persistence of this request.
- *
+ *
* @param persistence
* The persistence of this request
*/
/**
* Sets the target filename of the inserted file. This value is ignored for
* all inserts that do not have “CHK@” as a target.
- *
+ *
* @param targetFilename
* The filename of the target
*/
/**
* Determines whether to encode the complete file early in the life of the
* request.
- *
+ *
* @param earlyEncode
* <code>true</code> to generate the final key long before the
* file is completely fetchable
/**
* Sets the length of the data that will be transferred after this message
* if <code>uploadFrom</code> is {@link UploadFrom#direct} is used.
- *
+ *
* @param dataLength
* The length of the data
*/
/**
* Sets the name of the file to upload the data from.
- *
+ *
* @param filename
* The filename to upload
*/
/**
* If <code>uploadFrom</code> is {@link UploadFrom#redirect}, use this
* method to determine that target of the redirect.
- *
+ *
* @param targetURI
* The target URI to redirect to
*/
/**
* The “ClientPutComplexDir” lets you upload a directory with different sources
* for each file.
- *
+ *
* @see FileEntry
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
/**
* Creates a new “ClientPutComplexDir” with the given identifier and URI.
- *
+ *
* @param identifier
* The identifier of the request
* @param uri
/**
* Sets the verbosity of the request.
- *
+ *
* @param verbosity
* The verbosity of the request
*/
/**
* Sets the maximum number of retries for failed blocks.
- *
+ *
* @param maxRetries
* The maximum number of retries for failed blocks, or
* <code>-1</code> to retry endlessly
/**
* Sets the priority of the request.
- *
+ *
* @param priority
* The priority of the request
*/
/**
* Sets whether to generate the final URI only.
- *
+ *
* @param getCHKOnly
* <code>true</code> to generate the final CHK only,
* <code>false</code> to complete the insert
/**
* Sets whether the request is on the global queue.
- *
+ *
* @param global
* <code>true</code> to put the request on the global queue,
* <code>false</code> to put it on the client-local queue
/**
* Sets whether the node should not try to compress the data.
- *
+ *
* @param dontCompress
* <code>true</code> to skip compression of the data,
* <code>false</code> to try and compress the data
/**
* Sets the client token of the request.
- *
+ *
* @param clientToken
* The client token of the request
*/
/**
* Sets the persistence of the request.
- *
+ *
* @param persistence
* The persistence of the request
*/
/**
* Sets the target filename of the request. This is useful for inserts that
* go to “CHK@” only and creates a manifest with a single file.
- *
+ *
* @param targetFilename
* The target filename
*/
/**
* Sets whether to encode the complete data early to generate the
* {@link URIGenerated} message early.
- *
+ *
* @param earlyEncode
* <code>true</code> to encode the complete data early,
* <code>false</code> otherwise
/**
* Sets the default name. This is the name of the file that should be shown
* if no file was specified.
- *
+ *
* @param defaultName
* The default name
*/
/**
* Adds an entry for a file.
- *
+ *
* @param fileEntry
* The file entry to add
*/
/**
* The “ClientPutDiskDir” message is used to insert a complete directory from
* the disk to a single key.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ClientPutDiskDir extends FcpMessage {
/**
* Creates a new “ClientPutDiskDir” message.
- *
+ *
* @param uri
* The URI to insert the file to
* @param identifier
* The verbosity of the request. Depending on this parameter you will
* received only the bare minimum of messages for the request (i.e. “it
* completed”) or a whole lot more.
- *
+ *
* @see Verbosity
* @param verbosity
* The verbosity of the request
/**
* The number of retries for a request if the initial try failed.
- *
+ *
* @param maxRetries
* The maximum number of retries after failure, or
* <code>-1</code> to retry forever.
/**
* Sets the priority of the request.
- *
+ *
* @param priority
* The priority of the request
*/
/**
* Determines whether the node should really insert the data or generate the
* final CHK only.
- *
+ *
* @param getCHKOnly
* <code>true</code> to generate the final CHK only,
* <code>false</code> to really insert the data
/**
* Determines whether this request appears on the global queue.
- *
+ *
* @param global
* <code>true</code> to put the request on the global queue,
* <code>false</code> for the client-local queue.
/**
* Determines whether the node should skip compression because the file has
* already been compressed.
- *
+ *
* @param dontCompress
* <code>true</code> to skip compression of the data in the node,
* <code>false</code> to allow compression
* Sets an optional client token. This client token is mentioned in progress
* and other request-related messages and can be used to identify this
* request.
- *
+ *
* @param clientToken
* The client token
*/
/**
* Sets the persistence of this request.
- *
+ *
* @param persistence
* The persistence of this request
*/
/**
* Sets the name of the default file. The default file is shown when the key
* is requested with an additional name.
- *
+ *
* @param defaultName
* The name of the default file
*/
/**
* Sets whether unreadable files allow the insert to continue.
- *
+ *
* @param allowUnreadableFiles
* <code>true</code> to just ignore unreadable files,
* <code>false</code> to let the insert fail when an unreadable
/**
* A “CloseConnectionDuplicateClientName” message.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class CloseConnectionDuplicateClientName extends BaseMessage {
/**
* Creates a new CloseConnectionDuplicateClientName message that wraps the
* given message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* A “ConfigData” message contains various aspects of the node’s configuration.
- *
+ *
* @see GetConfig
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
/**
* Creates a new “ConfigData” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the current value of the given option.
- *
+ *
* @param option
* The name of the option
* @return The current value of the option
/**
* Returns the short description of the given option.
- *
+ *
* @param option
* The name of the option
* @return The short description of the option
/**
* Returns the long description of the given option.
- *
+ *
* @param option
* The name of the option
* @return The long description of the option
/**
* Returns the data type of the given option.
- *
+ *
* @param option
* The name of the option
* @return The data type of the option
/**
* Returns the default value of the given option.
- *
+ *
* @param option
* The name of the option
* @return The default value of the option
/**
* Returns the sort order of the given option.
- *
+ *
* @param option
* The name of the option
* @return The sort order of the option, or <code>-1</code> if the sort
/**
* Returns the expert flag of the given option.
- *
+ *
* @param option
* The name of the option
* @return The expert flag of the option
/**
* Returns the force-write flag of the given option
- *
+ *
* @param option
* The name of the option
* @return The force-write flag of the given option
/**
* Container for the DSA group of a peer. A DSA group consists of a base (called
* “g”), a prime (called “p”) and a subprime (called “q”).
- *
+ *
* @see DSAParams
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
/**
* Creates a new DSA group with the given base (“g”), prime (“p”), and
* subprime (“q”).
- *
+ *
* @param base
* The base of the DSA group
* @param prime
/**
* Returns the base (“g”) of the DSA group.
- *
+ *
* @return The base of the DSA group
*/
public String getBase() {
/**
* Returns the prime (“p”) of the DSA group.
- *
+ *
* @return The prime of the DSA group
*/
public String getPrime() {
/**
* Returns the subprime (“q”) of the DSA group.
- *
+ *
* @return The subprime of the DSA group
*/
public String getSubprime() {
* A “DataFound” message signals the client that the data requested by a
* {@link ClientGet} operation has been found. This message does not include the
* actual data, though.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class DataFound extends BaseMessage {
/**
* Creates a new “DataFound” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> if the request is on the client-local queue
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the content type of the data.
- *
+ *
* @return The content type of the data
*/
public String getMetadataContentType() {
/**
* Returns the length of the data.
- *
+ *
* @return The length of the data
*/
public long getDataLength() {
/**
* The “EndListPeerNotes” message signals the end of a list of “PeerNote”
* messages.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class EndListPeerNotes extends BaseMessage {
/**
* Creates a new “EndListPeerNotes” message that wraps the received message.
- *
+ *
* @param fcpMessage
* The received message
*/
/**
* This message marks the end of a list of “Peer” replies.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class EndListPeers extends BaseMessage {
/**
* Creates a new “EndListPeers” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The message that was received
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* The “EndListPersistentRequests” message signals the end of a list of
* {@link PersistentGet} and {@link PersistentPut} requests.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class EndListPersistentRequests extends BaseMessage {
/**
* Creates a new “EndListPersistentRequests” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* An “CPPluginMessage” sends a message with custom parameters and (optional)
* payload to a plugin.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FCPPluginMessage extends FcpMessage {
/**
* Creates a new “FCPPluginMessage” message for the given plugin.
- *
+ *
* @param pluginClass
* The name of the plugin class
*/
* Sets the identifier of the request. Though this is still optional you are
* encouraged to include it because the plugin might reply in random order
* to requests.
- *
+ *
* @param identifier
* The identifier of the request
*/
/**
* Sets a custom parameter for the plugin.
- *
+ *
* @param key
* The key of the parameter
* @param value
* Sets the length of data of the optional payload. If you call this method
* you also have to call {@link #setPayloadInputStream(java.io.InputStream)}
* !
- *
+ *
* @param dataLength
* The length of data in the payload input stream
*/
/**
* Adapter for {@link FcpListener}.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FcpAdapter implements FcpListener {
/**
* {@inheritDoc}
- *
+ *
* @see FcpListener#receivedNodeData(FcpConnection, NodeData)
*/
public void receivedNodeData(FcpConnection fcpConnection, NodeData nodeData) {
/**
* {@inheritDoc}
- *
+ *
* @see FcpListener#receivedTestDDAReply(FcpConnection, TestDDAReply)
*/
public void receivedTestDDAReply(FcpConnection fcpConnection, TestDDAReply testDDAReply) {
/**
* Handles an FCP connection to a node.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
class FcpConnectionHandler implements Runnable {
/**
* Creates a new connection handler that operates on the given connection
* and input stream.
- *
+ *
* @param fcpConnection
* The underlying FCP connection
* @param remoteInputStream
/**
* Reads bytes from {@link #remoteInputStream} until ‘\r’ or ‘\n’ are
* encountered and decodes the read bytes using UTF-8.
- *
+ *
* @return The decoded line
* @throws IOException
* if an I/O error occurs
/**
* Container for an SSK keypair.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FcpKeyPair {
/**
* Creates a new keypair from the given keys.
- *
+ *
* @param publicKey
* The public key
* @param privateKey
/**
* Returns the public key of this keypair.
- *
+ *
* @return The public key
*/
public String getPublicKey() {
/**
* Returns the private key of this keypair.
- *
+ *
* @return The private key
*/
public String getPrivateKey() {
* An FCP message. FCP messages consist of a name, an arbitrary amount of
* “fields” (i.e. key-value pairs), a message end marker, and optional payload
* data that follows the marker.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FcpMessage implements Iterable<String> {
/**
* Creates a new FCP message with the given name.
- *
+ *
* @param name
* The name of the FCP message
*/
* Creates a new FCP message with the given name and the given payload input
* stream. The payload input stream is not read until the message is sent to
* the node using {@link FcpConnection#sendMessage(FcpMessage)}.
- *
+ *
* @param name
* The name of the message
* @param payloadInputStream
/**
* Returns the name of the message.
- *
+ *
* @return The name of the message
*/
public String getName() {
/**
* Checks whether this message has a field with the given name.
- *
+ *
* @param field
* The name of the field to check for
* @return <code>true</code> if the message has a field with the given name,
/**
* Sets the field with the given name to the given value. If the field
* already exists in this message it is overwritten.
- *
+ *
* @param field
* The name of the field
* @param value
/**
* Returns the value of the given field.
- *
+ *
* @param field
* The name of the field
* @return The value of the field, or <code>null</code> if there is no such
/**
* Returns all fields of this message.
- *
+ *
* @return All fields of this message
*/
public Map<String, String> getFields() {
/**
* Sets the payload input stream of the message.
- *
+ *
* @param payloadInputStream
* The payload input stream
*/
* payload is written to the given output stream after the message as well.
* That means that this method can only be called once because on the second
* invocation the payload input stream could not be read (again).
- *
+ *
* @param outputStream
* The output stream to write the message to
* @throws IOException
/**
* Writes the given line (followed by {@link #LINEFEED} to the given output
* stream, using UTF-8 as encoding.
- *
+ *
* @param outputStream
* The output stream to write to
* @param line
/**
* Tests various commands and the FCP connection.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FcpTest extends TestCase {
/**
* Generates an SSK key pair.
- *
+ *
* @throws IOException
* if an I/O error occurs
* @throws InterruptedException
/**
* Helper class with utility methods for the FCP protocol.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FcpUtils {
/**
* Returns a unique identifier.
- *
+ *
* @return A unique identifier
*/
public static String getUniqueIdentifier() {
/**
* Parses an integer field, separated by ‘;’ and returns the parsed values.
- *
+ *
* @param field
* The field to parse
* @return An array with the parsed values
/**
* Encodes the given integer array into a string, separating the values by
* ‘;’.
- *
+ *
* @param values
* The values to encode
* @return The encoded values
/**
* Encodes the given string array into a string, separating the values by
* ‘;’.
- *
+ *
* @param values
* The values to encode
* @return The encoded values
/**
* Tries to parse the given string into an int, returning <code>-1</code> if
* the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @return The parsed int, or <code>-1</code>
/**
* Tries to parse the given string into an int, returning
* <code>defaultValue</code> if the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @param defaultValue
/**
* Tries to parse the given string into an long, returning <code>-1</code>
* if the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @return The parsed long, or <code>-1</code>
/**
* Tries to parse the given string into an long, returning
* <code>defaultValue</code> if the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @param defaultValue
/**
* Closes the given socket.
- *
+ *
* @param socket
* The socket to close
*/
/**
* Closes the given Closeable.
- *
+ *
* @param closeable
* The Closeable to close
*/
* Copies as many bytes as possible (i.e. until {@link InputStream#read()}
* returns <code>-1</code>) from the source input stream to the destination
* output stream.
- *
+ *
* @param source
* The input stream to read from
* @param destination
* much bytes as possible will be copied (i.e. until
* {@link InputStream#read()} returns <code>-1</code> to signal the end of
* the stream).
- *
+ *
* @param source
* The input stream to read from
* @param destination
* much bytes as possible will be copied (i.e. until
* {@link InputStream#read()} returns <code>-1</code> to signal the end of
* the stream).
- *
+ *
* @param source
* The input stream to read from
* @param destination
/**
* This input stream stores the content of another input stream either in a
* file or in memory, depending on the length of the input stream.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public static class TempInputStream extends InputStream {
/**
* Creates a new temporary input stream that stores the given input
* stream in a temporary file.
- *
+ *
* @param originalInputStream
* The original input stream
* @throws IOException
* Creates a new temporary input stream that stores the given input
* stream in memory if it is shorter than {@link #MAX_LENGTH_MEMORY},
* otherwise it is stored in a file.
- *
+ *
* @param originalInputStream
* The original input stream
* @param length
* Creates a new temporary input stream that stores the given input
* stream in memory if it is shorter than <code>maxMemoryLength</code>,
* otherwise it is stored in a file.
- *
+ *
* @param originalInputStream
* The original input stream
* @param length
/**
* Container class for file entry data.
- *
+ *
* @see ClientPutComplexDir#addFileEntry(FileEntry)
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
/**
* Creates a new file entry with the given name and upload source.
- *
+ *
* @param name
* The name of the file
* @param uploadFrom
/**
* Creates a new file entry for a file that should be transmitted to the
* node in the payload of the message.
- *
+ *
* @param name
* The name of the file
* @param contentType
/**
* Creates a new file entry for a file that should be uploaded from disk.
- *
+ *
* @param name
* The name of the file
* @param filename
/**
* Creates a new file entry for a file that redirects to another URI.
- *
+ *
* @param name
* The name of the file
* @param targetURI
/**
* Returns the fields for this file entry.
- *
+ *
* @return The fields for this file entry
*/
abstract Map<String, String> getFields();
/**
* A file entry for a file that should be transmitted in the payload of the
* {@link ClientPutComplexDir} message.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
static class DirectFileEntry extends FileEntry {
/**
* Creates a new direct file entry with content type auto-detection.
- *
+ *
* @param name
* The name of the file
* @param length
/**
* Creates a new direct file entry.
- *
+ *
* @param name
* The name of the file
* @param contentType
/**
* Returns the input stream of the file.
- *
+ *
* @return The input stream of the file
*/
InputStream getInputStream() {
/**
* A file entry for a file that should be uploaded from the disk.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
static class DiskFileEntry extends FileEntry {
/**
* Creates a new disk file entry.
- *
+ *
* @param name
* The name of the file
* @param filename
/**
* Creates a new disk file entry.
- *
+ *
* @param name
* The name of the file
* @param filename
/**
* A file entry for a file that redirects to another URI.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
static class RedirectFileEntry extends FileEntry {
/**
* Creates a new redirect file entry.
- *
+ *
* @param name
* The name of the file
* @param targetURI
/**
* A “FinishedCompression” message signals the client that the compression of
* the request data has been finished.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FinishedCompression extends BaseMessage {
/**
* Creates a new “FinishedCompression” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The message that was recevied
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the ID of the codec that was used for compression.
- *
+ *
* @return The ID of the codec that was used for compression
*/
public int getCodec() {
/**
* Returns the original size of the data (i.e. before compression).
- *
+ *
* @return The original size of the data
*/
public long getOriginalSize() {
/**
* Returns the compressed size of the data (i.e. after compression).
- *
+ *
* @return The compressed size of the data
*/
public long getCompressedSize() {
/**
* A “GenerateSSK” message. This message tells the node to generate a new SSK
* key pair.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class GenerateSSK extends FcpMessage {
/**
* Creates a new “GenerateSSK” message with the given client identifier.
- *
+ *
* @param clientIdentifier
* The client identifier
*/
/**
* The “GetConfig” command tells the node to send its configuration to the
* client.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class GetConfig extends FcpMessage {
/**
* Sets whether the {@link ConfigData} result message shall include the
* current values.
- *
+ *
* @param withCurrent
* <code>true</code> to include current values in the result,
* <code>false</code> otherwise
/**
* Sets whether the {@link ConfigData} result message shall include the
* short descriptions.
- *
+ *
* @param withShortDescription
* <code>true</code> to include the short descriptions in the
* result, <code>false</code> otherwise
/**
* Sets whether the {@link ConfigData} result message shall include the long
* descriptions.
- *
+ *
* @param withLongDescription
* <code>true</code> to include the long descriptions in the
* result, <code>false</code> otherwise
/**
* Sets whether the {@link ConfigData} result message shall include the data
* types.
- *
+ *
* @param withDataTypes
* <code>true</code> to include the data types in the result,
* <code>false</code> otherwise
/**
* Sets whether the {@link ConfigData} result message shall include the
* defaults.
- *
+ *
* @param setWithDefaults
* <code>true</code> to include the defaults in the result,
* <code>false</code> otherwise
/**
* Sets whether the {@link ConfigData} result message shall include the sort
* order.
- *
+ *
* @param withSortOrder
* <code>true</code> to include the sort order in the result,
* <code>false</code> otherwise
/**
* Sets whether the {@link ConfigData} result message shall include the
* expert flag.
- *
+ *
* @param withExpertFlag
* <code>true</code> to include the expert flag in the result,
* <code>false</code> otherwise
/**
* Sets whether the {@link ConfigData} result message shall include the
* force-write flag.
- *
+ *
* @param withForceWriteFlag
* <code>true</code> to include the force-write flag in the
* result, <code>false</code> otherwise
/**
* The “GetNode” command returns the darknet or opennet noderef of the node,
* optionally including private and volatile data.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class GetNode extends FcpMessage {
* including private and volatile data, if requested. If any of the Boolean
* parameters are <code>null</code> the parameter is ignored and the node’s
* default value is used.
- *
+ *
* @param giveOpennetRef
* <code>true</code> to request the opennet noderef,
* <code>false</code> for darknet
/**
* The “GetPluginInfo” message requests information about a plugin from the
* node, which will response with a {@link PluginInfo} message.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class GetPluginInfo extends FcpMessage {
/**
* Creates a new “GetPluginInfo” message.
- *
+ *
* @param pluginName
* The name of the plugin
* @param identifier
/**
* Sets whether detailed information about the plugin is wanted.
- *
+ *
* @param detailed
* <code>true</code> to request detailed information about the
* plugin, <code>false</code> otherwise
* The “GetRequestStatus” message is used request status information about a
* running request. It is also the only way to trigger a download of a persisted
* completed {@link ClientGet} with a return type of {@link ReturnType#direct}.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class GetRequestStatus extends FcpMessage {
/**
* Creates a new “GetRequestStatus” message.
- *
+ *
* @param identifier
* The identifier of the request
*/
/**
* Sets whether the request is on the global queue.
- *
+ *
* @param global
* <code>true</code> if the request is on the global queue,
* <code>false</code> if it is on the client-local queue
/**
* Sets whether the omit the transmission of the request data in a
* {@link AllData} message.
- *
+ *
* @param onlyData
* <code>true</code> to skip transmission of data,
* <code>false</code> to download data
/**
* The “IdentifierCollision” message signals the client that the identifier
* chosen for a request is already existing.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class IdentifierCollision extends BaseMessage {
/**
* Creates a new “IdentifierCollision” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> if it is on the client-local queue
*/
/**
* The “ListPeer” request asks the node about the details of a given peer.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ListPeer extends FcpMessage {
* specified by <code>nodeIdentifier</code>. <code>nodeIdentifier</code> can
* be of several formats: The node’s name, its identity, or its IP address
* and port (connection with a ‘:’).
- *
+ *
* @param nodeIdentifier
* The identifier of the node to get details about
*/
/**
* A “ListPeerNodes” request tells the node to list all notes that have been
* entered for a node. Note that notes are only supported for darknet nodes.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ListPeerNotes extends FcpMessage {
/**
* Creates a new “ListPeerNotes” request that lists all notes of the
* specified node.
- *
+ *
* @param nodeIdentifier
* The identifier of the node
*/
/**
* The “ListPeer” requests asks the node for a list of all peers it has.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ListPeers extends FcpMessage {
/**
* Creates a new “ListPeers” request that only includes basic data of the
* peers.
- *
+ *
* @param identifier
* The identifier of the request
*/
/**
* Creates a new “ListPeers” request that includes wanted data of the peers.
- *
+ *
* @param identifier
* The identifier of the request
* @param withMetadata
* Command to tell the node to list all persistent requests from the current
* queue, which is either the global queue or the client-local queue, depending
* on your {@link WatchGlobal} status.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ListPersistentRequests extends FcpMessage {
/**
* The “ModifyConfig” message is used to change the node’s configuration.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ModifyConfig extends FcpMessage {
/**
* Sets the option with the given name to the given value.
- *
+ *
* @param option
* The name of the option
* @param value
/**
* The “ModifyPeer” request lets you modify certain properties of a peer.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ModifyPeer extends FcpMessage {
/**
* Creates a new “ModifyPeer” request. All Boolean parameters may be null to
* not influence the current setting.
- *
+ *
* @param nodeIdentifier
* The identifier of the node, i.e. name, identity, or IP address
* and port
/**
* The “ModifyPeerNote” command modifies a peer note.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ModifyPeerNote extends FcpMessage {
/**
* Creates a new “ModifyPeerNote” request that changes peer note of the
* given type and node to the given text.
- *
+ *
* @see PeerNote
* @param nodeIdentifier
* The identifier of the node, i.e. name, identity, or IP address
/**
* A “ModifyPersistentRequest” is used to modify certain properties of a
* persistent request while it is running.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ModifyPersistentRequest extends FcpMessage {
/**
* Creates a new “ModifyPersistentRequest” that changes the specified
* request.
- *
+ *
* @param requestIdentifier
* The identifier of the request
* @param global
/**
* Sets the new client token of the request.
- *
+ *
* @param newClientToken
* The new client token of the request
*/
/**
* Sets the new priority of the request.
- *
+ *
* @param newPriority
* The new priority of the request
*/
/**
* The “NodeData” contains the noderef of the node, along with additional data.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class NodeData extends BaseMessage {
/**
* Creates a new “NodeData” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the noderef of the node.
- *
+ *
* @return The noderef of the node
*/
public NodeRef getNodeRef() {
/**
* Returns the last good version, i.e. the oldest version the node will
* connect to.
- *
+ *
* @return The last good version
*/
public Version getLastGoodVersion() {
/**
* Returns the signature of the noderef.
- *
+ *
* @return The signature of the noderef
*/
public String getSignature() {
/**
* Returns whether the noderef is the opennet noderef of the node
- *
+ *
* @return <code>true</code> if the noderef is the opennet noderef of the
* node, <code>false</code> otherwise
*/
/**
* Returns the identity of the node
- *
+ *
* @return The identity of the node
*/
public String getIdentity() {
/**
* Returns the name of the node.
- *
+ *
* @return The name of the node
*/
public String getMyName() {
/**
* Returns the version of the node.
- *
+ *
* @return The version of the node
*/
public Version getVersion() {
/**
* Returns IP addresses and port number of the node.
- *
+ *
* @return The IP addresses and port numbers of the node
*/
public String getPhysicalUDP() {
/**
* Returns the ARK of the node.
- *
+ *
* @return The ARK of the node
*/
public ARK getARK() {
/**
* Returns the public key of the node.
- *
+ *
* @return The public key of the node
*/
public String getDSAPublicKey() {
/**
* Returns the private key of the node.
- *
+ *
* @return The private key of the node
*/
public String getDSKPrivateKey() {
/**
* Returns the DSA group of the node.
- *
+ *
* @return The DSA group of the node
*/
public DSAGroup getDSAGroup() {
/**
* Returns the negotiation types supported by the node.
- *
+ *
* @return The node’s supported negotiation types
*/
public int[] getNegotiationTypes() {
* is prepended with “volatile.” so if you want to get the value of the
* field with the name “volatile.freeJavaMemory” you only need to specify
* “freeJavaMemory”.
- *
+ *
* @param field
* The name of the field
* @return The value of the field, or <code>null</code> if there is no such
/**
* Some convenience methods for parsing a “NodeHello” message from the node.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class NodeHello extends BaseMessage {
/**
* Createa a new “NodeHello” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received FCP message
*/
/**
* Returns the build of the node. This may not be a number but also a string
* like “@custom@” in case you built the node yourself.
- *
+ *
* @return The build of the node
*/
public String getBuild() {
/**
* Returns the build number of the node. This may not be a number but also a
* string like “@custom@” in case you built the node yourself.
- *
+ *
* @return The build number of the node, or <code>-1</code> if the build
* number could not be determined
*/
/**
* Returns the number of compression codecs.
- *
+ *
* @return The number of compression codecs
*/
public String getCompressionCodecs() {
/**
* Returns the number of compression codecs.
- *
+ *
* @return The number of compression codecs, or <code>-1</code> if the
* number of compression codecs could not be determined
*/
/**
* Returns the unique connection identifier.
- *
+ *
* @return The connection identifier
*/
public String getConnectionIdentifier() {
/**
* Returns the build of the external library file.
- *
+ *
* @return The build of the external library file
*/
public String getExtBuild() {
/**
* Returns the build number of the external library file.
- *
+ *
* @return The build number of the external library file, or <code>-1</code>
* if the build number could not be determined
*/
/**
* Returns the revision of the external library file.
- *
+ *
* @return The revision of the external library file
*/
public String getExtRevision() {
/**
* Returns the revision number of the external library file.
- *
+ *
* @return The revision number of the external library file, or
* <code>-1</code> if the revision number could not be determined
*/
/**
* Returns the FCP version the node speaks.
- *
+ *
* @return The FCP version the node speaks
*/
public String getFCPVersion() {
/**
* Returns the make of the node, e.g. “Fred” (freenet reference
* implementation).
- *
+ *
* @return The make of the node
*/
public String getNode() {
/**
* Returns the language of the node as 2-letter code, e.g. “en” or “de”.
- *
+ *
* @return The language of the node
*/
public String getNodeLanguage() {
/**
* Returns the revision of the node.
- *
+ *
* @return The revision of the node
*/
public String getRevision() {
/**
* Returns the revision number of the node.
- *
+ *
* @return The revision number of the node, or <code>-1</code> if the
* revision number coult not be determined
*/
/**
* Returns whether the node is currently is testnet mode.
- *
+ *
* @return <code>true</code> if the node is currently in testnet mode,
* <code>false</code> otherwise
*/
/**
* Returns the version of the node.
- *
+ *
* @return The version of the node
*/
public String getVersion() {
/**
* A reference for a node. The noderef contains all data that is necessary to
* establish a trusted and secure connection to the node.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class NodeRef {
/**
* Creates a new noderef that is initialized with fields from the given
* message.
- *
+ *
* @param fromMessage
* The message to get initial values for the noderef from
*/
/**
* Returns the identity of the node.
- *
+ *
* @return The identity of the node
*/
public String getIdentity() {
/**
* Sets the identity of the node.
- *
+ *
* @param identity
* The identity of the node
*/
/**
* Returns whether the node is an opennet peer.
- *
+ *
* @return <code>true</code> if the node is an opennet peer,
* <code>false</code> otherwise
*/
/**
* Sets whether the node is an opennet peer.
- *
+ *
* @param opennet
* <code>true</code> if the node is an opennet peer,
* <code>false</code> otherwise
/**
* Returns the name of the node. If the node is an opennet peer, it will not
* have a name!
- *
+ *
* @return The name of the node, or <code>null</code> if the node is an
* opennet peer
*/
/**
* Sets the name of the peer.
- *
+ *
* @param name
* The name of the peer
*/
/**
* Returns the location of the node.
- *
+ *
* @return The location of the node
*/
public double getLocation() {
/**
* Sets the location of the node
- *
+ *
* @param location
* The location of the node
*/
/**
* Returns the IP addresses and port numbers of the node.
- *
+ *
* @return The IP addresses and port numbers of the node
*/
public String getPhysicalUDP() {
/**
* Sets the IP addresses and port numbers of the node.
- *
+ *
* @param physicalUDP
* The IP addresses and port numbers of the node
*/
/**
* Returns the ARK of the node.
- *
+ *
* @return The ARK of the node
*/
public ARK getARK() {
/**
* Sets the ARK of the node.
- *
+ *
* @param ark
* The ARK of the node
*/
/**
* Returns the public DSA key of the node.
- *
+ *
* @return The public DSA key of the node
*/
public String getDSAPublicKey() {
/**
* Sets the public DSA key of the node.
- *
+ *
* @param dsaPublicKey
* The public DSA key of the node
*/
/**
* Returns the DSA group of the node.
- *
+ *
* @return The DSA group of the node
*/
public DSAGroup getDSAGroup() {
/**
* Sets the DSA group of the node.
- *
+ *
* @param dsaGroup
* The DSA group of the node
*/
/**
* Returns the negotiation types supported by the node.
- *
+ *
* @return The node’s supported negotiation types
*/
public int[] getNegotiationTypes() {
/**
* Sets the negotiation types supported by the node.
- *
+ *
* @param negotiationTypes
* The node’s supported negotiation types
*/
/**
* Returns the version of the node.
- *
+ *
* @return The version of the node
*/
public Version getVersion() {
/**
* Sets the version of the node.
- *
+ *
* @param version
* The version of the node
*/
/**
* Returns the last good version of the node.
- *
+ *
* @return The oldest version the node will connect to
*/
public Version getLastGoodVersion() {
/**
* Sets the last good version of the node.
- *
+ *
* @param lastGoodVersion
* The oldest version the node will connect to
*/
/**
* Returns whether the node is a testnet node.
- *
+ *
* @return <code>true</code> if the node is a testnet node,
* <code>false</code> otherwise
*/
/**
* Sets whether this node is a testnet node.
- *
+ *
* @param testnet
* <code>true</code> if the node is a testnet node,
* <code>false</code> otherwise
/**
* Returns the signature of the noderef.
- *
+ *
* @return The signature of the noderef
*/
public String getSignature() {
/**
* Sets the signature of the noderef.
- *
+ *
* @param signature
* The signature of the noderef
*/
/**
* A “PeerRemoved” message is sent by the node when a peer has been removed.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PeerRemoved extends BaseMessage {
/**
* Creates a new “PeerRemoved” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identity of the removed peer.
- *
+ *
* @return The identity of the removed peer
*/
public String getIdentity() {
/**
* Returns the node identifier of the removed peer.
- *
+ *
* @return The node identifier of the removed peer
*/
public String getNodeIdentifier() {
/**
* Convenience class for persistence values.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public enum Persistence {
/**
* The “PersistentGet” message is sent to the client to inform it about a
* persistent download, either in the client-local queue or in the global queue.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PersistentGet extends BaseMessage {
/**
* Creates a new “PersistentGet” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the URI of the request.
- *
+ *
* @return The URI of the request
*/
public String getURI() {
/**
* Returns the verbosity of the request.
- *
+ *
* @return The verbosity of the request
*/
public Verbosity getVerbosity() {
/**
* Returns the return type of the request.
- *
+ *
* @return The return type of the request
*/
public ReturnType getReturnType() {
/**
* Returns the name of the file the data is downloaded to. This field will
* only be set if {@link #getReturnType()} is {@link ReturnType#disk}.
- *
+ *
* @return The name of the file the data is downloaded to
*/
public String getFilename() {
/**
* Returns the name of the temporary file. This field will only be set if
* {@link #getReturnType()} is {@link ReturnType#disk}.
- *
+ *
* @return The name of the temporary file
*/
public String getTempFilename() {
/**
* Returns the client token of the request.
- *
+ *
* @return The client token of the request
*/
public String getClientToken() {
/**
* Returns the priority of the request.
- *
+ *
* @return The priority of the request
*/
public Priority getPriority() {
/**
* Returns the persistence of the request.
- *
+ *
* @return The persistence of the request, or {@link Persistence#unknown} if
* the persistence could not be parsed
*/
/**
* Returns whether this request is on the global queue or on the
* client-local queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> if the request is on the client-local queue
*/
/**
* Returns the maximum number of retries for a failed block.
- *
+ *
* @return The maximum number of retries for a failed block, <code>-1</code>
* for endless retries, <code>-2</code> if the number could not be
* parsed
/**
* A “PersistentPut” message notifies a client about a persistent
* {@link ClientPut} request.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PersistentPut extends BaseMessage {
/**
* Creates a new “PersistentPut” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the client token of the request.
- *
+ *
* @return The client token of the request
*/
public String getClientToken() {
/**
* Returns the data length of the request.
- *
+ *
* @return The data length of the request, or <code>-1</code> if the length
* could not be parsed
*/
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> otherwise
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the maximum number of retries for failed blocks. When
* <code>-1</code> is returned each block is tried forever.
- *
+ *
* @return The maximum number of retries for failed blocks, or
* <code>-1</code> for unlimited retries, or <code>-2</code> if the
* number of retries could not be parsed
/**
* Returns the content type of the data.
- *
+ *
* @return The content type
*/
public String getMetadataContentType() {
/**
* Returns the persistence of the request.
- *
+ *
* @return The persistence of the request
*/
public Persistence getPersistence() {
/**
* Returns the priority of the request.
- *
+ *
* @return The priority of the request, or {@link Priority#unknown} if the
* priority could not be parsed
*/
/**
* Returns whether this request has started.
- *
+ *
* @return <code>true</code> if the request has started, <code>false</code>
* otherwise
*/
/**
* Returns the target filename of the request.
- *
+ *
* @return The target filename of the request
*/
public String getTargetFilename() {
/**
* Returns the upload source of the request.
- *
+ *
* @return The upload source of the request
*/
public UploadFrom getUploadFrom() {
/**
* Returns the target URI of the request.
- *
+ *
* @return The target URI of the request
*/
public String getURI() {
/**
* Returns the verbosity of the request.
- *
+ *
* @return The verbosity of the request
*/
public Verbosity getVerbosity() {
/**
* The “PersistentRequestModified” message is a reply to
* {@link ModifyPersistentRequest}.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PersistentRequestModified extends BaseMessage {
/**
* Creates a new “PersistentRequestModified” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the changed request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> if it is on a client-local queue
*/
/**
* Returns the client token, if it was changed.
- *
+ *
* @return The new client token, or <code>null</code> if the client token
* was not changed
*/
/**
* Returns the priority of the request, if it was changed.
- *
+ *
* @return The new priority of the request, or {@link Priority#unknown} if
* the priority was not changed
*/
/**
* A “PersistentRequestRemoved” message signals that a persistent request was
* removed from either the global or the client-local queue.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PersistentRequestRemoved extends BaseMessage {
/**
* Creates a new “PersistentRequestRemoved” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns whether the request was removed from the global queue.
- *
+ *
* @return <code>true</code> if the request was removed from the global
* queue, <code>false</code> if it was removed from the client-local
* queue
/**
* The “PluginInfo” message is a reply to the {@link GetPluginInfo} request.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PluginInfo extends BaseMessage {
/**
* Creates a new “PluginInfo” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the name of the plugin.
- *
+ *
* @return The name of the plugin
*/
public String getPluginName() {
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the original URI of the plugin.
- *
+ *
* @return The original URI of the plugin
*/
public String getOriginalURI() {
/**
* Returns whether the plugin is started.
- *
+ *
* @return <code>true</code> if the plugin is started, <code>false</code>
* otherwise
*/
/**
* The priority classes used by the Freenet node.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public enum Priority {
/**
* The “ProtocolError” message signals that something has gone really wrong.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ProtocolError extends BaseMessage {
/**
* Creates a new “ProtocolError” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns whether the causing message had the “Global” flag set.
- *
+ *
* @return <code>true</code> if the causing message had the “Global” flag
* set
*/
/**
* Returns the error code.
- *
+ *
* @return The error code, or <code>-1</code> if the error code could not be
* parsed
*/
/**
* Returns the description of the error.
- *
+ *
* @return The description of the error
*/
public String getCodeDescription() {
/**
* Returns some extra description of the error.
- *
+ *
* @return Extra description of the error, or <code>null</code> if there is
* none
*/
/**
* Returns whether the connection to the node can stay open.
- *
+ *
* @return <code>true</code> when the connection has to be closed,
* <code>false</code> otherwise
*/
/**
* The identifier of the causing request, if any.
- *
+ *
* @return The identifier of the causing request
*/
public String getIdentifier() {
* The “PutFailed” message signals the client that a {@link ClientPut} request
* has failed. This also means that no further progress messages for that
* request will be sent.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PutFailed extends BaseMessage {
/**
* Creates a new “PutFailed” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the code of the error.
- *
+ *
* @return The code of the error, or <code>-1</code> if the error code could
* not be parsed
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> if it is on the client-local queue
*/
/**
* Returns the description of the error code.
- *
+ *
* @return The description of the error code
*/
public String getCodeDescription() {
/**
* Returns the extra description of the error.
- *
+ *
* @return The extra description of the error
*/
public String getExtraDescription() {
/**
* Returns the short description of the error.
- *
+ *
* @return The short description of the error
*/
public String getShortCodeDescription() {
/**
* Returns the expected URI of the request.
- *
+ *
* @return The expected URI
*/
public String getExpectedURI() {
/**
* Returns whether the request failed fatally. If a request fails fatally it
* can never complete, even with inifinite retries.
- *
+ *
* @return <code>true</code> if the request failed fatally,
* <code>false</code> otherwise
*/
* Returns a list of complex error codes with the message. Use
* {@link #getComplexErrorDescription(int)} and
* {@link #getComplexErrorCount(int)} to get details.
- *
+ *
* @return A list of complex error codes
*/
public int[] getComplexErrorCodes() {
/**
* Returns the description of the complex error. You should only hand it
* error codes you got from {@link #getComplexErrorCodes()}!
- *
+ *
* @param errorCode
* The error code
* @return The description of the complex error
/**
* Returns the count of the complex error. You should only hand it error
* codes you got from {@link #getComplexErrorCodes()}!
- *
+ *
* @param errorCode
* The error code
* @return The count of the complex error, or <code>-1</code> if the count
* The “PutFetchable” message informs a client that a {@link ClientPut} request
* has progressed far enough that the resulting final URI might already be
* fetchable.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PutFetchable extends BaseMessage {
/**
* Creates a new “PutFetchable” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> if it is on the client-local queue
*/
/**
* Returns the URI of the request.
- *
+ *
* @return The URI of the request
*/
public String getURI() {
/**
* The “PutSuccessful” message informs a client about a successfully finished
* {@link ClientPut} (or similar) request.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PutSuccessful extends BaseMessage {
/**
* Creates a new “PutSuccessful” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return <code>true</code> if the request is on the global queue,
* <code>false</code> if it is on the client-local queue
*/
/**
* Returns the final URI of the {@link ClientPut} request.
- *
+ *
* @return The final URI of the request
*/
public String getURI() {
/**
* Returns the time the insert started.
- *
+ *
* @return The time the insert started (in milliseconds since Jan 1, 1970
* UTC), or <code>-1</code> if the time could not be parsed
*/
/**
* Returns the time the insert completed.
- *
+ *
* @return The time the insert completed (in milliseconds since Jan 1, 1970
* UTC), or <code>-1</code> if the time could not be parsed
*/
/**
* The “RemovePeer” command removes a peer.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class RemovePeer extends FcpMessage {
/**
* Creates a new “RemovePeer” command that removes the given peer.
- *
+ *
* @param nodeIdentifier
* The identifier of the node, i.e. its name, identity, or IP
* address and port pair
* The “RemovePersistentRequest” message tells the node to remove a persistent
* request, cancelling it first (resulting in a {@link GetFailed} or
* {@link PutFailed} message), if necessary.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class RemovePersistentRequest extends FcpMessage {
/**
* Creates a new “RemovePersistentRequest” message.
- *
+ *
* @param identifier
* The identifier of the request
*/
/**
* Sets whether the request is on the global queue.
- *
+ *
* @param global
* <code>true</code> if the request is on the global queue,
* <code>false</code> if it is on the client-local queue
/**
* The different return types for {@link ClientGet} requests.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public enum ReturnType {
/**
* An “SSKKeypair” message that is sent as a response to a {@link GenerateSSK}
* message.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class SSKKeypair extends BaseMessage {
/**
* Creates a new “SSKKeypair” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the URI that must be used to insert data.
- *
+ *
* @return The insert URI
*/
public String getInsertURI() {
/**
* Returns the URI that must be used to request data.
- *
+ *
* @return The request URI
*/
public String getRequestURI() {
/**
* Command that shuts down the node.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class Shutdown extends FcpMessage {
/**
* A “SimpleProgress” message tells the client about the progress of a
* {@link ClientGet} or {@link ClientPut} operation.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class SimpleProgress extends BaseMessage {
/**
* Creates a new “SimpleProgress” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the total number of blocks. This number may increase as long as
* {@link #isFinalizedTotal()} returns <code>false</code>.
- *
+ *
* @return The total number of blocks
*/
public int getTotal() {
* This number might actually be lower than {@link #getTotal} because of
* redundancy information. This number may also increase as long as
* {@link #isFinalizedTotal()} returns <code>false</code>.
- *
+ *
* @return The number of required blocks
*/
public int getRequired() {
/**
* Returns the number of blocks that have failed and run out of retries.
- *
+ *
* @return The number of failed blocks
*/
public int getFailed() {
/**
* Returns the number of fatally failed blocks. A block that failed fatally
* can never be completed, even with infinite retries.
- *
+ *
* @return The number of fatally failed blocks
*/
public int getFatallyFailed() {
/**
* Returns the number of blocks that have been successfully processed.
- *
+ *
* @return The number of succeeded blocks
*/
public int getSucceeded() {
* been finalized. Once the total number of blocks has been finalized for a
* request it will not change any more, and this method of every further
* SimpleProgress message will always return <code>true</code>.
- *
+ *
* @return <code>true</code> if the number of total blocks has been
* finalized, <code>false</code> otherwise
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* The “StartedCompression” message signals the client the compressing for a
* request has started.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class StartedCompression extends BaseMessage {
/**
* Creates a new “StartedCompression” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
/**
* Returns the number of the codec that is used for compression.
- *
+ *
* @return The codec used for the compression, or <code>-1</code> if the
* codec could not be parsed
*/
/**
* With a “SubscribeUSK” a client requests to be notified if the edition number
* of a USK changes.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class SubscribeUSK extends FcpMessage {
/**
* Creates a new “SubscribeUSK” message.
- *
+ *
* @param uri
* The URI to watch for changes
* @param identifier
/**
* Sets whether updates for the USK are actively searched.
- *
+ *
* @param active
* <code>true</code> to actively search for newer editions,
* <code>false</code> to only watch for newer editions that are
* if the new edition that was found is several editions ahead of the currently
* last known edition, you will received a SubscribedUSKUpdate for each edition
* inbetween as welL!
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class SubscribedUSKUpdate extends BaseMessage {
/**
* Creates a new “SubscribedUSKUpdate” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the identifier of the subscription.
- *
+ *
* @return The identifier of the subscription
*/
public String getIdentifier() {
/**
* Returns the new edition that was found.
- *
+ *
* @return The new edition
*/
public int getEdition() {
/**
* Returns the complete URI, including the new edition.
- *
+ *
* @return The complete URI
*/
public String getURI() {
/**
* The “TestDDAComplete” message signals that the node has finished checking
* your read and write access to a certain directory.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class TestDDAComplete extends BaseMessage {
/**
* Creates a new “TestDDAComplete” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the directory the authorization is given for.
- *
+ *
* @return The directory that was tested for read and/or write access
*/
public String getDirectory() {
/**
* Returns whether read access to the directory is allowed.
- *
+ *
* @return <code>true</code> if the client is allowed to read from that
* directory, <code>false</code> otherwise
*/
/**
* Returns whether write access to the directory is allowed.
- *
+ *
* @return <code>true</code> if the client is allowed to write into that
* directory, <code>false</code> otherwise
*/
* {@link #getReadFilename()} will give you a filename. Similarly, if you
* specified that you want to write in the directory {@link #getWriteFilename()}
* will give you a filename to write {@link #getContentToWrite()} to.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class TestDDAReply extends BaseMessage {
/**
* Creates a “TestDDAReply” message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the directory the TestDDRequest was made for.
- *
+ *
* @return The directory to test
*/
public String getDirectory() {
/**
* Returns the filename you have to read to proof your ability to read that
* specific directory.
- *
+ *
* @return The name of the file to read
*/
public String getReadFilename() {
/**
* Returns the filename you have to write to to proof your ability to write
* to that specific directory.
- *
+ *
* @return The name of the file write to
*/
public String getWriteFilename() {
* If you requested a test for writing permissions you have to write the
* return value of this method to the file given by
* {@link #getWriteFilename()}.
- *
+ *
* @return The content to write to the file
*/
public String getContentToWrite() {
/**
* The “TestDDARequest” initiates a DDA test sequence.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class TestDDARequest extends FcpMessage {
/**
* Creates a new “TestDDARequest” command that initiates a DDA test.
- *
+ *
* @param directory
* The directory you want to access files in
* @param wantReadDirectory
* A “TestDDAResponse” is sent to let the node know that either created a file
* with the content from {@link TestDDAReply#getContentToWrite()} or that you
* read the content of the file given by {@link TestDDAReply#getReadFilename()}.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class TestDDAResponse extends FcpMessage {
* Creates a new “TestDDAResponse” message that signals that you created the
* file given by {@link TestDDAReply#getWriteFilename()} and wrote the
* contents given by {@link TestDDAReply#getContentToWrite()} to it.
- *
+ *
* @param directory
* The directory from the {@link TestDDARequest} command
*/
* specified that you want to write to the directory) and/or that you read
* the file given by {@link TestDDAReply#getReadFilename()} (when you
* specified you wanted to read the directory).
- *
+ *
* @param directory
* The directory from the {@link TestDDARequest} command
* @param readContent
/**
* The “UnknownNodeIdentifier” message signals the client that the node
* identifier given in a command like {@link ListPeer} is unknown.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class UnknownNodeIdentifier extends BaseMessage {
/**
* Creates a new “UnknownNodeIdentifier” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the unknown node identifier.
- *
+ *
* @return The unknown node identifier
*/
public String getNodeIdentifier() {
/**
* The ”UnknownPeerNoteType” message signals the client that the type of peer
* note used in a previous {@link ModifyPeerNote} is unknown.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class UnknownPeerNoteType extends BaseMessage {
/**
* Creates a new ”UnknownPeerNoteType” message that wraps the received
* message.
- *
+ *
* @param receivedMessage
* The received message
*/
/**
* Returns the type of peer note that is unkown.
- *
+ *
* @return The unknown peer note type
*/
public int getPeerNoteType() {
/**
* Enumeration for the different values for the “UploadFrom” field in
* {@link ClientPut} and {@link ClientGet} requests.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public enum UploadFrom {
* that can be composed of several bits. {@link #PROGRESS} and
* {@link #COMPRESSION} are single bits in that mask and can be combined into a
* new verbosity using {@link #add(Verbosity)}.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class Verbosity {
/**
* Creates a new verbosity with the given level.
- *
+ *
* @param level
* The verbosity level
*/
/**
* Adds the given verbosity to this verbosity and returns a verbosity with
* the new value. The value of this verbosity is not changed.
- *
+ *
* @param verbosity
* The verbosity to add to this verbosity
* @return The verbosity with the new level.
/**
* Checks whether this Verbosity contains all bits of the given Verbosity.
- *
+ *
* @param verbosity
* The verbosity to check for in this Verbosity
* @return <code>true</code> if and only if all set bits in the given
/**
* Parses the given string and creates a Verbosity with the given level.
- *
+ *
* @param s
* The string to parse
* @return The parsed verbosity, or {@link #NONE} if the string could not be
/**
* Container for the “lastGoodVersion” field.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class Version {
* Creates a new Version from the given string. The string consists of the
* four required fields node name, tree version, protocol version, and build
* number, separated by a comma.
- *
+ *
* @param version
* The version string
* @throws NullPointerException
/**
* Creates a new Version from the given parts.
- *
+ *
* @param nodeName
* The name of the node implementation
* @param treeVersion
/**
* Returns the name of the node implementation.
- *
+ *
* @return The node name
*/
public String getNodeName() {
/**
* The tree version of the node.
- *
+ *
* @return The tree version of the node
*/
public String getTreeVersion() {
/**
* The protocol version of the node
- *
+ *
* @return The protocol version of the node
*/
public String getProtocolVersion() {
/**
* The build number of the node.
- *
+ *
* @return The build number of the node
*/
public int getBuildNumber() {
/**
* The “WatchGlobal” messages enables clients to watch the global queue in
* addition to the client-local queue.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class WatchGlobal extends FcpMessage {
/**
* Enables or disables watching the global queue.
- *
+ *
* @param enabled
* <code>true</code> to watch the global queue and the
* client-local queue, <code>false</code> to watch only the
/**
* Enables or disables watching the global queue, optionally masking out
* certain events.
- *
+ *
* @param enabled
* <code>true</code> to watch the global queue and the
* client-local queue, <code>false</code> to watch only the