SH2SC-EDT
Self-Healing Hardware and Software Complex for Encrypted Data Transmission
Loading...
Searching...
No Matches
protocol.h File Reference

Shared C2P-ARQ protocol definitions for SH2SC-EDT (Transmitter Node A). More...

#include <stdint.h>
+ Include dependency graph for protocol.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HelloPacket
 Session-open handshake packet (FLAG_SYN). More...
 
struct  DataPacket
 Authenticated data packet (FLAG_DAT) and session-close packet (FLAG_FIN). More...
 

Variables

const uint8_t MASTER_PSK [32]
 256-bit (32-byte) Pre-Shared Master Key for ChaCha20-Poly1305 AEAD.
 
const uint8_t FLAG_SYN = 0x01
 Session open — HelloPacket carrying the 12-byte CSPRNG nonce.
 
const uint8_t FLAG_DAT = 0x02
 Data frame — DataPacket carrying an encrypted note (index + duration).
 
const uint8_t FLAG_FIN = 0x04
 Session close — instructs RX to teardown the current session.
 
const uint8_t HELLO_NONCE_SIZE = 12u
 ChaCha20 IV length in bytes (IETF 96-bit nonce format).
 
const uint8_t AUTH_TAG_SIZE = 16u
 Full Poly1305 tag length in bytes (computed internally, not fully transmitted).
 
const uint8_t TRUNCATED_MAC_SIZE = 8u
 Bytes of Poly1305 MAC actually placed on the wire (first 8 of 16).
 
const uint8_t DATA_PAYLOAD_SIZE = 4u
 Byte size of the encrypted payload in a DataPacket.
 
const uint8_t SYNC_BYTE_1 = 0xAA
 First synchronisation byte (preamble marker).
 
const uint8_t SYNC_BYTE_2 = 0x55
 Second synchronisation byte (preamble marker).
 
const uint8_t ACK_BYTE = 0x06
 Positive acknowledgement — MAC verified, note played (or FIN accepted).
 
const uint8_t NACK_BYTE = 0x15
 Negative acknowledgement — MAC mismatch; TX must retransmit.
 
const uint8_t REST_INDEX = 255
 Special note index value representing a rest (silence).
 
const uint32_t ACK_TIMEOUT_MS = 50UL
 Maximum milliseconds TX waits for an ACK before retransmitting.
 
const uint8_t MAX_RETRIES = 50u
 Retransmission limit per packet; exhausting this triggers suspendSession().
 
const uint16_t BAUD_RATE = 9600
 UART baud rate in bps (8N1). Chosen for clear bit-width visibility on SimulIDE oscilloscope.
 

Detailed Description

Shared C2P-ARQ protocol definitions for SH2SC-EDT (Transmitter Node A).

Part of the SH2SC-EDT project. Implements the C2P-ARQ protocol. Contains the Pre-Shared Key, frame flag constants, packed packet structs (HelloPacket, DataPacket), ARQ timing constants, and UART configuration shared by both Transmitter and Receiver nodes. Included from transmitter.h; do NOT include directly from .ino.

Definition in file protocol.h.