Files
briar/briar-api/src/org/briarproject/api/ProtocolEngine.java
Torsten Grote f44cb5ff94 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.
2016-03-30 13:36:14 -03:00

32 lines
840 B
Java

package org.briarproject.api;
import org.briarproject.api.event.Event;
import java.util.List;
public interface ProtocolEngine<A, S, M> {
StateUpdate<S, M> onLocalAction(S localState, A action);
StateUpdate<S, M> onMessageReceived(S localState, M received);
StateUpdate<S, M> onMessageDelivered(S localState, M delivered);
class StateUpdate<S, M> {
public final boolean deleteMessages;
public final boolean deleteState;
public final S localState;
public final List<M> toSend;
public final List<Event> toBroadcast;
public StateUpdate(boolean deleteMessages, boolean deleteState,
S localState, List<M> toSend, List<Event> toBroadcast) {
this.deleteMessages = deleteMessages;
this.deleteState = deleteState;
this.localState = localState;
this.toSend = toSend;
this.toBroadcast = toBroadcast;
}
}
}