|
|
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: 5120 (0x1400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Open_Server, seg_0520f6, separate Transport
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Text_Io;
use Text_Io;
with Socket_Misc;
separate (Transport)
procedure Open_Server (Connection : out Transport.Connection_Id;
Status : out Transport_Defs.Status_Code;
Network : in Transport_Defs.Network_Name;
Local_Socket : in Transport_Defs.Socket_Id) is
Laddr_In : 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 (Local_Socket)))),
Sin_Addr => Socket_System_Interface.Inaddr_Any,
Sin_Zero => (others => Ascii.Nul));
Laddrlen : Unix_Base_Types.Int := Laddr_In'Size / System.Storage_Unit;
function To_Unix_Int_Ptr is
new Unchecked_Conversion (Source => System.Address,
Target => Unix_Base_Types.Int_Ptr);
Laddrlen_Ptr : Unix_Base_Types.Int_Ptr :=
To_Unix_Int_Ptr (Laddrlen'Address);
Laddr_In_Ptr : Socket_System_Interface.Sockaddr_In_Ptr :=
To_Sockaddr_In_Ptr (Laddr_In'Address);
New_Connect : Transport.Connection_Id;
Network_Socket : Unix_Base_Types.Int;
System_Call_Result : Unix_Base_Types.Int;
Errno : Unix_Base_Types.Int;
begin
Connection := Null_Connection_Id;
Status := Transport_Defs.Ok;
Start_System_Call;
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);
Errno := Finish_System_Call;
if (Network_Socket < 0) then
Status := Convert_Errno (Errno => Errno);
return;
end if;
Start_System_Call;
System_Call_Result :=
Socket_System_Interface.Bind
(S => Network_Socket, Addr => Laddr_In_Ptr, Addrlen => Laddrlen);
Errno := Finish_System_Call;
if (System_Call_Result < 0) then
Status := Convert_Errno (Errno => Errno);
Start_System_Call;
System_Call_Result := System_Interface.File_Io.Close (Network_Socket);
Errno := Finish_System_Call;
return;
end if;
Start_System_Call;
System_Call_Result :=
Socket_System_Interface.Listen (S => Network_Socket, Backlog => 5);
Errno := Finish_System_Call;
if (System_Call_Result < 0) then
Status := Convert_Errno (Errno => Errno);
Start_System_Call;
System_Call_Result := System_Interface.File_Io.Close (Network_Socket);
Errno := Finish_System_Call;
return;
end if;
-- To reach this point, the Server has been successfully Open, Bound and
-- is Listening. We need to establish a connection_id with the correct
-- information.
New_Connect := Get;
New_Connect.Kind := Server;
New_Connect.Socket_Status := Open;
New_Connect.Local_Socket_Descriptor := Network_Socket;
New_Connect.Tcp_Socket_Descriptor := Unix_Error;
-- New_Connect.Local_Sockaddr_In := Laddr_In;
System_Call_Result := Socket_Misc.Getsockname (Socket => Network_Socket,
Name => Laddr_In_Ptr,
Name_Length => Laddrlen_Ptr);
New_Connect.Local_Sockaddr_In := Laddr_In_Ptr.all;
Put_Line ("transport.open_server: port => " &
Integer'Image (Integer ((Laddr_In_Ptr.Sin_Port))));
-- Tcp_Socket_Descriptor will be set during _accept (Transport.Connect)
Connection := New_Connect;
end Open_Server;
nblk1=4
nid=0
hdr6=8
[0x00] rec0=1b rec1=00 rec2=01 rec3=03e
[0x01] rec0=26 rec1=00 rec2=02 rec3=01c
[0x02] rec0=1c rec1=00 rec2=03 rec3=090
[0x03] rec0=19 rec1=00 rec2=04 rec3=000
tail 0x2154ba67887a05cb7718e 0x42a00088462060003