mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Created expiry update and expiry ack packets for BMP.
This commit is contained in:
15
briar-api/src/net/sf/briar/api/protocol/ExpiryAck.java
Normal file
15
briar-api/src/net/sf/briar/api/protocol/ExpiryAck.java
Normal 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;
|
||||
}
|
||||
}
|
||||
23
briar-api/src/net/sf/briar/api/protocol/ExpiryUpdate.java
Normal file
23
briar-api/src/net/sf/briar/api/protocol/ExpiryUpdate.java
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user