mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Changed the root package from net.sf.briar to org.briarproject.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package org.briarproject.api.plugins.simplex;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.plugins.Plugin;
|
||||
|
||||
/** An interface for transport plugins that support simplex communication. */
|
||||
public interface SimplexPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Attempts to create and return a reader for the given contact using the
|
||||
* current transport and configuration properties. Returns null if a reader
|
||||
* could not be created.
|
||||
*/
|
||||
SimplexTransportReader createReader(ContactId c);
|
||||
|
||||
/**
|
||||
* Attempts to create and return a writer for the given contact using the
|
||||
* current transport and configuration properties. Returns null if a writer
|
||||
* could not be created.
|
||||
*/
|
||||
SimplexTransportWriter createWriter(ContactId c);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.briarproject.api.plugins.simplex;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.plugins.PluginCallback;
|
||||
|
||||
/**
|
||||
* An interface for handling readers and writers created by a simplex transport
|
||||
* plugin.
|
||||
*/
|
||||
public interface SimplexPluginCallback extends PluginCallback {
|
||||
|
||||
void readerCreated(SimplexTransportReader r);
|
||||
|
||||
void writerCreated(ContactId c, SimplexTransportWriter w);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.briarproject.api.plugins.simplex;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface SimplexPluginConfig {
|
||||
|
||||
Collection<SimplexPluginFactory> getFactories();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.briarproject.api.plugins.simplex;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
|
||||
public interface SimplexPluginFactory {
|
||||
|
||||
TransportId getId();
|
||||
|
||||
SimplexPlugin createPlugin(SimplexPluginCallback callback);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.briarproject.api.plugins.simplex;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* An interface for reading data from a simplex transport. The reader is not
|
||||
* responsible for decrypting or authenticating the data before returning it.
|
||||
*/
|
||||
public interface SimplexTransportReader {
|
||||
|
||||
/** Returns the maximum frame length of the transport in bytes. */
|
||||
int getMaxFrameLength();
|
||||
|
||||
/** Returns an input stream for reading from the transport. */
|
||||
InputStream getInputStream() throws IOException;
|
||||
|
||||
/**
|
||||
* Closes the reader and disposes of any associated resources. The first
|
||||
* argument indicates whether the reader is being closed because of an
|
||||
* exception and the second argument indicates whether the connection was
|
||||
* recognised, which may affect how resources are disposed of.
|
||||
*/
|
||||
void dispose(boolean exception, boolean recognised) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.briarproject.api.plugins.simplex;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* An interface for writing data to a simplex transport. The writer is not
|
||||
* responsible for authenticating or encrypting the data before writing it.
|
||||
*/
|
||||
public interface SimplexTransportWriter {
|
||||
|
||||
/** Returns the capacity of the transport in bytes. */
|
||||
long getCapacity();
|
||||
|
||||
/** Returns the maximum frame length of the transport in bytes. */
|
||||
int getMaxFrameLength();
|
||||
|
||||
/** Returns the maximum latency of the transport in milliseconds. */
|
||||
long getMaxLatency();
|
||||
|
||||
/** Returns an output stream for writing to the transport. */
|
||||
OutputStream getOutputStream() throws IOException;
|
||||
|
||||
/**
|
||||
* Returns true if the output stream should be flushed after each packet.
|
||||
*/
|
||||
boolean shouldFlush();
|
||||
|
||||
/**
|
||||
* Closes the writer and disposes of any associated resources. The
|
||||
* argument indicates whether the writer is being closed because of an
|
||||
* exception, which may affect how resources are disposed of.
|
||||
*/
|
||||
void dispose(boolean exception) throws IOException;
|
||||
}
|
||||
Reference in New Issue
Block a user