DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦5792f9d5b⟧ Ada Source

    Length: 13312 (0x3400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Broker_Work, seg_04bcbe

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Memo_Stream;
with Transport_Defs;
with Transport;
with Database;
with Identifier;
with Message_New;
with Message_Transport;
with Method;
with Text_Io;
with Memory;


use Text_Io;
package body Broker_Work is

    Quiet : Boolean := True;  
    T : Memory.File;
    Count : Natural := 0;


    procedure Process_Message (S : Message_Transport.Stream_Id; M : String);

    procedure Log (Item : String) is
    begin
        if not Quiet then
            Text_Io.Put_Line (Item);
        end if;
    end Log;

    procedure Register (Host : String;
                        Socket : Message_Transport.Socket;
                        Stream : out Message_Transport.Stream_Id);

    task Rx is
        entry Start;
    end Rx;

    function Stub (M : String) return Boolean is
    begin
        return True;
    end Stub;

    procedure Stub is
    begin
        null;
    end Stub;


    procedure Transport_Start is
       new Message_Transport.Start_Server (Register_Service => Register,
                                           Service_Identified => Stub,
                                           Ready_To_Receive => Stub,
                                           Receive_Callback => Process_Message);


    task body Rx is
    begin
        accept Start;
        Text_Io.Put_Line (" INITIALISATION MEMO STREAM ");
        Memo_Stream.Tx.Init;
        Text_Io.Put_Line ("Broker_Work Transport_Start");
        Transport_Start (Local_Socket =>
                            Identifier.Get_Socket (Id => Identifier.Broker),
                         Buffer_Size => 1024,
                         Wait_For_Identification => False);
    end Rx;


    procedure Start (Quiet : Boolean := True) is
    begin

        Text_Io.Put_Line ("Broker_Work Start");
        Broker_Work.Quiet := Quiet;
        Text_Io.Put_Line ("Broker_Work Memory.Init");
        Memory.Init (T);  
        Text_Io.Put_Line ("Broker_Work Rx.Start");
        Rx.Start;
    end Start;


    procedure Register (Host : String;
                        Socket : Message_Transport.Socket;
                        Stream : out Message_Transport.Stream_Id) is
    begin  
        Text_Io.Put_Line ("+++ STARTING BROKER");
        Text_Io.Put_Line ("--- HOST => " & Host);
        Text_Io.Put_Line ("--- SOCKET => " &
                          Integer'Image (Integer ((Socket))));
--        Text_Io.Put_Line ("---STREAM =>" &
        --                         Natural'Image (Message_Transport.Hash (Stream)));

        --      Text_Io.Put_Line
        --         ("LOCAL_SOCKET = " &
        --          Natural'Image
        --             (Transport_Defs.Hash
        --                 (Transport.Local_Socket
        --                    (Message_Transport.Identifie_Connection (Stream)))));


        --     Text_Io.Put_Line
        --        ("REMOTE_SOCKET = " &
        --         Natural'Image
        --            (Transport_Defs.Hash
        --                (Transport.Remote_Socket
        --                    (Message_Transport.Identifie_Connection (Stream)))));


    end Register;


    procedure Stale (Behavior : Natural) is
    begin
        --[prototype: This simply removes the behavior]
        Database.Expunge (Behavior);
        Identifier.Unregister (Id => Identifier.Value (Behavior));
    end Stale;


    procedure Registration (M : Message_New.Object;
                            S : Message_Transport.Stream_Id) is separate;

    procedure Unregistration (M : in out Message_New.Object;
                              S : Message_Transport.Stream_Id) is separate;

    procedure Query (M : Message_New.Object) is separate;

    procedure Request (M : Message_New.Object;
                       S : Message_Transport.Stream_Id;
                       Save : in out Memory.File) is separate;

    procedure Notification (M : Message_New.Object;
                            S : Message_Transport.Stream_Id) is separate;

    procedure Forward (M : Message_New.Object;
                       S : Message_Transport.Stream_Id;
                       Save : in out Memory.File) is separate;

    procedure Publication (M : Message_New.Object) is separate;

    procedure Unpublication (M : Message_New.Object) is separate;

    procedure Subscription (M : Message_New.Object) is separate;

    procedure Unsubscription (M : Message_New.Object) is separate;

    procedure Failure (M : Message_New.Object) is separate;


    procedure Process_Message (  
                               S : Message_Transport.Stream_Id;
                               M : String) is  
        use Message_New;
        The_Found, The_Found_1 : Message_Transport.Stream_Id;
        Mes : Message_New.Object;  
        Iter : Transport.Connection_Id_Iterator;
        Found : Boolean := False;
        Connection : Transport.Connection_Id;
        Connection_Natural : Natural;
    begin
        Text_Io.Put_Line (" ENTREE BROKER PROCESS MESSAGE");
        Text_Io.Put_Line (M);  
        Text_Io.Put_Line ("STREAM = " &
                          Natural'Image (Message_Transport.Hash (S)));


        Text_Io.Put_Line
           ("LOCAL_SOCKET = " &
            Natural'Image
               (Transport_Defs.Hash
                   (Transport.Local_Socket
                       (Message_Transport.Identifie_Connection (S)))));


        Text_Io.Put_Line
           ("REMOTE_SOCKET = " &
            Natural'Image
               (Transport_Defs.Hash
                   (Transport.Remote_Socket
                       (Message_Transport.Identifie_Connection (S)))));

        Transport.Init (Iter);  
        Text_Io.Put_Line (" INITIALISATION DE L'ITERATEUR ");

        while not Transport.Done (Iter) and not Found loop  
            Connection := Transport.Value (Iter);
            Connection_Natural := Transport_Defs.Hash
                                     (Transport.Local_Socket (Connection));

            Text_Io.Put_Line (" CONNECTION => " &
                              Natural'Image (Connection_Natural));

            if Connection_Natural =
               Transport_Defs.Hash
                  (Transport.Remote_Socket
                      (Message_Transport.Identifie_Connection (S))) then
                Found := True;
                Text_Io.Put_Line ("SOCKET FOUND => " &
                                  Natural'Image (Connection_Natural));
                The_Found_1 := Message_Transport.Create (Connection);  
                Put_Line ("+++ STR FOUND 1 => " &
                          Natural'Image (Message_Transport.Hash (The_Found_1)));

            end if;
            Transport.Next (Iter);
        end loop;

        Mes := Message_New.Value (M);
        Text_Io.Put_Line ("CREATION MESSAGE => METHODE ");
        Text_Io.Put_Line (Method.Image (Message_New.Get_Method (Mes)));
        Text_Io.Put_Line ("BROKER SENDER = " &
                          Natural'Image (Message_New.Get_Sender (Mes)));

        Put_Line ("+++ STR FOUND => " &
                  Natural'Image (Message_Transport.Hash (The_Found_1)));


        case Message_New.Get_Class (Mes) is
            when Registration =>
                Registration (Mes, The_Found_1);
            when Unregistration =>
                Unregistration (Mes, The_Found_1);
            when Message_New.Query =>
                Query (Mes);
            when Message_New.Request =>
                Text_Io.Put_Line (" BROKER REQUEST ");
                Request (Mes, The_Found_1, T);
            when Message_New.Notification =>
                Notification (Mes, The_Found_1);
            when Message_New.Forward =>
                Forward (Mes, The_Found_1, T);
            when Message_New.Publication =>
                Publication (Mes);
            when Message_New.Unpublication =>
                Unpublication (Mes);
            when Message_New.Subscription =>
                Subscription (Mes);
            when Message_New.Unsubscription =>
                Unsubscription (Mes);  
            when Message_New.Failure =>
                Failure (Mes);
        end case;
    end Process_Message;

end Broker_Work;

E3 Meta Data

    nblk1=c
    nid=9
    hdr6=16
        [0x00] rec0=32 rec1=00 rec2=01 rec3=040
        [0x01] rec0=01 rec1=00 rec2=08 rec3=008
        [0x02] rec0=1a rec1=00 rec2=0a rec3=018
        [0x03] rec0=1a rec1=00 rec2=06 rec3=01a
        [0x04] rec0=1d rec1=00 rec2=05 rec3=01c
        [0x05] rec0=01 rec1=00 rec2=0c rec3=07a
        [0x06] rec0=1c rec1=00 rec2=03 rec3=00c
        [0x07] rec0=1b rec1=00 rec2=02 rec3=03a
        [0x08] rec0=17 rec1=00 rec2=04 rec3=01c
        [0x09] rec0=18 rec1=00 rec2=0b rec3=028
        [0x0a] rec0=0b rec1=00 rec2=07 rec3=000
        [0x0b] rec0=32 rec1=80 rec2=00 rec3=000
    tail 0x215490748868a4383518b 0x42a00088462060003
Free Block Chain:
  0x9: 0000  00 00 00 04 80 01 20 01 70 6f 72 74 2e 52 65 6d  ┆        port.Rem┆