mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Add an IntroductionManager and Validator
This Introduction BSP Client uses its own group to communicate with existing contacts. It uses four types of messages to facilitate introductions: the introduction, the response, the ack and the abort. The protocol logic is encapsulated in two protocol engines, one for the introducer and one for the introducee. The introduction client keeps the local state for each engine, hands messages over to the engines and processes the result and state changes they return.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package org.briarproject.api.introduction;
|
||||
|
||||
import org.briarproject.api.FormatException;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.data.BdfDictionary;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IntroductionManager {
|
||||
|
||||
/** Returns the unique ID of the introduction client. */
|
||||
ClientId getClientId();
|
||||
|
||||
/**
|
||||
* sends two initial introduction messages
|
||||
*/
|
||||
void makeIntroduction(Contact c1, Contact c2, String msg)
|
||||
throws DbException, FormatException;
|
||||
|
||||
/**
|
||||
* Accept an introduction that had been made
|
||||
*/
|
||||
void acceptIntroduction(final SessionId sessionId)
|
||||
throws DbException, FormatException;
|
||||
|
||||
/**
|
||||
* Decline an introduction that had been made
|
||||
*/
|
||||
void declineIntroduction(final SessionId sessionId)
|
||||
throws DbException, FormatException;
|
||||
|
||||
/**
|
||||
* Get all introduction messages for the contact with this contactId
|
||||
*/
|
||||
Collection<IntroductionMessage> getIntroductionMessages(ContactId contactId)
|
||||
throws DbException;
|
||||
|
||||
/** Marks an introduction message as read or unread. */
|
||||
void setReadFlag(MessageId m, boolean read) throws DbException;
|
||||
|
||||
|
||||
/** Get the session state for the given session ID */
|
||||
BdfDictionary getSessionState(Transaction txn, byte[] sessionId)
|
||||
throws DbException, FormatException;
|
||||
|
||||
/** Gets the group used for introductions with Contact c */
|
||||
Group getIntroductionGroup(Contact c);
|
||||
|
||||
/** Get the local group used to store session states */
|
||||
Group getLocalGroup();
|
||||
|
||||
/** Send an introduction message */
|
||||
void sendMessage(Transaction txn, BdfDictionary message)
|
||||
throws DbException, FormatException;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user