mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Created TransportPropertyManager facade.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.api.messaging;
|
||||
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.crypto.SecretKey;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.Message;
|
||||
@@ -10,6 +11,12 @@ import java.util.Collection;
|
||||
|
||||
public interface MessagingManager {
|
||||
|
||||
/**
|
||||
* Informs the messaging manager that a new contact has been added.
|
||||
* Creates a private conversation with the contact.
|
||||
*/
|
||||
void addContact(ContactId c, SecretKey master) throws DbException;
|
||||
|
||||
/** Stores a local private message. */
|
||||
void addLocalMessage(Message m) throws DbException;
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.briarproject.api.property;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.TransportProperties;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.db.DbException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface TransportPropertyManager {
|
||||
|
||||
/** Returns the local transport properties for all transports. */
|
||||
Map<TransportId, TransportProperties> getLocalProperties()
|
||||
throws DbException;
|
||||
|
||||
/** Returns the local transport properties for the given transport. */
|
||||
TransportProperties getLocalProperties(TransportId t) throws DbException;
|
||||
|
||||
/** Returns all remote transport properties for the given transport. */
|
||||
Map<ContactId, TransportProperties> getRemoteProperties(TransportId t)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Merges the given properties with the existing local properties for the
|
||||
* given transport.
|
||||
*/
|
||||
void mergeLocalProperties(TransportId t, TransportProperties p)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Sets the remote transport properties for the given contact, replacing
|
||||
* any existing properties.
|
||||
*/
|
||||
void setRemoteProperties(ContactId c,
|
||||
Map<TransportId, TransportProperties> p) throws DbException;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package org.briarproject.api.transport;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.crypto.SecretKey;
|
||||
import org.briarproject.api.lifecycle.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -14,11 +14,13 @@ import java.util.Collection;
|
||||
public interface KeyManager extends Service {
|
||||
|
||||
/**
|
||||
* Informs the key manager that a new contact has been added.
|
||||
* Informs the key manager that a new contact has been added. Derives and
|
||||
* stores transport keys for communicating with the contact.
|
||||
* {@link StreamContext StreamContexts} for the contact can be created
|
||||
* after this method has returned.
|
||||
*/
|
||||
void contactAdded(ContactId c, Collection<TransportKeys> keys);
|
||||
void addContact(ContactId c, Collection<TransportId> transports,
|
||||
SecretKey master, long timestamp, boolean alice);
|
||||
|
||||
/**
|
||||
* Returns a {@link StreamContext} for sending a stream to the given
|
||||
@@ -29,8 +31,8 @@ public interface KeyManager extends Service {
|
||||
|
||||
/**
|
||||
* Looks up the given tag and returns a {@link StreamContext} for reading
|
||||
* from the corresponding stream if the tag was expected, or null if the
|
||||
* tag was unexpected.
|
||||
* from the corresponding stream, or null if an error occurs or the tag was
|
||||
* unexpected.
|
||||
*/
|
||||
StreamContext recogniseTag(TransportId t, byte[] tag) throws DbException;
|
||||
StreamContext getStreamContext(TransportId t, byte[] tag);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user