Commit 021b3c5a authored by akwizgran's avatar akwizgran

Code cleanup: "static final" is unnecessary in interfaces.

parent 7f94707d
......@@ -9,39 +9,39 @@ public interface ProtocolConstants {
* changes in the protocol, this is smaller than the minimum connection
* length minus the maximum encryption and authentication overhead.
*/
static final int MAX_PACKET_LENGTH = MIN_CONNECTION_LENGTH / 2;
int MAX_PACKET_LENGTH = MIN_CONNECTION_LENGTH / 2;
/** The maximum number of transports a node may support. */
static final int MAX_TRANSPORTS = 25;
int MAX_TRANSPORTS = 25;
/** The maximum number of properties per transport. */
static final int MAX_PROPERTIES_PER_TRANSPORT = 100;
int MAX_PROPERTIES_PER_TRANSPORT = 100;
/** The maximum length of a property's key or value in UTF-8 bytes. */
static final int MAX_PROPERTY_LENGTH = 100;
int MAX_PROPERTY_LENGTH = 100;
/** The maximum length of a group's name in UTF-8 bytes. */
static final int MAX_GROUP_NAME_LENGTH = 50;
int MAX_GROUP_NAME_LENGTH = 50;
/** The maximum length of a public key in bytes. */
static final int MAX_PUBLIC_KEY_LENGTH = 120;
int MAX_PUBLIC_KEY_LENGTH = 120;
/** The maximum length of an author's name in UTF-8 bytes. */
static final int MAX_AUTHOR_NAME_LENGTH = 50;
int MAX_AUTHOR_NAME_LENGTH = 50;
/**
* The maximum length of a message body in bytes. To allow for future
* changes in the protocol, this is smaller than the maximum packet length
* even when all the message's other fields have their maximum lengths.
*/
static final int MAX_BODY_LENGTH = MAX_PACKET_LENGTH - 1024;
int MAX_BODY_LENGTH = MAX_PACKET_LENGTH - 1024;
/** The maximum length of a message's subject line in UTF-8 bytes. */
static final int MAX_SUBJECT_LENGTH = 100;
int MAX_SUBJECT_LENGTH = 100;
/** The maximum length of a signature in bytes. */
static final int MAX_SIGNATURE_LENGTH = 120;
int MAX_SIGNATURE_LENGTH = 120;
/** The length of a message's random salt in bytes. */
static final int SALT_LENGTH = 8;
int SALT_LENGTH = 8;
}
......@@ -3,14 +3,14 @@ package net.sf.briar.api.protocol;
/** Struct identifiers for encoding and decoding protocol objects. */
public interface Types {
static final int ACK = 0;
static final int AUTHOR = 1;
static final int BATCH = 2;
static final int GROUP = 3;
static final int MESSAGE = 4;
static final int OFFER = 5;
static final int REQUEST = 6;
static final int SUBSCRIPTION_UPDATE = 7;
static final int TRANSPORT = 8;
static final int TRANSPORT_UPDATE = 9;
int ACK = 0;
int AUTHOR = 1;
int BATCH = 2;
int GROUP = 3;
int MESSAGE = 4;
int OFFER = 5;
int REQUEST = 6;
int SUBSCRIPTION_UPDATE = 7;
int TRANSPORT = 8;
int TRANSPORT_UPDATE = 9;
}
......@@ -3,30 +3,30 @@ package net.sf.briar.api.transport;
public interface TransportConstants {
/** The length of the connection tag in bytes. */
static final int TAG_LENGTH = 16;
int TAG_LENGTH = 16;
/** The maximum length of a frame in bytes, including the header and MAC. */
static final int MAX_FRAME_LENGTH = 32768; // 2^15, 32 KiB
int MAX_FRAME_LENGTH = 32768; // 2^15, 32 KiB
/** The length of the initalisation vector (IV) in bytes. */
static final int IV_LENGTH = 12;
int IV_LENGTH = 12;
/** The length of the additional authenticated data (AAD) in bytes. */
static final int AAD_LENGTH = 6;
int AAD_LENGTH = 6;
/** The length of the frame header in bytes. */
static final int HEADER_LENGTH = 2;
int HEADER_LENGTH = 2;
/** The length of the message authentication code (MAC) in bytes. */
static final int MAC_LENGTH = 16;
int MAC_LENGTH = 16;
/**
* The minimum connection length in bytes that all transport plugins must
* support. Connections may be shorter than this length, but all transport
* plugins must support connections of at least this length.
*/
static final int MIN_CONNECTION_LENGTH = 1024 * 1024; // 2^20, 1 MiB
int MIN_CONNECTION_LENGTH = 1024 * 1024; // 2^20, 1 MiB
/** The size of the connection reordering window. */
static final int CONNECTION_WINDOW_SIZE = 32;
int CONNECTION_WINDOW_SIZE = 32;
}
......@@ -9,48 +9,48 @@ interface DatabaseConstants {
* device where the database is stored. Whenever less than this much space
* is free, old messages will be expired from the database.
*/
static final long MIN_FREE_SPACE = 300 * 1024 * 1024; // 300 MiB
long MIN_FREE_SPACE = 300 * 1024 * 1024; // 300 MiB
/**
* The minimum amount of space in bytes that must be kept free on the device
* where the database is stored. If less than this much space is free and
* there are no more messages to expire, an Error will be thrown.
*/
static final long CRITICAL_FREE_SPACE = 100 * 1024 * 1024; // 100 MiB
long CRITICAL_FREE_SPACE = 100 * 1024 * 1024; // 100 MiB
/**
* The amount of free space will be checked whenever this many bytes of
* messages have been added to the database since the last check.
*/
static final int MAX_BYTES_BETWEEN_SPACE_CHECKS = 5 * 1024 * 1024; // 5 MiB
int MAX_BYTES_BETWEEN_SPACE_CHECKS = 5 * 1024 * 1024; // 5 MiB
/**
* The amount of free space will be checked whenever this many milliseconds
* have passed since the last check.
*/
static final long MAX_MS_BETWEEN_SPACE_CHECKS = 60L * 1000L; // 1 min
long MAX_MS_BETWEEN_SPACE_CHECKS = 60L * 1000L; // 1 min
/**
* Up to this many bytes of messages will be expired from the database each
* time it is necessary to expire messages.
*/
static final int BYTES_PER_SWEEP = 5 * 1024 * 1024; // 5 MiB
int BYTES_PER_SWEEP = 5 * 1024 * 1024; // 5 MiB
/**
* The timestamp of the oldest message in the database is rounded using
* this modulus to avoid revealing the presence of any particular message.
*/
static final long EXPIRY_MODULUS = 60L * 60L * 1000L; // 1 hour
long EXPIRY_MODULUS = 60L * 60L * 1000L; // 1 hour
/**
* A batch sent to a contact is considered lost when this many more
* recently sent batches have been acknowledged.
*/
static final int RETRANSMIT_THRESHOLD = 5;
int RETRANSMIT_THRESHOLD = 5;
/**
* The time in milliseconds after which a subscription or transport update
* should be sent to a contact even if no changes have occurred.
*/
static final long MAX_UPDATE_INTERVAL = 12L * 60L * 60L * 1000L; // 12 hours
long MAX_UPDATE_INTERVAL = 12L * 60L * 60L * 1000L; // 12 hours
}
......@@ -2,28 +2,28 @@ package net.sf.briar.serial;
interface Tag {
static final byte FALSE = (byte) 0xFF; // 1111 1111
static final byte TRUE = (byte) 0xFE; // 1111 1110
static final byte INT8 = (byte) 0xFD; // 1111 1101
static final byte INT16 = (byte) 0xFC; // 1111 1100
static final byte INT32 = (byte) 0xFB; // 1111 1011
static final byte INT64 = (byte) 0xFA; // 1111 1010
static final byte FLOAT32 = (byte) 0xF9; // 1111 1001
static final byte FLOAT64 = (byte) 0xF8; // 1111 1000
static final byte STRING = (byte) 0xF7; // 1111 0111
static final byte BYTES = (byte) 0xF6; // 1111 0110
static final byte LIST = (byte) 0xF5; // 1111 0111
static final byte MAP = (byte) 0xF4; // 1111 0100
static final byte END = (byte) 0xF3; // 1111 0011
static final byte NULL = (byte) 0xF2; // 1111 0010
static final byte STRUCT = (byte) 0xF1; // 1111 0001
byte FALSE = (byte) 0xFF; // 1111 1111
byte TRUE = (byte) 0xFE; // 1111 1110
byte INT8 = (byte) 0xFD; // 1111 1101
byte INT16 = (byte) 0xFC; // 1111 1100
byte INT32 = (byte) 0xFB; // 1111 1011
byte INT64 = (byte) 0xFA; // 1111 1010
byte FLOAT32 = (byte) 0xF9; // 1111 1001
byte FLOAT64 = (byte) 0xF8; // 1111 1000
byte STRING = (byte) 0xF7; // 1111 0111
byte BYTES = (byte) 0xF6; // 1111 0110
byte LIST = (byte) 0xF5; // 1111 0111
byte MAP = (byte) 0xF4; // 1111 0100
byte END = (byte) 0xF3; // 1111 0011
byte NULL = (byte) 0xF2; // 1111 0010
byte STRUCT = (byte) 0xF1; // 1111 0001
static final int SHORT_STRING = 0x80; // 1000 xxxx
static final int SHORT_BYTES = 0x90; // 1001 xxxx
static final int SHORT_LIST = 0xA0; // 1010 xxxx
static final int SHORT_MAP = 0xB0; // 1011 xxxx
static final int SHORT_STRUCT = 0xC0; // 110x xxxx
int SHORT_STRING = 0x80; // 1000 xxxx
int SHORT_BYTES = 0x90; // 1001 xxxx
int SHORT_LIST = 0xA0; // 1010 xxxx
int SHORT_MAP = 0xB0; // 1011 xxxx
int SHORT_STRUCT = 0xC0; // 110x xxxx
static final int SHORT_MASK = 0xF0; // Match first four bits
static final int SHORT_STRUCT_MASK = 0xE0; // Match first three bits
int SHORT_MASK = 0xF0; // Match first four bits
int SHORT_STRUCT_MASK = 0xE0; // Match first three bits
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment