- 32CD2279D2E7501F1C713A414424C1BB37D4C54FD279B14221ED6409431C47F469DCCFFE0B5ED303B1E3B2C77B2D7BB81E7902A4FACD4D96B8E28522A71BB69F+ D6C3980DA332629A8C09CFBFB32E1962AD689C7ECBC4A8EE83B02F85C1AA1A3374C5371EEEE7F0CC49FE4C4D8E758F86FA5BA204C5900BD6F4F95CABB3A06EF6smg_comms/src/messages.ads(57 . 7)(57 . 34)
498 Counter : out Interfaces.Unsigned_16;
499 KMgm : out Keys_Mgm);
500
501 ----------------- File Transfer ----------------------
502
503 -- Writes the given File Chunk to a File Transfer type of message
504 -- Chunk - chunk of file to write; contains counter, filename, content
505 procedure Write_File_Transfer( Chunk : in File_Chunk;
506 Msg : out Raw_Types.Serpent_Msg);
507
508 -- The opposite of Write_File_Transfer method above.
509 -- Chunk will contain the counter, filename and content
510 procedure Read_File_Transfer( Msg : in Raw_Types.Serpent_Msg;
511 Chunk : out File_Chunk);
512
513 ----------------- File Request ----------------------
514 -- Writes a message to request the files specified through their names
515 -- Written parameter will hold the number of filenames actually written
516 -- NB: this can be less than the number of filenames provided!
517 -- When Written < FR.F_No, the FIRST Written filenames were written; the rest
518 -- did not fit into the message and it's up to caller to decide what to do.
519 procedure Write_File_Request( FR : in Filenames;
520 Counter : in Interfaces.Unsigned_16;
521 Msg : out Raw_Types.Serpent_Msg;
522 Written : out Natural);
523
524 -- Reads a request for files; the opposite of Write_File_Request above
525 -- Raises Invalid_Msg exception if the provided message fails checks.
526 procedure Read_File_Request( Msg : in Raw_Types.Serpent_Msg;
527 Counter : out Interfaces.Unsigned_16;
528 FR : out Filenames);
529
530 ------------------
531 -- RSA Messages --
(90 . 12)(117 . 20)
533
534 -- Reads a Key management structure from the given RSA Message
535 -- The opposite of Write_KMgm_SMsg above
536 -- Raises Invalid_Message exception if given message fails sanity checks
537 -- Raises Invalid_Msg exception if given message fails sanity checks
538 procedure Read_KMgm_RMsg( Msg : in Raw_Types.RSA_Msg;
539 Counter : out Interfaces.Unsigned_16;
540 KMgm : out Keys_Mgm);
541
542
543 -- String to Octets conversion
544 -- NB: Str'Length has to be EQUAL to Octets'Length!
545 procedure String_To_Octets(Str: in String; O: out Raw_Types.Octets);
546
547 -- Octets to string conversion
548 -- NB: Str'Length has to be EQUAL to Octets'Length!
549 procedure Octets_To_String(O: in Raw_Types.Octets; Str: out String);
550
551 private
552
553 -- if native is little endian, does nothing;
(103 . 6)(138 . 10)
555 -- (strictly for arrays of octets)
556 procedure Cast_LE( LE: in out Raw_Types.Octets );
557
558 -- separator used for list of filenames
559 F_Sep: constant String := ";"; --as string
560 Sep: constant Interfaces.Unsigned_8 := 16#3B#; -- ascii code
561
562 -- protocol message types IDs, fixed as per protocol specification
563 -- Serpent messages end in "S_Type"
564 -- RSA messages end in "R_Type"
(164 . 4)(203 . 24)
566 Counter : out Interfaces.Unsigned_16;
567 KMgm : out Keys_Mgm);
568
569 -- helper methods to read/write a value on 16 bits (using Cast_LE as needed)
570
571 -- Writing a 16-bits value to the given Octets at specified position.
572 -- NB: Caller has to make sure Pos <= Msg'Last -1 ; NO check here!
573 -- Msg - the array of octets into which the value is to be written
574 -- Pos - the position in Msg at which to write the value;
575 -- NB: Pos will be increased by 2 after the write!
576 -- U16 - the value to write
577 procedure Write_U16( Msg: in out Raw_Types.Octets;
578 Pos: in out Natural;
579 U16: in Interfaces.Unsigned_16);
580
581 -- Reading a 16-bits value from the given Octets at specified position.
582 -- NB: Caller has to make sure Pos <= Msg'Last -1 ; NO check here!
583 -- Pos - the position in Msg from which to read the value;
584 -- NB: Pos will be increased by 2 after the read!
585 -- The opposite of Write_U16 above.
586 procedure Read_U16( Msg: in Raw_Types.Octets;
587 Pos: in out Natural;
588 U16: out Interfaces.Unsigned_16);
589 end Messages;