mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Changed the root package from net.sf.briar to org.briarproject.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package org.briarproject.api.reliability;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface ReadHandler {
|
||||
|
||||
void handleRead(byte[] b) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.reliability;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.PARAMETER;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
/** Annotation for injecting the executor used by reliability layers. */
|
||||
@BindingAnnotation
|
||||
@Target({ FIELD, METHOD, PARAMETER })
|
||||
@Retention(RUNTIME)
|
||||
public @interface ReliabilityExecutor {}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.briarproject.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 InputStream} and
|
||||
* {@link java.io.OutputStream 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();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.briarproject.api.reliability;
|
||||
|
||||
public interface ReliabilityLayerFactory {
|
||||
|
||||
/** Returns a reliability layer that writes to the given lower layer. */
|
||||
ReliabilityLayer createReliabilityLayer(WriteHandler writeHandler);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.briarproject.api.reliability;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface WriteHandler {
|
||||
|
||||
void handleWrite(byte[] b) throws IOException;
|
||||
}
|
||||
Reference in New Issue
Block a user