... | @@ -6,42 +6,40 @@ Mailbox messages are implemented as [BDF lists](https://code.briarproject.org/br |
... | @@ -6,42 +6,40 @@ Mailbox messages are implemented as [BDF lists](https://code.briarproject.org/br |
|
|
|
|
|
`[TYPE, MESSAGE_ID, BODY]`
|
|
`[TYPE, MESSAGE_ID, BODY]`
|
|
|
|
|
|
+ **TYPE:** An `Integer` identifying the Message Type:
|
|
+ **TYPE:** *[BDF long]* An integer identifying the Message Type.
|
|
+ RESPONSE (0)
|
|
|
|
+ END (1)
|
|
|
|
+ STORE (2)
|
|
|
|
+ TAKE (3)
|
|
|
|
+ SYNC (4)
|
|
|
|
|
|
|
|
+ **MESSAGE_ID:** An `Integer` which must be unique only to **active requests**.
|
|
+ **MESSAGE_ID:** *[BDF long]* An integer which must be unique (for **active requests**).
|
|
|
|
|
|
+ **BODY:** A `List` which is formatted depending on the message type
|
|
+ **BODY:** *[BDF list]* A list which is formatted depending on the message type
|
|
|
|
|
|
## Responses
|
|
## Responses
|
|
Depending on the TYPE, a Request may have a response. Currently these responses either indicate *success* or and *error* if an error occurred.
|
|
Depending on the TYPE, a Request may have a response.
|
|
|
|
|
|
+ **MESSAGE_ID:** The Id must match the corresponding request's Id.
|
|
+ **MESSAGE_ID:** The Id must match the corresponding request's Id.
|
|
|
|
|
|
+ **BODY:** May either contain a `String`, if an error occurred or `Null` id the matching request was successful.
|
|
+ **BODY:** Formatted depending on the request.
|
|
|
|
|
|
## Requests
|
|
## Requests
|
|
### STORE
|
|
### OFFER
|
|
A STORE request indicates that the connected peer wants to store an encrypted stream on the mailbox.
|
|
An OFFER request indicates that the connected peer wants to send a chunked file to the recipient.
|
|
|
|
|
|
+ **RESPONSE:** yes
|
|
+ **RESPONSE:** yes
|
|
|
|
|
|
+ **BODY:** [CONTACT_ID, STREAM]
|
|
+ **BODY:** [FILE_ID, NUM_CHUNKS ,CONTACT_ID]
|
|
+ **CONTACT_ID:** Either `Null`, if the contact's id is identified by the connection (A contact of the owner connecting to the owner's mailbox is only allowed to store their own streams) or `Integer` to indicate for which id the stream should be stored (Used by the owner storing streams for contacts without their own mailbox)
|
|
+ **FILE_ID:** *[BDF raw]* A unique identifier which specifies the offered file. *NOTE: The identifier is the encrypted stream's sha256 sum and is also used to verify the file*
|
|
|
|
|
|
|
|
+ **NUM_CHUNKS:** *[BDF long]* Specifies how many chunks the file consists of. *Note: Chunks, except for the last one, have a fixed size:* `CHUNK_SIZE`
|
|
|
|
|
|
+ **STREAM:** `Raw` containing a [BTP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BTP.md) *stream* which contains [BSP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md) messages.
|
|
+ **CONTACT_ID:** *[BDF long/null]* Either `Null`, if the contact's id is identified by the connection (A contact of the owner connecting to the owner's mailbox is only allowed to store their own streams) or `Integer` to indicate for which id the stream should be stored (Used by the owner storing streams for contacts without their own mailbox)
|
|
|
|
|
|
### TAKE
|
|
### CHUNK
|
|
A TAKE request indicates that the mailbox wants to pass an encrypted stream to the connected peer.
|
|
A CHUNK request contains a chunk of a previously *offered* file. *Note: Since the OFFER request already specifies the contact's Id, we do add the contact's id to the CHUNK request*
|
|
|
|
|
|
+ **RESPONSE:** yes
|
|
+ **RESPONSE:** yes
|
|
|
|
|
|
+ **BODY:** [STREAM]
|
|
+ **BODY:** [CHUNK_INDEX, CHUNK]
|
|
+ **STREAM:** `Raw` containing a [BTP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BTP.md) *stream* which contains [BSP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md) messages.
|
|
+ **CHUNK_INDEX:** *[BDF long]* Defines the chunk's index in the chunked file
|
|
|
|
+ **CHUNK:** *[BDF raw]* chunk
|
|
|
|
|
|
### SYNC
|
|
### SYNC
|
|
SYNC requests are used to carry [BSP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md) messages between the mailbox and the connected client.
|
|
SYNC requests are used to carry [BSP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md) messages between the mailbox and the connected client.
|
... | @@ -49,7 +47,7 @@ SYNC requests are used to carry [BSP](https://code.briarproject.org/briar/briar- |
... | @@ -49,7 +47,7 @@ SYNC requests are used to carry [BSP](https://code.briarproject.org/briar/briar- |
|
+ **RESPONSE:** no
|
|
+ **RESPONSE:** no
|
|
|
|
|
|
+ **BODY:** [STREAM]
|
|
+ **BODY:** [STREAM]
|
|
+ **STREAM:** Either `Raw` containing a collection of [BSP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md) messages or `null` to indicate an "end of stream"
|
|
+ **STREAM:** *[BDF raw/null]* Either bytes containing a collection of [BSP](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md) messages or `null` to indicate an "end of stream"
|
|
|
|
|
|
|
|
|
|
### END
|
|
### END
|
... | | ... | |