From 6a79a30fc0948d52ba6ffcf844b13dbd6676f130 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 12 Oct 2013 21:15:52 -0400 Subject: [PATCH] Remove single byte TLV concept from socket protocol. For local socket, it isn't enough to matter. In network protocols, encryption will generally cause things to be rounded up to the next 16 bytes anyway. Make things simpler implementation wise by sticking to 4 byte tl bytes, but still reserve TL with hi bit set, just in case. --- doc/SocketProtocol.txt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/doc/SocketProtocol.txt b/doc/SocketProtocol.txt index d5582b68..b71d8b33 100644 --- a/doc/SocketProtocol.txt +++ b/doc/SocketProtocol.txt @@ -4,19 +4,15 @@ the socket protocol is empowered to do whatever is needed. All data across the wire is TLV values. -(since a single character is an exceedingly common case, have a single byte TLV -for those occasions) -Single byte TL (msb: 0): -Type=0 -Length=TL & 0b01111111 -Types: -0: text string +A shorter single byte TLV variant was considered for lower overhead for things +like single character, but in every case where throughput efficiency would +matter is probably padded to 16 byte boundaries anyway due to block ciphers. -(all other data has a 4 byte TLV for now) -Four byte TLs: (msb: 0b10) -Type=TL & 0b00111111000000000000000000000000 >> 24: +(all data has a 4 byte TLV for now) +Four byte TLs: (msb: 0b0) +Type=TL & 0b01111111000000000000000000000000 >> 24: Length= TL & 0b111111111111111111111111 0: text string 1: json data -(msb: 0b11 is reserved), probably never to be needed +(msb: 0b1 is reserved), probably never to be needed