-- Data structures for SMG Communication Protocol -- S.MG, 2018 with Interfaces; -- for fixed-size types with Raw_Types; -- for protocol raw types with System; -- for Bit_Order with Serpent; -- for Serpent.Key type package Data_Structs is Pragma Pure(Data_Structs); -- an object in the world, with record layout fully specified -- a storage element is 8-bit aka 1 octet -- "at" gives number of storage element -- "range" gives bits inside storage element type SMG_Object is record -- ID of the object ID : Interfaces.Unsigned_32; -- Position of the object in the world. -- For a world with map coordinates (MC) between -500 and +500, -- the relationship with given figure (GF) is: -- MC = GF / 65.535 - 500 -- where 65.535 comes from the mapping 65535 / (500 - - 500) X, Y, Z : Interfaces.Integer_16; -- Rotation of the object (RO) linked to GF by: -- RO = GF / 128*pi RX, RY, RZ : Interfaces.Unsigned_8; end record; for SMG_Object'Size use 104; -- in bits! for SMG_Object'Bit_Order use System.Low_Order_First; for SMG_Object use record ID at 0 range 0 .. 31; X at 4 range 0 .. 15; Y at 6 range 0 .. 15; Z at 8 range 0 .. 15; RX at 10 range 0 .. 7; RY at 11 range 0 .. 7; RZ at 12 range 0 .. 7; end record; ------------------------- -- A set of Serpent Keys -- parametrized record for a Serpent Keyset -- parameters: -- N is number of Serpent Keys contained -- this can be the content of messages 4.1 or 5.2 in protocol spec. -- an array of Serpent Keys -- MAXIMUM 40 keys allowed in a message, hence subtype for key count subtype Keys_Count is Interfaces.Unsigned_8 range 1..40; type SKeys_Array is array( Keys_Count range <>) of Serpent.Key; type Serpent_Keyset( N : Keys_Count := Keys_Count'Last) is record -- actual Serpent Keys Keys : SKeys_Array( 1..N ); -- whether for talking to client (LSB set) or talking to server (MSB set) Flag : Interfaces.Unsigned_8; end record; ------------------------------ -- Serpent Keys Management type Keys_Mgm (N_Burnt: Interfaces.Unsigned_8) is record -- count of server keys requested N_Server: Interfaces.Unsigned_8; -- count of client keys requested N_Client: Interfaces.Unsigned_8; -- ID of Serpent key preferred for further inbound Serpent msgs. Key_ID : Interfaces.Unsigned_8; -- IDs of Serpent keys burnt by this message Burnt : SKeys_Array( 1..N_Burnt ); end record; end Data_Structs;