123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- // acetone, 2024
- // I hate copyright of any kind. This is a public domain.
- // Original source: https://notabug.org/acetone/shitflow
- /**********************************************************************************
- *** MINI INLINE DOCUMENTATION ***
- Dialog protocol: request-response.
- If there is no response to the request, the connection is closed by timeout.
- A fatal error message is transmitted outside of the sequential dialog.
- After sending, the sender closes the connection.
- If the message could not be read correctly, it is not a fatal error.
- The message_validation_error_no_action response is used so that the sender
- repeats the sending.
- In protocol terminology, the one who provides access to download files
- is the "publisher". The other party receiving is the "consumer".
- It is assumed that the implementation allows multiple consumers to connect.
- The transfer payload (file) is called the "point".
- The v0 protocol uses the following types of messaging objects:
- - message:
- - request:
- - handshake,
- - get_point_declaration_list,
- - get_chunk,
- - close_connection_on_success
- - response:
- - handshake,
- - point_does_not_exists,
- - chunk_does_not_exists,
- - message_validation_error_no_action,
- - point_declaration_list,
- - chunk
- - fatal_error:
- - reading_timeout,
- - other
- The v0 protocol uses the following types of data structures:
- - handshake
- - point_declaration
- - chunk
- Data structures have versions.
- This provides the potential for extending the protocol without major changes.
- *** Message scheme:
- +------------------------+
- | DESCRIPTION CRC32 | 4 bytes
- +------------------------+
- | DESCRIPTION SIZE | 2 bytes
- +------------------------+
- | DESCRIPTION | variable
- +------------------------+
- | PAYLOAD CRC32 | 4 bytes
- +------------------------+
- | PAYLOAD | variable
- +------------------------+
- The payload may contain a nested similar message.
- Description validation logic via CRC32 allows you to
- validate an incoming message without fully receiving it.
- If the description part are corrupted, further
- processing is interrupted.
- Description contains Message type and other base info.
- Any payload of variable and significant size is not included
- in the description. This is to ensure that the initial validation
- of the input data does not require the acquisition
- of a large amount of data.
- *** Handshake
- The consumer makes a request specifying the protocol version
- and all supported stucture versions to be used.
- The publisher responds with the protocol version and only one version
- for each structure it supports, as reported by the consumer.
- The most recent version that both parties support should be used.
- If an incompatibility occurs, the publisher sends a handshake message
- with an incompatibility flag.
- * Handshake request structure:
- +-------------------------------+
- | PROTOCOL VERSION | 1 byte
- +===============================+
- | SUPPORTED HANDSHAKE VER COUNT | 1 byte
- +-------------------------------+
- | SUPPORTED VERSIONS ARRAY | 1*count byte
- +===============================+
- | S. POINT DECLARATION V. COUNT | 1 byte
- +-------------------------------+
- | SUPPORTED VERSIONS ARRAY | 1*count byte
- +===============================+
- | SUPPORTED CHUNK VER COUNT | 1 byte
- +-------------------------------+
- | SUPPORTED VERSIONS ARRAY | 1*count byte
- +-------------------------------+
- * Handshake response structure:
- +-------------------------------+
- | INCOMPATIBILITY FLAG | 1 byte
- +-------------------------------+
- | PROTOCOL VERSION | 1 byte
- +-------------------------------+
- | HANDSHAKE VERSION | 1 byte
- +-------------------------------+
- | POINT DECLARATION VERSION | 1 byte
- +-------------------------------+
- | CHUNK VERSION | 1 byte
- +-------------------------------+
- **********************************************************************************/
- #pragma once
- namespace ShitFlow {
- } // namespace ShitFlow
|