Minor protocol refactoring.

This commit is contained in:
akwizgran
2011-11-18 11:27:34 +00:00
parent 30580f71ec
commit dacaa4566d
11 changed files with 96 additions and 108 deletions

View File

@@ -1,32 +0,0 @@
package net.sf.briar.api.protocol;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;
public interface MessageEncoder {
/** Encodes a private message. */
Message encodeMessage(MessageId parent, String subject, byte[] body)
throws IOException, GeneralSecurityException;
/** Encodes an anonymous message to an unrestricted group. */
Message encodeMessage(MessageId parent, Group group, String subject,
byte[] body) throws IOException, GeneralSecurityException;
/** Encodes an anonymous message to a restricted group. */
Message encodeMessage(MessageId parent, Group group, PrivateKey groupKey,
String subject, byte[] body) throws IOException,
GeneralSecurityException;
/** Encodes a pseudonymous message to an unrestricted group. */
Message encodeMessage(MessageId parent, Group group, Author author,
PrivateKey authorKey, String subject, byte[] body)
throws IOException, GeneralSecurityException;
/** Encode a pseudonymous message to a restricted group. */
Message encodeMessage(MessageId parent, Group group, PrivateKey groupKey,
Author author, PrivateKey authorKey, String subject, byte[] body)
throws IOException, GeneralSecurityException;
}

View File

@@ -0,0 +1,31 @@
package net.sf.briar.api.protocol;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;
public interface MessageFactory {
/** Creates a private message. */
Message createMessage(MessageId parent, String subject, byte[] body)
throws IOException, GeneralSecurityException;
/** Creates an anonymous message to an unrestricted group. */
Message createMessage(MessageId parent, Group group, String subject,
byte[] body) throws IOException, GeneralSecurityException;
/** Creates an anonymous message to a restricted group. */
Message createMessage(MessageId parent, Group group, PrivateKey groupKey,
String subject, byte[] body) throws IOException,
GeneralSecurityException;
/** Creates a pseudonymous message to an unrestricted group. */
Message createMessage(MessageId parent, Group group, Author author,
PrivateKey authorKey, String subject, byte[] body)
throws IOException, GeneralSecurityException;
/** Creates a pseudonymous message to a restricted group. */
Message createMessage(MessageId parent, Group group, PrivateKey groupKey,
Author author, PrivateKey authorKey, String subject, byte[] body)
throws IOException, GeneralSecurityException;
}