Minor refactoring.

This commit is contained in:
akwizgran
2011-11-14 22:14:52 +00:00
parent 73aa7d14d7
commit 72be34768b
24 changed files with 130 additions and 177 deletions

View File

@@ -26,8 +26,8 @@ import net.sf.briar.api.protocol.writers.AckWriter;
import net.sf.briar.api.protocol.writers.BatchWriter;
import net.sf.briar.api.protocol.writers.OfferWriter;
import net.sf.briar.api.protocol.writers.RequestWriter;
import net.sf.briar.api.protocol.writers.SubscriptionWriter;
import net.sf.briar.api.protocol.writers.TransportWriter;
import net.sf.briar.api.protocol.writers.SubscriptionUpdateWriter;
import net.sf.briar.api.protocol.writers.TransportUpdateWriter;
import net.sf.briar.api.transport.ConnectionWindow;
/**
@@ -102,12 +102,12 @@ public interface DatabaseComponent {
throws DbException, IOException;
/** Generates a subscription update for the given contact. */
void generateSubscriptionUpdate(ContactId c, SubscriptionWriter s) throws
DbException, IOException;
void generateSubscriptionUpdate(ContactId c, SubscriptionUpdateWriter s)
throws DbException, IOException;
/** Generates a transport update for the given contact. */
void generateTransportUpdate(ContactId c, TransportWriter t) throws
DbException, IOException;
void generateTransportUpdate(ContactId c, TransportUpdateWriter t)
throws DbException, IOException;
/** Returns the configuration for the given transport. */
TransportConfig getConfig(TransportId t) throws DbException;

View File

@@ -1,13 +1,9 @@
package net.sf.briar.api.protocol.writers;
package net.sf.briar.api.protocol;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;
import net.sf.briar.api.protocol.Author;
import net.sf.briar.api.protocol.Group;
import net.sf.briar.api.protocol.Message;
import net.sf.briar.api.protocol.MessageId;
public interface MessageEncoder {

View File

@@ -12,10 +12,10 @@ public interface ProtocolConstants {
static final int MAX_PACKET_LENGTH =
TransportConstants.MIN_CONNECTION_LENGTH - 1024;
/** The maximum number of transport plugins a node may support. */
/** The maximum number of transports a node may support. */
static final int MAX_TRANSPORTS = 50;
/** The maximum number of properties per transport plugin. */
/** The maximum number of properties per transport. */
static final int MAX_PROPERTIES_PER_TRANSPORT = 100;
/** The maximum length of a property's key or value in UTF-8 bytes. */
@@ -27,7 +27,7 @@ public interface ProtocolConstants {
/** The maximum length of a group's name in UTF-8 bytes. */
static final int MAX_GROUP_NAME_LENGTH = 50;
/** The maximum length of a serialised public key in bytes. */
/** The maximum length of a public key in bytes. */
static final int MAX_PUBLIC_KEY_LENGTH = 100;
/** The maximum length of an author's name in UTF-8 bytes. */

View File

@@ -1,11 +0,0 @@
package net.sf.briar.api.protocol.writers;
import java.io.IOException;
import net.sf.briar.api.protocol.Author;
import net.sf.briar.api.serial.Writer;
public interface AuthorWriter {
void writeAuthor(Writer w, Author a) throws IOException;
}

View File

@@ -1,11 +0,0 @@
package net.sf.briar.api.protocol.writers;
import java.io.IOException;
import net.sf.briar.api.protocol.Group;
import net.sf.briar.api.serial.Writer;
public interface GroupWriter {
void writeGroup(Writer w, Group g) throws IOException;
}

View File

@@ -12,7 +12,7 @@ public interface ProtocolWriterFactory {
RequestWriter createRequestWriter(OutputStream out);
SubscriptionWriter createSubscriptionWriter(OutputStream out);
SubscriptionUpdateWriter createSubscriptionUpdateWriter(OutputStream out);
TransportWriter createTransportWriter(OutputStream out);
TransportUpdateWriter createTransportUpdateWriter(OutputStream out);
}

View File

@@ -6,7 +6,7 @@ import java.util.Map;
import net.sf.briar.api.protocol.Group;
/** An interface for creating a subscription update. */
public interface SubscriptionWriter {
public interface SubscriptionUpdateWriter {
/** Writes the contents of the update. */
void writeSubscriptions(Map<Group, Long> subs, long timestamp)

View File

@@ -6,7 +6,7 @@ import java.util.Collection;
import net.sf.briar.api.protocol.Transport;
/** An interface for creating a transport update. */
public interface TransportWriter {
public interface TransportUpdateWriter {
/** Writes the contents of the update. */
void writeTransports(Collection<Transport> transports, long timestamp)