mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Add discovery methods to plugin API.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package org.briarproject.bramble.api.plugin;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.properties.TransportProperties;
|
||||
|
||||
/**
|
||||
* An interface for handling peers discovered by transport plugins.
|
||||
*/
|
||||
@NotNullByDefault
|
||||
public interface DiscoveryHandler {
|
||||
|
||||
/**
|
||||
* Handles a peer discovered by a transport plugin.
|
||||
*
|
||||
* @param p A set of properties describing the discovered peer.
|
||||
*/
|
||||
void handleDevice(TransportProperties p);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.properties.TransportProperties;
|
||||
import org.briarproject.bramble.api.settings.SettingsManager;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface Plugin {
|
||||
@@ -106,6 +106,5 @@ public interface Plugin {
|
||||
* Attempts to create connections using the given transport properties,
|
||||
* passing any created connections to the corresponding handlers.
|
||||
*/
|
||||
void poll(Collection<Pair<TransportProperties, ConnectionHandler>>
|
||||
properties);
|
||||
void poll(List<Pair<TransportProperties, ConnectionHandler>> properties);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package org.briarproject.bramble.api.plugin.duplex;
|
||||
|
||||
import org.briarproject.bramble.api.Pair;
|
||||
import org.briarproject.bramble.api.data.BdfList;
|
||||
import org.briarproject.bramble.api.keyagreement.KeyAgreementListener;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.ConnectionHandler;
|
||||
import org.briarproject.bramble.api.plugin.DiscoveryHandler;
|
||||
import org.briarproject.bramble.api.plugin.Plugin;
|
||||
import org.briarproject.bramble.api.properties.TransportProperties;
|
||||
import org.briarproject.bramble.api.rendezvous.KeyMaterialSource;
|
||||
import org.briarproject.bramble.api.rendezvous.RendezvousEndpoint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@@ -58,4 +62,16 @@ public interface DuplexPlugin extends Plugin {
|
||||
@Nullable
|
||||
RendezvousEndpoint createRendezvousEndpoint(KeyMaterialSource k,
|
||||
boolean alice, ConnectionHandler incoming);
|
||||
|
||||
/**
|
||||
* Returns true if the plugin supports peer discovery.
|
||||
*/
|
||||
boolean supportsDiscovery();
|
||||
|
||||
/**
|
||||
* Attempts to discover peers using the given transport properties, passing
|
||||
* any discovered peers to the corresponding handlers.
|
||||
*/
|
||||
void discoverPeers(List<Pair<TransportProperties, DiscoveryHandler>>
|
||||
properties);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user