mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Encrypter and decrypter for segmented transports (untested).
This commit is contained in:
9
api/net/sf/briar/api/plugins/FrameSink.java
Normal file
9
api/net/sf/briar/api/plugins/FrameSink.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package net.sf.briar.api.plugins;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface FrameSink {
|
||||
|
||||
/** Writes the given frame. */
|
||||
void writeFrame(byte[] b, int len) throws IOException;
|
||||
}
|
||||
12
api/net/sf/briar/api/plugins/FrameSource.java
Normal file
12
api/net/sf/briar/api/plugins/FrameSource.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package net.sf.briar.api.plugins;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface FrameSource {
|
||||
|
||||
/**
|
||||
* Reads a frame into the given buffer and returns its length, or -1 if no
|
||||
* more frames can be read.
|
||||
*/
|
||||
int readFrame(byte[] b) throws IOException;
|
||||
}
|
||||
@@ -1,22 +1,15 @@
|
||||
package net.sf.briar.api.plugins.duplex;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.sf.briar.api.plugins.FrameSink;
|
||||
import net.sf.briar.api.plugins.FrameSource;
|
||||
|
||||
/**
|
||||
* An interface for reading and writing data over a duplex segmented transport.
|
||||
* The connection is not responsible for encrypting/decrypting or authenticating
|
||||
* the data.
|
||||
*/
|
||||
public interface DuplexSegmentedTransportConnection {
|
||||
|
||||
/**
|
||||
* Reads a frame into the given buffer and returns its length, or -1 if no
|
||||
* more frames can be read.
|
||||
*/
|
||||
int readFrame(byte[] b) throws IOException;
|
||||
|
||||
/** Writes the given frame to the transport. */
|
||||
void writeFrame(byte[] b, int len) throws IOException;
|
||||
public interface DuplexSegmentedTransportConnection extends FrameSource,
|
||||
FrameSink {
|
||||
|
||||
/**
|
||||
* Returns true if the output stream should be flushed after each packet.
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
package net.sf.briar.api.plugins.simplex;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.sf.briar.api.plugins.FrameSource;
|
||||
|
||||
/**
|
||||
* An interface for reading data from a simplex segmented transport. The reader
|
||||
* is not responsible for decrypting or authenticating the data before
|
||||
* returning it.
|
||||
*/
|
||||
public interface SimplexSegmentedTransportReader {
|
||||
|
||||
/**
|
||||
* Reads a frame into the given buffer and returns its length, or -1 if no
|
||||
* more frames can be read.
|
||||
*/
|
||||
int readFrame(byte[] b) throws IOException;
|
||||
public interface SimplexSegmentedTransportReader extends FrameSource {
|
||||
|
||||
/**
|
||||
* Closes the reader and disposes of any associated resources. The first
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package net.sf.briar.api.plugins.simplex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An interface for writing data to a simplex segmented transport. The writer is
|
||||
* not responsible for authenticating or encrypting the data before writing it.
|
||||
@@ -11,9 +9,6 @@ public interface SimplexSegmentedTransportWriter {
|
||||
/** Returns the capacity of the transport in bytes. */
|
||||
long getCapacity();
|
||||
|
||||
/** Writes the given frame to the transport. */
|
||||
void writeFrame(byte[] b, int len) throws IOException;
|
||||
|
||||
/**
|
||||
* Returns true if the output stream should be flushed after each packet.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user