# fss-0002 iki-0000
#
# license open-standard-license-1.0-or-later
# version 2024/06/05
#
# This file (assumed to be named fss-000f.txt) can be more easily read using the following iki_read commands:
#   iki_read fss-000f.txt +Q -w -WWWW character "'" "'" code '"' '"' italic '"' '"' bold '"' '"'
#
# To read the "Featureless Settings Specification: 000f - Simple Packet" section of this file, use this command sequence:
#   fss_basic_list_read fss-000f.txt +Q -cn "Featureless Settings Specification: 000f - Simple Packet" | iki_read +Q -w -WWWW character "'" "'" code '"' '"' italic '"' '"' bold '"' '"'
#

Featureless Settings Specification: 000f - Simple Packet:
  This is a network packet format that often contains code:"FSS-000e (Payload)" within it.

  The bold:"Magic Block" when containing code:"FSS-000e (Payload)" in the bold:"Payload Block" is: code:"11010010100111101111010000111110".

  The bold:"Magic Block" when containing unspecified plain text in the bold:"Payload Block" is: code:"00101110000001001101110001000010".

  The bold:"Magic Block" when containing unspecified binary data in the bold:"Payload Block" is: code:"00010101101001001111000000001000".

  The bold:"Simple Packet" structure is described in blocks, of which are structured in bytes.

  There are three or four blocks in this format\:
  1) Control Block.
  2) Size Block.
  3) Magic Block.
  4) Payload Block.

  The bold:"Control Block" is the first block in the packet and is considered endianless.
  There exists only a single byte within the bold:"Control Block" (8-bits).
  Regardless of the endianness of the packet, leftmost bit is always the endianness bit.
  The second bit following that endianness bit represents the italic:"string" or italic:"binary" bit.
  The third bit following the endiannes bit represents the magic bit.

  Control Block Structure\:
    code:"
    [ Endianness Bit ] [ String / Binary Bit ] [ Magic Bit   ] [ Remaining 5 Bits (unused) ]
    [ size: 1 bit    ] [ size: 1 bit         ] [ size: 1 bit ] [ size: 5 bits              ]
    "

  The endianness bit designates whether or not the packet is in big endian or little endian format.
  A bit value of 0 designates that this packet is in little endian and a value of 1 designates that this packet is in big endian format.
  All italic:"binary" data within this packet, following the Control Block, must respect this endianness bit (including the bold:"Size Block").

  The magic bit designates whether or not the packet contains the optional bold:"Magic Block".
  When the magic bit is not set, then there is no bold:"Magic Block".

  The italic:"string" or italic:"binary" bit, a value of 0 designates that the packet is in string format and a value of 1 designates that the packet is in italic:"binary" format.
  While the packet might be considered to be in string format, it is technically always in italic:"binary" format due to the bold:"Control Block", the optional bold:"Magic Block", and bold:"Size Block".
  This means that the italic:"binary" bit designating the packet as either a italic:"string" packet or a italic:"binary" packet is referring to whether or not the bold:"Payload Block" is in italic:"string" or italic:"binary" format.
  The bold:"Payload Block" itself can contain italic:"binary" data even when in italic:"string" format as per code:"FSS-000e (Payload)".

  The remaining bits are not defined by this standard and are expected to be 0.
  Non-formal or local uses may utilize these remaining 6 bits as desired.
  However, there may be additional standards that expand upon this and utilize these remaining bold:"Control" bits.
  Anything that utilizes these unused bold:"Control" bits may add or remove additional bold:"Blocks" after the bold:"Control Block" as they see fit.
  One possible use of the remaining bits is to designate a different variation of this bold:"Simple Packet" standard.

  Size Block Structure\:
    code:"
    [ Size Block    ]
    [ size: 32 bits ]
    "

  The bold:"Size Block" is an unsigned 32-bit integer representing the size of the entire packet in bytes, including the bold:"Control Block" and bold:"Size Block".
  This size must exactly match the packet to be a valid packet.
  The size represents number of bytes in the file.
  The bold:"Control Block" is 1 byte long and the bold:"Size Block" is 4 bytes long, therefore the maximum available size of the entire bold:"Simple Packet" structure is code:"(2^32)-5".
  The bold:"Magic Block" is 4 bytes long, therefore when the magic bit is set, then the maximum available size of the entire bold:"Simple Packet" structure is code:"(2^32)-9".

  The reason behind why the size includes both the bold:"Control Block" and the bold:"Size Block" in addition to the bold:"Payload Block" is to avoid the need to perform any calculations for handling the size of the entire packet. The idea here is to optimize the packet for the network hardware transferring the packet. The network device should not need to read the contents of the packet in order to transfer the packet and therefore it only needs the number of the entire packet. Anything that wants to analyze this packet will have to incure the cost of calculating the bold:"Payload Block" size by performing the appropriate subtraction from the size represented in the bold:"Size Block".

  Magic Block Structure\:
    code:"
    [ Magic Block   ]
    [ size: 32 bits ]
    "

  The bold:"Magic Block" is an unsigned 32-bit digit used to uniquely identify the packet.
  The 32-bits are treated as endianless such that the left to right order of the bits is always the same for both big and little endian systems.
  The bold:"Magic Block" is required when the magic bit is set and it must not exist when the magic bit is not set.

  This offers optimization in identifying the packet and its structure.
  This is particularly useful for quick identification on the network such as via routers.
  This is particularly useful for storing the packet as a file.
  This is particularly unhelpful for security and privacy given that it helps quickly identify the packet.

  Payload Block Structure\:
    code:"
    [ Payload Block                                                ]
    [ size: (2^32)-5 bytes (or (2^32)-9 bytes if magic bit is set) ]
    "

  The bold:"Payload Block" is not defined by this standard other than that it exists and is suggested to be in code:"FSS-000e (Payload)" format.
  If the bold:"Magic Block" is present and set to code:"11010010100111101111010000111110", then this is expected to be in code:"FSS-000e (Payload)" format.
  The code:"FSS-000e (Payload)" may be represented in either italic:"string" format or italic:"binary" format.
  The code:"FSS-000e (Payload)" may contain multiple italic:"header"(s) but may only contain a single italic:"payload".
  With this in mind, it is recommended that only a single italic:"header" be supported in the bold:"Payload Block".
  The italic:"payload" bold:"Content" may be in either a italic:"binary" or italic:"string" format regardless of the italic:"binary" bit in the bold:"Simple Packet" bold:"Header Block".

  See the file:"fss-000e.txt" specification file for details on the syntax rules for the bold:"Payload Block".

  Example Packet Structure\:
    code:"
    [ Control Block ] [ Size Block                                  ] [ Payload Block         ]
    [ 0b10000000    ] [ 0b00000000 0b00000000 0b00000100 0b11010010 ] [ size: 1229 (1234 - 5) ]
    "

  Example Packet Structure with Magic Bit\:
    code:"
    [ Control Block ] [ Size Block                                  ] [ Magic Block                                 ] [ Payload Block         ]
    [ 0b10100000    ] [ 0b00000000 0b00000000 0b00000100 0b11010010 ] [ 0b11010010 0b10011110 0b11110100 0b00111110 ] [ size: 1225 (1234 - 9) ]
    "
