|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 6360 (0x18d8) Types: TextFile Names: »B«
└─⟦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⟧
WITH Byte_Defs; WITH Net_Info; WITH Transport; WITH Transport_Defs; WITH System_Interface; WITH Socket_System_Interface; WITH System; WITH Text_Io; WITH Unix_Base_Types; WITH Utils; PACKAGE BODY Server IS FUNCTION "=" (Left : Utils.Test_Level; Right : Utils.Test_Level) RETURN Boolean RENAMES Utils."="; FUNCTION "=" (Left : Transport_Defs.Status_Code; Right : Transport_Defs.Status_Code) RETURN Boolean RENAMES Transport_Defs."="; FUNCTION ">" (L, R : Byte_Defs.Byte) RETURN Boolean RENAMES Byte_Defs.">"; FUNCTION "-" (L, R : Byte_Defs.Byte) RETURN Byte_Defs.Byte RENAMES Byte_Defs."-"; FUNCTION Byte_String_To_Integer (Bs : Byte_Defs.Byte_String) RETURN Unix_Base_Types.Int IS Result : Unix_Base_Types.Int := 0; Int_Length : CONSTANT := 4; Normalized_Bs : Byte_Defs.Byte_String (0 .. Int_Length - 1) := (OTHERS => 0); Negative : Boolean := False; Shifter : Integer := 0; BEGIN IF Bs'Length < Int_Length THEN Normalized_Bs ((Normalized_Bs'Last - Bs'Length) + 1 .. Normalized_Bs'Last) := Bs; ELSE Normalized_Bs := Bs ((Bs'Last - Int_Length) + 1 .. Bs'Last); END IF; IF Normalized_Bs (0) > Byte_Defs.Byte (2 ** 7 - 1) THEN Negative := True; END IF; FOR I IN REVERSE Normalized_Bs'Range LOOP IF Negative THEN Normalized_Bs (I) := Byte_Defs.Byte'Last - Normalized_Bs (I); END IF; Result := Result + Integer (Normalized_Bs (I)) * (2 ** Shifter); Shifter := Shifter + 8; END LOOP; IF Negative THEN RETURN -Result - 1; ELSE RETURN Result; END IF; END Byte_String_To_Integer; PROCEDURE Start (Confidence_Level : Utils.Test_Level := Utils.One_Way) IS PACKAGE Log RENAMES Text_Io; Retry_Interval : CONSTANT Duration := 5.0; Transmit_Interval : CONSTANT Duration := 1.0; The_Passive_Connection : Transport.Connection_Id; The_Status : Transport_Defs.Status_Code := Transport_Defs.Disconnected; The_Network : CONSTANT Transport_Defs.Network_Name := Net_Info.Net_Name; The_Local_Socket : CONSTANT Transport_Defs.Socket_Id := Net_Info.Sparc_Socket; Messages_Received : Integer; Laddr_In_Ptr : Socket_System_Interface.Sockaddr_In_Ptr := NEW Socket_System_Interface.Sockaddr_In' (Sin_Family => Socket_System_Interface.Af_Inet, Sin_Port => Unix_Base_Types.Ushort (Byte_String_To_Integer (Byte_Defs.Byte_String (Transport_Defs.Normalize (The_Local_Socket)))), Sin_Addr => Socket_System_Interface.Inaddr_Any, Sin_Zero => (OTHERS => Ascii.Nul)); Laddrlen : Unix_Base_Types.Int := Laddr_In_Ptr.ALL'Size / System.Storage_Unit; Laddr_Ptr : Socket_System_Interface.Sockaddr_Ptr := NEW Socket_System_Interface.Sockaddr; Laddrlen_Ptr : Socket_System_Interface.Int_Ptr := NEW Unix_Base_Types.Int; Network_Socket : Unix_Base_Types.Int; Tcp_Connection : Unix_Base_Types.Int; System_Call_Result : Unix_Base_Types.Int; Length : Unix_Base_Types.Int; Bufsiz : CONSTANT Unix_Base_Types.Int := 1024; Buffer : Socket_System_Interface.Char_Array (0 .. Bufsiz); Buf : Unix_Base_Types.Char_Ptr; BEGIN Buf := Unix_Base_Types.To_Char_Ptr (Buffer (Buffer'First)'Address); Network_Socket := Socket_System_Interface.Socket (Af => Unix_Base_Types.Int (Socket_System_Interface.Af_Inet), Socket_Type => Socket_System_Interface.Sock_Stream, Protocol => 0); IF (Network_Socket < 0) THEN Log.Put_Line (Item => "+++ Socket failed"); RETURN; ELSE Log.Put_Line ("+++ Socket created"); END IF; System_Call_Result := Socket_System_Interface.Bind (S => Network_Socket, Addr => Laddr_In_Ptr, Addrlen => Laddrlen); IF (System_Call_Result < 0) THEN Log.Put_Line (Item => "+++ Bind failed"); RETURN; ELSE Log.Put_Line ("+++ Bind completed."); END IF; System_Call_Result := Socket_System_Interface.Listen (S => Network_Socket, Backlog => 5); LOOP Tcp_Connection := Socket_System_Interface.Saccept (S => Network_Socket, Addr => Laddr_Ptr, Addrlen => Laddrlen_Ptr); IF Tcp_Connection < 0 THEN Log.Put_Line ("*** Server Accept failed."); RETURN; ELSE Log.Put_Line ("+++ Server Accept completed."); END IF; LOOP Length := System_Interface.File_Io.Read (Fildes => Tcp_Connection, Buf => Buf, Nbyte => Bufsiz); IF Length <= 0 THEN Log.Put_Line ("*** Server read failed. Status = " & Integer'Image (Integer (Length))); EXIT; ELSE System_Call_Result := System_Interface.File_Io.Write (Fildes => Tcp_Connection, Buf => Buf, Nbyte => Length); IF System_Call_Result < 0 THEN Log.Put_Line ("*** Server write failed. Result = " & Integer'Image (System_Call_Result)); EXIT; ELSIF System_Call_Result /= Length THEN Log.Put_Line ("++* Server write Length /= Result." & " Bytes written = " & Integer'Image (System_Call_Result)); END IF; END IF; END LOOP; System_Call_Result := System_Interface.File_Io.Close (Fildes => Tcp_Connection); END LOOP; END Start; END Server;