raw
smg_comms_skeys_s...    1  -- Message reader & writers for SMG Communication Protocol
smg_comms_skeys_s... 2 -- This part effectively serializes/deserializes game data structures
smg_comms_skeys_s... 3 -- for transmission between client and server.
smg_comms_skeys_s... 4 -- Note that messages themeselves are simply arrays of octets.
smg_comms_skeys_s... 5 -- (see also raw_types.ads/adb and packing.ads/adb for related parts)
smg_comms_skeys_s... 6 -- NB: message ids and padding as per protocol spec are handled HERE ONLY.
smg_comms_skeys_s... 7 -- Relies on:
smg_comms_skeys_s... 8 -- RNG (for random padding)
smg_comms_skeys_s... 9 -- CRC32 (for CRC calculations)
smg_comms_skeys_s... 10 -- Raw_Types
smg_comms_skeys_s... 11 -- Data_Structs
smg_comms_skeys_s... 12 -- S.MG, 2018
smg_comms_skeys_s... 13
smg_comms_skeys_s... 14 with Raw_Types;
smg_comms_skeys_s... 15 with RNG;
smg_comms_skeys_s... 16 with CRC32;
smg_comms_skeys_s... 17 with Data_Structs; use Data_Structs;
smg_comms_skeys_s... 18 with Interfaces;
smg_comms_skeys_s... 19
smg_comms_skeys_s... 20 package Messages is
smg_comms_skeys_s... 21 -- exception raised when given message to read fails sanity checks
smg_comms_skeys_s... 22 Invalid_Msg: exception;
smg_comms_skeys_s... 23
smg_comms_skeys_s... 24 ------------------------------------------------
smg_comms_skeys_s... 25 -- Writes a Serpent Keyset to the given Serpent Message
smg_comms_skeys_s... 26 --
smg_comms_skeys_s... 27 -- Keyset - the set of keys to write to message
smg_comms_skeys_s... 28 -- Counter - the message count
smg_comms_skeys_s... 29 procedure Write_SKeys_SMsg( Keyset : in Serpent_Keyset;
smg_comms_skeys_s... 30 Counter : in Interfaces.Unsigned_16;
smg_comms_skeys_s... 31 Msg : out Raw_Types.Serpent_Msg);
smg_comms_skeys_s... 32
smg_comms_skeys_s... 33 -- Reads a Serpent Keyset from the given Serpent Message
smg_comms_skeys_s... 34 -- The opposite of Write_SKeys_SMsg above
smg_comms_skeys_s... 35 -- Raises Invalid_Message exception if given message fails sanity checks
smg_comms_skeys_s... 36 procedure Read_SKeys_SMsg( Msg : in Raw_Types.Serpent_Msg;
smg_comms_skeys_s... 37 Counter : out Interfaces.Unsigned_16;
smg_comms_skeys_s... 38 Keyset : out Serpent_Keyset);
smg_comms_skeys_s... 39
smg_comms_skeys_s... 40 private
smg_comms_skeys_s... 41
smg_comms_skeys_s... 42 -- if native is little endian, does nothing;
smg_comms_skeys_s... 43 -- if native is big endian, it flips the input's octets.
smg_comms_skeys_s... 44 -- (strictly for arrays of octets)
smg_comms_skeys_s... 45 procedure Cast_LE( LE: in out Raw_Types.Octets );
smg_comms_skeys_s... 46
smg_comms_skeys_s... 47 -- protocol message types IDs, fixed as per protocol specification
smg_comms_skeys_s... 48 -- Serpent messages end in "S_Type"
smg_comms_skeys_s... 49 -- RSA messages end in "R_Type"
smg_comms_skeys_s... 50 -- Character action types end in "A_Type"
smg_comms_skeys_s... 51
smg_comms_skeys_s... 52 -- Serpent message types
smg_comms_skeys_s... 53 SKeys_S_Type : constant Interfaces.Unsigned_8 := 1;
smg_comms_skeys_s... 54 Key_Mgm_S_Type : constant Interfaces.Unsigned_8 := 2;
smg_comms_skeys_s... 55 File_Transfer_S_Type : constant Interfaces.Unsigned_8 := 3;
smg_comms_skeys_s... 56 File_Req_S_Type : constant Interfaces.Unsigned_8 := 4;
smg_comms_skeys_s... 57 Client_Action_S_Type : constant Interfaces.Unsigned_8 := 5;
smg_comms_skeys_s... 58 World_Bulletin_S_Type: constant Interfaces.Unsigned_8 := 6;
smg_comms_skeys_s... 59 Obj_Request_S_Type : constant Interfaces.Unsigned_8 := 7;
smg_comms_skeys_s... 60 Obj_Info_S_Type : constant Interfaces.Unsigned_8 := 8;
smg_comms_skeys_s... 61
smg_comms_skeys_s... 62 -- RSA message types
smg_comms_skeys_s... 63 RKeys_R_Type : constant Interfaces.Unsigned_8 := 251;
smg_comms_skeys_s... 64 SKeys_R_Type : constant Interfaces.Unsigned_8 := 157;
smg_comms_skeys_s... 65 Key_Mgm_R_Type : constant Interfaces.Unsigned_8 := 233;
smg_comms_skeys_s... 66
smg_comms_skeys_s... 67 -- Character action types
smg_comms_skeys_s... 68 Lock_A_Type : constant Interfaces.Unsigned_8 := 0;
smg_comms_skeys_s... 69 Make_A_Type : constant Interfaces.Unsigned_8 := 1;
smg_comms_skeys_s... 70 Explore_A_Type : constant Interfaces.Unsigned_8 := 2;
smg_comms_skeys_s... 71 Exchange_A_Type : constant Interfaces.Unsigned_8 := 3;
smg_comms_skeys_s... 72 Attack_A_Type : constant Interfaces.Unsigned_8 := 4;
smg_comms_skeys_s... 73 Repair_A_Type : constant Interfaces.Unsigned_8 := 5;
smg_comms_skeys_s... 74 Move_A_Type : constant Interfaces.Unsigned_8 := 6;
smg_comms_skeys_s... 75 Train_A_Type : constant Interfaces.Unsigned_8 := 7;
smg_comms_skeys_s... 76
smg_comms_skeys_s... 77 end Messages;