diff --git a/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayer.java b/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayer.java index ae1938039f7f7aed7bd4265b0f65a1b6108ad2ed..b997084aece1a47aee247e04edac8b5bd33c9bff 100644 --- a/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayer.java +++ b/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayer.java @@ -3,13 +3,34 @@ package net.sf.briar.api.reliability; import java.io.InputStream; import java.io.OutputStream; +/** + * A protocol layer that attempts to ensure reliable, ordered delivery of data + * across an unreliable lower layer. Interactions with the lower layer use the + * buffer-oriented {@link ReadHandler} and {@link WriteHandler} interfaces; the + * reliability layer presents stream-oriented {@link java.io.InputStream} and + * {@link java.io.OutputStream} interfaces to higher layers. + */ public interface ReliabilityLayer extends ReadHandler { + /** Starts the reliability layer. */ void start(); + /** + * Stops the reliability layer. After this method returns, no more data + * will be sent to lower layers, and any data received from lower layers + * will be ignored. + */ void stop(); + /** + * Returns an input stream for higher layers to read from the reliability + * layer. + */ InputStream getInputStream(); + /** + * Returns an output stream for higher layers to write to the reliability + * layer. + */ OutputStream getOutputStream(); } diff --git a/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayerFactory.java b/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayerFactory.java index 96b4a51b406e8d3313106572e0dbf997059cdcbb..848e3e6b080a38e0fb914e7b1419e90bdd6cab27 100644 --- a/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayerFactory.java +++ b/briar-api/src/net/sf/briar/api/reliability/ReliabilityLayerFactory.java @@ -2,5 +2,6 @@ package net.sf.briar.api.reliability; public interface ReliabilityLayerFactory { + /** Returns a reliability layer that writes to the given lower layer. */ ReliabilityLayer createReliabilityLayer(WriteHandler writeHandler); }