mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Implement BQP transport descriptors
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package org.briarproject.api.keyagreement;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.plugins.duplex.DuplexTransportConnection;
|
||||
|
||||
public class KeyAgreementConnection {
|
||||
private final DuplexTransportConnection conn;
|
||||
private final TransportId id;
|
||||
|
||||
public KeyAgreementConnection(DuplexTransportConnection conn,
|
||||
TransportId id) {
|
||||
this.conn = conn;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public DuplexTransportConnection getConnection() {
|
||||
return conn;
|
||||
}
|
||||
|
||||
public TransportId getTransportId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.briarproject.api.keyagreement;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/**
|
||||
* An class for managing a particular key agreement listener.
|
||||
*/
|
||||
public abstract class KeyAgreementListener {
|
||||
|
||||
private final TransportDescriptor descriptor;
|
||||
|
||||
public KeyAgreementListener(TransportDescriptor descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the descriptor that a remote peer can use to connect to this
|
||||
* listener.
|
||||
*/
|
||||
public TransportDescriptor getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts listening for incoming connections, and returns a Callable that
|
||||
* will return a KeyAgreementConnection when an incoming connection is
|
||||
* received.
|
||||
*/
|
||||
public abstract Callable<KeyAgreementConnection> listen();
|
||||
|
||||
/**
|
||||
* Closes the underlying server socket.
|
||||
*/
|
||||
public abstract void close();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.briarproject.api.keyagreement;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.properties.TransportProperties;
|
||||
|
||||
/**
|
||||
* Describes how to connect to a device over a short-range transport.
|
||||
*/
|
||||
public class TransportDescriptor {
|
||||
|
||||
private final TransportId id;
|
||||
private final TransportProperties properties;
|
||||
|
||||
public TransportDescriptor(TransportId id, TransportProperties properties) {
|
||||
this.id = id;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/** Returns the transport identifier. */
|
||||
public TransportId getIdentifier() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/** Returns the transport properties. */
|
||||
public TransportProperties getProperties() {
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user