mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Added the ability to store transport configuration details in the
database - unlike transport properties, these are not shared with contacts. For example, when using email as a transport, the address for sending and receiving emails would be a transport property, while the username and password for the email server would be transport configuration details. Transport plugins can update their configuration details atomically. Also clarified the terminology for transport and subscription updates.
This commit is contained in:
@@ -14,8 +14,8 @@ import net.sf.briar.api.protocol.GroupId;
|
||||
import net.sf.briar.api.protocol.Message;
|
||||
import net.sf.briar.api.protocol.MessageId;
|
||||
import net.sf.briar.api.protocol.Offer;
|
||||
import net.sf.briar.api.protocol.Subscriptions;
|
||||
import net.sf.briar.api.protocol.Transports;
|
||||
import net.sf.briar.api.protocol.SubscriptionUpdate;
|
||||
import net.sf.briar.api.protocol.TransportUpdate;
|
||||
import net.sf.briar.api.protocol.writers.AckWriter;
|
||||
import net.sf.briar.api.protocol.writers.BatchWriter;
|
||||
import net.sf.briar.api.protocol.writers.OfferWriter;
|
||||
@@ -95,11 +95,11 @@ public interface DatabaseComponent {
|
||||
throws DbException, IOException;
|
||||
|
||||
/** Generates a subscription update for the given contact. */
|
||||
void generateSubscriptions(ContactId c, SubscriptionWriter s) throws
|
||||
void generateSubscriptionUpdate(ContactId c, SubscriptionWriter s) throws
|
||||
DbException, IOException;
|
||||
|
||||
/** Generates a transport update for the given contact. */
|
||||
void generateTransports(ContactId c, TransportWriter t) throws
|
||||
void generateTransportUpdate(ContactId c, TransportWriter t) throws
|
||||
DbException, IOException;
|
||||
|
||||
/** Returns the IDs of all contacts. */
|
||||
@@ -111,10 +111,13 @@ public interface DatabaseComponent {
|
||||
/** Returns the set of groups to which the user subscribes. */
|
||||
Collection<Group> getSubscriptions() throws DbException;
|
||||
|
||||
/** Returns the local transport properties. */
|
||||
/** Returns the configuration for the transport with the given name. */
|
||||
Map<String, String> getTransportConfig(String name) throws DbException;
|
||||
|
||||
/** Returns all local transport properties. */
|
||||
Map<String, Map<String, String>> getTransports() throws DbException;
|
||||
|
||||
/** Returns the transport properties for the given contact. */
|
||||
/** Returns all transport properties for the given contact. */
|
||||
Map<String, Map<String, String>> getTransports(ContactId c)
|
||||
throws DbException;
|
||||
|
||||
@@ -142,10 +145,12 @@ public interface DatabaseComponent {
|
||||
IOException;
|
||||
|
||||
/** Processes a subscription update from the given contact. */
|
||||
void receiveSubscriptions(ContactId c, Subscriptions s) throws DbException;
|
||||
void receiveSubscriptionUpdate(ContactId c, SubscriptionUpdate s)
|
||||
throws DbException;
|
||||
|
||||
/** Processes a transport update from the given contact. */
|
||||
void receiveTransports(ContactId c, Transports t) throws DbException;
|
||||
void receiveTransportUpdate(ContactId c, TransportUpdate t)
|
||||
throws DbException;
|
||||
|
||||
/** Removes a contact (and all associated state) from the database. */
|
||||
void removeContact(ContactId c) throws DbException;
|
||||
@@ -154,10 +159,17 @@ public interface DatabaseComponent {
|
||||
void setRating(AuthorId a, Rating r) throws DbException;
|
||||
|
||||
/**
|
||||
* Sets the local transport properties for the transport with the given
|
||||
* name, replacing any existing properties for that transport.
|
||||
* Sets the configuration for the transport with the given name, replacing
|
||||
* any existing configuration for that transport.
|
||||
*/
|
||||
void setTransports(String name, Map<String, String> transports)
|
||||
void setTransportConfig(String name, Map<String, String> config)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Sets the transport properties for the transport with the given name,
|
||||
* replacing any existing properties for that transport.
|
||||
*/
|
||||
void setTransportProperties(String name, Map<String, String> properties)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,10 @@ package net.sf.briar.api.protocol;
|
||||
import java.util.Collection;
|
||||
|
||||
/** A packet updating the sender's subscriptions. */
|
||||
public interface Subscriptions {
|
||||
public interface SubscriptionUpdate {
|
||||
|
||||
/**
|
||||
* The maximum size of a serialized subscriptions update, excluding
|
||||
* The maximum size of a serialized subscription update, excluding
|
||||
* encryption and authentication.
|
||||
*/
|
||||
static final int MAX_SIZE = (1024 * 1024) - 100;
|
||||
@@ -2,16 +2,16 @@ package net.sf.briar.api.protocol;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/** A packet updating the sender's transports. */
|
||||
public interface Transports {
|
||||
/** A packet updating the sender's transport properties. */
|
||||
public interface TransportUpdate {
|
||||
|
||||
/**
|
||||
* The maximum size of a serialised transports update, excluding
|
||||
* The maximum size of a serialised transport update, excluding
|
||||
* encryption and authentication.
|
||||
*/
|
||||
static final int MAX_SIZE = (1024 * 1024) - 100;
|
||||
|
||||
/** Returns the transports contained in the update. */
|
||||
/** Returns the transport properties contained in the update. */
|
||||
Map<String, Map<String, String>> getTransports();
|
||||
|
||||
/**
|
||||
@@ -3,7 +3,7 @@ package net.sf.briar.api.protocol.writers;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/** An interface for creating a transports update. */
|
||||
/** An interface for creating a transport update. */
|
||||
public interface TransportWriter {
|
||||
|
||||
/** Writes the contents of the update. */
|
||||
|
||||
Reference in New Issue
Block a user