Created expiry update and expiry ack packets for BMP.

This commit is contained in:
akwizgran
2013-01-28 20:43:43 +00:00
parent 7a4549a699
commit 0141365963
14 changed files with 177 additions and 33 deletions

View File

@@ -0,0 +1,15 @@
package net.sf.briar.api.protocol;
/** A packet acknowledging a (@link ExpiryUpdate} */
public class ExpiryAck {
private final long version;
public ExpiryAck(long version) {
this.version = version;
}
public long getVersionNumber() {
return version;
}
}

View File

@@ -0,0 +1,23 @@
package net.sf.briar.api.protocol;
/**
* A packet updating the recipient's view of the expiry time of the sender's
* database.
*/
public class ExpiryUpdate {
private final long expiry, version;
public ExpiryUpdate(long expiry, long version) {
this.expiry = expiry;
this.version = version;
}
public long getExpiryTime() {
return expiry;
}
public long getVersionNumber() {
return version;
}
}

View File

@@ -9,6 +9,12 @@ public interface ProtocolReader {
boolean hasAck() throws IOException;
Ack readAck() throws IOException;
boolean hasExpiryAck() throws IOException;
ExpiryAck readExpiryAck() throws IOException;
boolean hasExpiryUpdate() throws IOException;
ExpiryUpdate readExpiryUpdate() throws IOException;
boolean hasMessage() throws IOException;
UnverifiedMessage readMessage() throws IOException;

View File

@@ -10,6 +10,10 @@ public interface ProtocolWriter {
void writeAck(Ack a) throws IOException;
void writeExpiryAck(ExpiryAck a) throws IOException;
void writeExpiryUpdate(ExpiryUpdate e) throws IOException;
void writeMessage(byte[] raw) throws IOException;
void writeOffer(Offer o) throws IOException;

View File

@@ -2,7 +2,7 @@ package net.sf.briar.api.protocol;
import java.util.Collection;
/** A packet updating the sender's subscriptions. */
/** A packet updating the recipient's view of the sender's subscriptions. */
public class SubscriptionUpdate {
private final Collection<Group> subs;

View File

@@ -2,7 +2,9 @@ package net.sf.briar.api.protocol;
import net.sf.briar.api.TransportProperties;
/** A packet updating the sender's transport properties. */
/**
* A packet updating the recipient's view of the sender's transport properties.
*/
public class TransportUpdate {
private final TransportId id;

View File

@@ -3,14 +3,16 @@ package net.sf.briar.api.protocol;
/** Struct identifiers for encoding and decoding protocol objects. */
public interface Types {
int ACK = 0;
int AUTHOR = 1;
int GROUP = 3;
int MESSAGE = 4;
int OFFER = 5;
int REQUEST = 6;
int SUBSCRIPTION_ACK = 7;
int SUBSCRIPTION_UPDATE = 8;
int TRANSPORT_ACK = 9;
int TRANSPORT_UPDATE = 10;
int AUTHOR = 0;
int GROUP = 1;
int ACK = 2;
int EXPIRY_ACK = 3;
int EXPIRY_UPDATE = 4;
int MESSAGE = 5;
int OFFER = 6;
int REQUEST = 7;
int SUBSCRIPTION_ACK = 8;
int SUBSCRIPTION_UPDATE = 9;
int TRANSPORT_ACK = 10;
int TRANSPORT_UPDATE = 11;
}