mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
Massive refactoring to merge handling of simplex and duplex connections.
This commit is contained in:
@@ -2,18 +2,18 @@ package org.briarproject.api.transport;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.plugins.TransportConnectionReader;
|
||||
import org.briarproject.api.plugins.TransportConnectionWriter;
|
||||
import org.briarproject.api.plugins.duplex.DuplexTransportConnection;
|
||||
import org.briarproject.api.plugins.simplex.SimplexTransportReader;
|
||||
import org.briarproject.api.plugins.simplex.SimplexTransportWriter;
|
||||
|
||||
public interface ConnectionDispatcher {
|
||||
|
||||
void dispatchIncomingConnection(TransportId t, SimplexTransportReader r);
|
||||
void dispatchIncomingConnection(TransportId t, TransportConnectionReader r);
|
||||
|
||||
void dispatchIncomingConnection(TransportId t, DuplexTransportConnection d);
|
||||
|
||||
void dispatchOutgoingConnection(ContactId c, TransportId t,
|
||||
SimplexTransportWriter w);
|
||||
TransportConnectionWriter w);
|
||||
|
||||
void dispatchOutgoingConnection(ContactId c, TransportId t,
|
||||
DuplexTransportConnection d);
|
||||
|
||||
@@ -6,7 +6,7 @@ public interface StreamReaderFactory {
|
||||
|
||||
/** Creates a {@link StreamReader} for a transport connection. */
|
||||
StreamReader createStreamReader(InputStream in, int maxFrameLength,
|
||||
StreamContext ctx, boolean incoming, boolean initiator);
|
||||
StreamContext ctx);
|
||||
|
||||
/** Creates a {@link StreamReader} for an invitation connection. */
|
||||
StreamReader createInvitationStreamReader(InputStream in,
|
||||
|
||||
@@ -10,10 +10,4 @@ public interface StreamWriter {
|
||||
* be written.
|
||||
*/
|
||||
OutputStream getOutputStream();
|
||||
|
||||
/**
|
||||
* Returns the maximum number of bytes that can be written to the output
|
||||
* stream.
|
||||
*/
|
||||
long getRemainingCapacity();
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ public interface StreamWriterFactory {
|
||||
|
||||
/** Creates a {@link StreamWriter} for a transport connection. */
|
||||
StreamWriter createStreamWriter(OutputStream out, int maxFrameLength,
|
||||
long capacity, StreamContext ctx, boolean incoming,
|
||||
boolean initiator);
|
||||
StreamContext ctx);
|
||||
|
||||
/** Creates a {@link StreamWriter} for an invitation connection. */
|
||||
StreamWriter createInvitationStreamWriter(OutputStream out,
|
||||
|
||||
@@ -4,12 +4,13 @@ import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.db.DbException;
|
||||
|
||||
/** Maintains the table of expected tags for recognising incoming streams. */
|
||||
/** Keeps track of expected tags and uses them to recognise incoming streams. */
|
||||
public interface TagRecogniser {
|
||||
|
||||
/**
|
||||
* Returns a {@link StreamContext} for reading from the stream with the
|
||||
* given tag if the tag was expected, or null if the tag was unexpected.
|
||||
* Looks up the given tag and returns a {@link StreamContext} for reading
|
||||
* from the stream if the tag was expected, or null if the tag was
|
||||
* unexpected.
|
||||
*/
|
||||
StreamContext recogniseTag(TransportId t, byte[] tag) throws DbException;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user