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

⟦4dcb245cb⟧ TextFile

    Length: 6772 (0x1a74)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Host_Name;
with Low_Level_Message;
with Mailbox_Msg_To_Send;
with Mailbox_Received_Msg;
with Physical_Layer;
with Protocol;
with Socket_Defs;
with Socket_Port_Manager;
with Umps_Utilities;
with Text_Io;
--with message_parser;


package body Broker_Link_Layer is

    task body T_Server is

        The_Broker_Listen_Socket_Port            : Socket_Port.Object;
        The_Broker_Host_Name                     : Host_Name.Object;  
        The_Broker_Listen_Socket_Id              : Socket_Defs.Socket_Id;
        The_Task_Performing_Mailbox_Received_Msg :
           Mailbox_Received_Msg.Access_Task_Mailbox;

    begin

        accept Start (Broker_Listen_Socket_Port            : Socket_Port.Object;  
                      Task_Performing_Mailbox_Received_Msg :
                         Mailbox_Received_Msg.Access_Task_Mailbox) do

            Text_Io.Put ("(Broker_Link_Layer).Server : Start.");

            The_Broker_Listen_Socket_Port := Broker_Listen_Socket_Port;

            The_Task_Performing_Mailbox_Received_Msg :=
               Task_Performing_Mailbox_Received_Msg;

            -- Init of the allocator number :
            Socket_Port_Manager.Init_Number;

            The_Broker_Listen_Socket_Id := Physical_Layer.Create_Server
                                              (The_Broker_Listen_Socket_Port);

            Text_Io.Put ("(Broker_Link_Layer).Server : End start.");


        end Start;

        declare

            The_Broker_Service_Socket_Id      : Socket_Defs.Socket_Id;
            The_Buffer_To_Receive             : Low_Level_Message.Object;
            The_Number_Of_Caracteres_Received : Integer;
            Result                            : Boolean;

        begin
            loop

                -- Connection to get a message :

                Text_Io.Put
                   ("(Broker_Link_Layer).Server : Wait for a connection ... ");

                The_Broker_Service_Socket_Id :=
                   Physical_Layer.Server_Wait_For_A_Connection
                      (The_Broker_Listen_Socket_Id);

                Text_Io.Put_Line ("(Broker_Link_Layer).Server :  I got it !");

                Physical_Layer.Receive_String
                   (The_Broker_Service_Socket_Id, The_Buffer_To_Receive,
                    The_Number_Of_Caracteres_Received);

                Text_Io.Put_Line (The_Buffer_To_Receive.The_String
                                     (1 .. The_Number_Of_Caracteres_Received));

                -- Examine the message to intercept a Behavior creation asking :

                if Protocol.Is_A_Kind_Of (The_Buffer_To_Receive) then
                    Text_Io.Put_Line
                       ("(Broker_Link_Layer).Server : it s a protocol message...");
                    if Protocol.Is_A_Request_For_A_Behavior_Socket_Port
                          (The_Buffer_To_Receive) then
                              Text_Io.Put_Line
                                 ("(Broker_Link_Layer).Server : it s a request for a behavior port number.");
                              Protocol.Give_A_Behavior_Socket_Port
                                 (The_Broker_Service_Socket_Id,
                                  The_Buffer_To_Receive);  
                    else
                              Text_Io.Put_Line
                                 ("(Broker_Link_Layer).Server : it s an unknown message !");
                    end if;
                else

                    -- Normal process : send the message to the received_message_fifo :
                    Text_Io.Put_Line
                       ("(Broker_Link_Layer).Server : it s a normal message.");

                    The_Task_Performing_Mailbox_Received_Msg.Put
                       (The_Buffer_To_Receive, Result);
                    if Result = False then
                              Text_Io.Put_Line  
                                 ("(Broker_Link_Layer).Server : Putting message into received messages fifo is impossible");
                    end if;

                end if;

                Physical_Layer.Close_Socket (The_Broker_Service_Socket_Id);

            end loop;
        end;


    end T_Server;





    task body T_Client is

        The_Task_Performing_Mailbox_Msg_To_Send :
           Mailbox_Msg_To_Send.Access_Task_Mailbox;
        The_Msg                                 : Low_Level_Message.Object;
        Result                                  : Boolean := False;
        Service_Socket_Id                       : Socket_Defs.Socket_Id;
        Number_Of_Characters_Sent               : Integer;
        The_Behavior_Socket_Port                : Socket_Port.Object;
        The_Behavior_Host_Name                  : Host_Name.Object;

    begin

        accept Start (Task_Performing_Mailbox_Msg_To_Send :
                         Mailbox_Msg_To_Send.Access_Task_Mailbox) do

            The_Task_Performing_Mailbox_Msg_To_Send :=
               Task_Performing_Mailbox_Msg_To_Send;

        end Start;

        loop
            select      -- Active wait ....

                The_Task_Performing_Mailbox_Msg_To_Send.Get (The_Msg, Result);
                if Result = True then

                    --Look for the Behavior socket port : it lies in the fourth field of the message :


-------------
-- Ne sait pas si cette fonction marche.
-------------

                    -- The_Behavior_Socket_Port :=
                    --    Message_Parser.Get_Handler (The_Msg.The_String);
                    --



                    -- Look for the Behavior host name :

                    Socket_Port_Manager.Show_Value
                       (The_Behavior_Socket_Port,
                        The_Behavior_Host_Name, Result);

                    if Result = False then
                              Text_Io.Put_Line  
                                 ("Broker_Link_Layer.Client : Getting Handler host-name from messages is impossible");  
                    else

                              Service_Socket_Id :=
                                 Physical_Layer.Join_Server
                                    (The_Behavior_Host_Name,
                                     The_Behavior_Socket_Port);

                              if Service_Socket_Id < 0 then
                              raise Socket_Defs.Join_Server_Error;
                              end if;

                              Physical_Layer.Send_String
                                 (Service_Socket_Id, The_Msg,
                                  Number_Of_Characters_Sent);
                              Physical_Layer.Close_Socket (Service_Socket_Id);
                    end if;

                end if;
            else
                null;
            end select;
        end loop;
    end T_Client;


end Broker_Link_Layer;