DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦b8a9c91b3⟧ TextFile

    Length: 4219 (0x107b)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Database;
with Identifier;
with Message;
with Message_Transport;
with Method;
with Text_Io;

use Text_Io;
package body Broker is

    Quiet : Boolean := True;

    procedure Process_Message (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);

    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);


    procedure Send_Message (Message : Standard.Message.Object;
                            Status : out Message_Transport.Status_Code) is
        Id : Identifier.Object := Identifier.Value
                                     (Standard.Message.Get_Addressee (Message));
        use Standard.Message;
    begin
        Message_Transport.Put (Message => Standard.Message.Image (Message),
                               Remote_Host => Identifier.Get_Host (Id),
                               Remote_Socket => Identifier.Get_Socket (Id),
                               Number_Of_Retry => 10,
                               Retry_Delay => 0.1,
                               Status => Status);
    end Send_Message;


    task body Rx is
    begin
        accept 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  
        Broker.Quiet := Quiet;
        Rx.Start;
    end Start;


    procedure Register (Host : String; Socket : Message_Transport.Socket) is
    begin  
        Text_Io.Put_Line ("+++ starting broker");
        Text_Io.Put_Line ("--- Host => " & Host);
        Text_Io.Put_Line ("--- socket => " &
                          Integer'Image (Integer ((Socket))));
    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.Object) is separate;

    procedure Unregistration (M : in out Message.Object) is separate;

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

    procedure Request (M : Message.Object) is separate;

    procedure Notification (M : Message.Object) is separate;

    procedure Forward (M : Message.Object) is separate;

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

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

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

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


    procedure Process_Message (M : String) is
        use Message;

        Mes : Message.Object;
    begin
        Mes := Message.Value (M);
        case Message.Get_Class (Mes) is
            when Registration =>
                Registration (Mes);
            when Unregistration =>
                Unregistration (Mes);
            when Message.Query =>
                Query (Mes);
            when Message.Request =>
                Request (Mes);
            when Message.Notification =>
                Notification (Mes);
            when Message.Forward =>
                Forward (Mes);
            when Message.Publication =>
                Publication (Mes);
            when Message.Unpublication =>
                Unpublication (Mes);
            when Message.Subscription =>
                Subscription (Mes);
            when Message.Unsubscription =>
                Unsubscription (Mes);
        end case;
    end Process_Message;

end Broker;