raw
smg_comms_skeys_s...    1  -- Data structures for SMG Communication Protocol
smg_comms_skeys_s... 2 -- S.MG, 2018
smg_comms_skeys_s... 3
smg_comms_skeys_s... 4 with Interfaces; -- for fixed-size types
smg_comms_skeys_s... 5 with Raw_Types; -- for protocol raw types
smg_comms_skeys_s... 6 with System; -- for Bit_Order
smg_comms_skeys_s... 7 with Serpent; -- for Serpent.Key type
smg_comms_skeys_s... 8
smg_comms_skeys_s... 9 package Data_Structs is
smg_comms_skeys_s... 10 Pragma Pure(Data_Structs);
smg_comms_skeys_s... 11
smg_comms_skeys_s... 12 -- an object in the world, with record layout fully specified
smg_comms_skeys_s... 13 -- a storage element is 8-bit aka 1 octet
smg_comms_skeys_s... 14 -- "at" gives number of storage element
smg_comms_skeys_s... 15 -- "range" gives bits inside storage element
smg_comms_skeys_s... 16
smg_comms_skeys_s... 17 type SMG_Object is
smg_comms_skeys_s... 18 record
smg_comms_skeys_s... 19 -- ID of the object
smg_comms_skeys_s... 20 ID : Interfaces.Unsigned_32;
smg_comms_skeys_s... 21
smg_comms_skeys_s... 22 -- Position of the object in the world.
smg_comms_skeys_s... 23 -- For a world with map coordinates (MC) between -500 and +500,
smg_comms_skeys_s... 24 -- the relationship with given figure (GF) is:
smg_comms_skeys_s... 25 -- MC = GF / 65.535 - 500
smg_comms_skeys_s... 26 -- where 65.535 comes from the mapping 65535 / (500 - - 500)
smg_comms_skeys_s... 27 X, Y, Z : Interfaces.Integer_16;
smg_comms_skeys_s... 28
smg_comms_skeys_s... 29 -- Rotation of the object (RO) linked to GF by:
smg_comms_skeys_s... 30 -- RO = GF / 128*pi
smg_comms_skeys_s... 31 RX, RY, RZ : Interfaces.Unsigned_8;
smg_comms_skeys_s... 32 end record;
smg_comms_skeys_s... 33 for SMG_Object'Size use 104; -- in bits!
smg_comms_skeys_s... 34 for SMG_Object'Bit_Order use System.Low_Order_First;
smg_comms_skeys_s... 35 for SMG_Object use
smg_comms_skeys_s... 36 record
smg_comms_skeys_s... 37 ID at 0 range 0 .. 31;
smg_comms_skeys_s... 38 X at 4 range 0 .. 15;
smg_comms_skeys_s... 39 Y at 6 range 0 .. 15;
smg_comms_skeys_s... 40 Z at 8 range 0 .. 15;
smg_comms_skeys_s... 41 RX at 10 range 0 .. 7;
smg_comms_skeys_s... 42 RY at 11 range 0 .. 7;
smg_comms_skeys_s... 43 RZ at 12 range 0 .. 7;
smg_comms_skeys_s... 44 end record;
smg_comms_skeys_s... 45
smg_comms_skeys_s... 46 -------------------------
smg_comms_skeys_s... 47 -- A set of Serpent Keys
smg_comms_skeys_s... 48 -- parametrized record for a Serpent Keyset
smg_comms_skeys_s... 49 -- parameters:
smg_comms_skeys_s... 50 -- N is number of Serpent Keys contained
smg_comms_skeys_s... 51 -- this can be the content of messages 4.1 or 5.2 in protocol spec.
smg_comms_skeys_s... 52
smg_comms_skeys_s... 53 -- an array of Serpent Keys
smg_comms_skeys_s... 54 -- MAXIMUM 40 keys allowed in a message, hence subtype for key count
smg_comms_skeys_s... 55 subtype Keys_Count is Interfaces.Unsigned_8 range 1..40;
smg_comms_skeys_s... 56 type SKeys_Array is array( Keys_Count range <>) of Serpent.Key;
smg_comms_skeys_s... 57
smg_comms_skeys_s... 58 type Serpent_Keyset( N : Keys_Count := Keys_Count'Last) is
smg_comms_skeys_s... 59 record
smg_comms_skeys_s... 60 -- actual Serpent Keys
smg_comms_skeys_s... 61 Keys : SKeys_Array( 1..N );
smg_comms_skeys_s... 62 -- whether for talking to client (LSB set) or talking to server (MSB set)
smg_comms_skeys_s... 63 Flag : Interfaces.Unsigned_8;
smg_comms_skeys_s... 64 end record;
smg_comms_skeys_s... 65
smg_comms_skeys_s... 66 ------------------------------
smg_comms_skeys_s... 67 -- Serpent Keys Management
smg_comms_skeys_s... 68 type Keys_Mgm (N_Burnt: Interfaces.Unsigned_8) is
smg_comms_skeys_s... 69 record
smg_comms_skeys_s... 70 -- count of server keys requested
smg_comms_skeys_s... 71 N_Server: Interfaces.Unsigned_8;
smg_comms_skeys_s... 72 -- count of client keys requested
smg_comms_skeys_s... 73 N_Client: Interfaces.Unsigned_8;
smg_comms_skeys_s... 74 -- ID of Serpent key preferred for further inbound Serpent msgs.
smg_comms_skeys_s... 75 Key_ID : Interfaces.Unsigned_8;
smg_comms_skeys_s... 76 -- IDs of Serpent keys burnt by this message
smg_comms_skeys_s... 77 Burnt : SKeys_Array( 1..N_Burnt );
smg_comms_skeys_s... 78 end record;
smg_comms_skeys_s... 79
smg_comms_skeys_s... 80 end Data_Structs;