|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 15360 (0x3c00) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Protocol, seg_026d1b
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with My_String; with Physical_Layer; with Socket_Defs; with Socket_Port; with Socket_Port_Manager; with Text_Io; package body Protocol is Protocol_Header : constant String := "Protocol"; Request_For_A_Behavior_Socket_Port : constant String := Protocol_Header & "Give me a socket port"; -- TO CHANGE : KEEP AWAY THE PORT NUMBER ! Response_Of_A_Request_For_A_Behavior_Socket_Port : constant String := Protocol_Header & "This is your socket port : "; function Is_A_Kind_Of (The_Message : My_String.Object) return Boolean is begin if The_Message.The_String (1 .. Protocol_Header'Length) = Protocol_Header then return True; else return False; end if; end Is_A_Kind_Of; function Is_A_Request_For_A_Behavior_Socket_Port (The_Message : My_String.Object) return Boolean is begin if The_Message.The_String (1 .. Request_For_A_Behavior_Socket_Port'Length) = Request_For_A_Behavior_Socket_Port then return True; else return False; end if; end Is_A_Request_For_A_Behavior_Socket_Port; function Ask_A_Behavior_Socket_Port (The_Broker_Socket_Id : Socket_Defs.Socket_Id) return Socket_Port.Object is The_Local_Host_Name : My_String.Object; The_Number_Of_Characters_Sent : Integer; The_Number_Of_Characters_Received : Integer; The_Request : My_String.Object; The_Response : My_String.Object; The_Result : Socket_Port.Object; begin Physical_Layer.Get_Host_Name (The_Local_Host_Name); The_Request := My_String.Object' (The_Size => Request_For_A_Behavior_Socket_Port'Length + The_Local_Host_Name.The_Size, The_String => (others => ' ')); The_Request.The_String := Request_For_A_Behavior_Socket_Port & The_Local_Host_Name.The_String; Physical_Layer.Send_String (The_Broker_Socket_Id, The_Request, The_Number_Of_Characters_Sent); Text_Io.Put ("Protocol : Request message sent ... "); Physical_Layer.Receive_String (The_Broker_Socket_Id, The_Response, The_Number_Of_Characters_Received); Text_Io.Put_Line ("Protocol : Response message received: " & The_Response.The_String); if The_Response.The_String (1 .. Response_Of_A_Request_For_A_Behavior_Socket_Port'Length) /= Response_Of_A_Request_For_A_Behavior_Socket_Port then Text_Io.Put_Line ("Umps_Message.Init : Reception error"); raise Socket_Defs.Create_Behavior_Error; else The_Result := Socket_Port.Create (Natural'Value (The_Response.The_String (Response_Of_A_Request_For_A_Behavior_Socket_Port' Length + 1 .. The_Response.The_Size))); end if; return The_Result; end Ask_A_Behavior_Socket_Port; procedure Give_A_Behavior_Socket_Port (The_Broker_Socket_Id : Socket_Defs.Socket_Id; The_Buffer_Received : My_String.Object) is The_Behavior_Host_Name : My_String.Object; The_Allocated_Behavior_Port : Socket_Port.Object; The_Allocated_Behavior_Port_In_String : My_String.Object; The_Buffer_To_Send_Back : My_String.Object; Number_Of_Caracteres_Sent_Back : Integer; Result : Boolean; begin Text_Io.Put_Line ("Protocol : A behavior asked for a Behavior_Number."); -- The_Behavior_Host_Name := My_String.Object' -- (The_Size => Socket_Defs.Host_Name_Length, -- The_String => (others => ' ')); -- The_Behavior_Host_Name.The_String := -- The_Buffer_Received.The_String -- (Request_For_A_Behavior_Socket_Port'Length + 1 .. -- Request_For_A_Behavior_Socket_Port'Length + -- Socket_Defs.Host_Name_Length); -- -- Text_Io.Put ("Protocol : Choose a Behavior port number => "); -- Socket_Port_Manager.Allocate (The_Behavior_Host_Name, -- The_Allocated_Behavior_Port, Result); -- The_Allocated_Behavior_Port := Socket_Port.Create (5110); Result := True; Text_Io.Put_Line ("-->" & Socket_Port.Image (The_Allocated_Behavior_Port)); The_Buffer_To_Send_Back := My_String.Object' (The_Size => Response_Of_A_Request_For_A_Behavior_Socket_Port'Length, The_String => (others => ' ')); The_Buffer_To_Send_Back.The_String := Response_Of_A_Request_For_A_Behavior_Socket_Port; if Result = False then -- The_Allocated_Behavior_Port_In_String := Socket_Port.Undefined; -- The_Buffer_To_Send_Back := -- My_String."&" (The_Buffer_To_Send_Back, -- The_Allocated_Behavior_Port_In_String); -- Text_Io.Put_Line ("Protocol : allocate a new behavior number is impossible"); else The_Allocated_Behavior_Port_In_String := Socket_Port.Image (The_Allocated_Behavior_Port); The_Buffer_To_Send_Back := My_String."&" (The_Buffer_To_Send_Back, The_Allocated_Behavior_Port_In_String); end if; Text_Io.Put ("Protocol : Send the response ..."); Physical_Layer.Send_String (The_Broker_Socket_Id, The_Buffer_To_Send_Back, Number_Of_Caracteres_Sent_Back); Text_Io.Put_Line ("OK"); end Give_A_Behavior_Socket_Port; -- procedure Give_A_Behavior_Socket_Port -- (The_Broker_Socket_Id : Socket_Defs.Socket_Id; -- The_Buffer_Received : My_String.Object) is -- -- The_Behavior_Host_Name : My_String.Object; -- The_Allocated_Behavior_Port : Socket_Port.Object; -- The_Allocated_Behavior_Port_In_String : My_String.Object; -- The_Buffer_To_Send_Back : My_String.Object; -- Number_Of_Caracteres_Sent_Back : Integer; -- Result : Boolean; -- -- begin -- -- Text_Io.Put_Line ("Protocol : A behavior asked for a Behavior_Number."); -- -- Text_Io.Put_Line ("buf : " & The_Buffer_Received.The_String -- (1 .. The_Buffer_Received.The_Size)); -- -- The_Behavior_Host_Name := My_String.Object' -- (The_Size => 9, The_String => "belladone"); -- -- -- Text_Io.Put ("Protocol : Choose a Behavior port number => "); -- -- Socket_Port_Manager.Allocate (The_Behavior_Host_Name, -- The_Allocated_Behavior_Port, Result); -- -- Text_Io.Put_Line ("-->" & Socket_Port.Image -- (The_Allocated_Behavior_Port)); -- -- -- -- -- The_Behavior_Host_Name := -- -- My_String.Object' -- -- (The_Size => The_Buffer_Received.The_Size - -- -- Request_For_A_Behavior_Socket_Port'Length, -- -- The_String => The_Buffer_Received.The_String -- -- (The_Buffer_Received.The_String'First + -- -- Request_For_A_Behavior_Socket_Port'Length .. -- -- The_Buffer_Received.The_String'Last)); -- -- -- -- The_Allocated_Behavior_Port_In_String := Socket_Port.Undefined; -- -- -- -- The_Buffer_To_Send_Back := -- -- My_String."&" (The_Buffer_To_Send_Back, -- -- The_Allocated_Behavior_Port_In_String); -- -- Text_Io.Put ("Protocol : Send the response ..."); -- -- Physical_Layer.Send_String -- (The_Broker_Socket_Id, The_Buffer_To_Send_Back, -- Number_Of_Caracteres_Sent_Back); -- -- Text_Io.Put_Line ("OK"); -- -- end Give_A_Behavior_Socket_Port; -- -- -- end Protocol;
nblk1=e nid=2 hdr6=18 [0x00] rec0=2b rec1=00 rec2=01 rec3=008 [0x01] rec0=01 rec1=00 rec2=03 rec3=052 [0x02] rec0=1f rec1=00 rec2=06 rec3=050 [0x03] rec0=16 rec1=00 rec2=0b rec3=046 [0x04] rec0=1d rec1=00 rec2=07 rec3=00c [0x05] rec0=04 rec1=00 rec2=0d rec3=064 [0x06] rec0=18 rec1=00 rec2=0a rec3=012 [0x07] rec0=1b rec1=00 rec2=0c rec3=064 [0x08] rec0=1d rec1=00 rec2=05 rec3=002 [0x09] rec0=19 rec1=00 rec2=04 rec3=024 [0x0a] rec0=17 rec1=00 rec2=09 rec3=006 [0x0b] rec0=03 rec1=00 rec2=08 rec3=000 [0x0c] rec0=07 rec1=00 rec2=05 rec3=000 [0x0d] rec0=0f rec1=00 rec2=07 rec3=000 tail 0x21720f85883aa5b634384 0x42a0008846207f403 Free Block Chain: 0x2: 0000 00 0e 00 2c 80 29 20 20 20 20 20 20 20 20 20 2d ┆ , ) -┆ 0xe: 0000 00 00 00 0c 80 09 6f 5f 53 65 6e 64 5f 42 61 09 ┆ o_Send_Ba ┆