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: ┃ T V

⟦bb667ebce⟧ TextFile

    Length: 6121 (0x17e9)
    Types: TextFile
    Names: »V«

Derivation

└─⟦bad92a95e⟧ Bits:30000535 8mm tape, Rational 1000, RPC 1_0_2
    └─ ⟦bb34fe6e2⟧ »DATA« 
        └─⟦15d8b76c6⟧ 
            └─⟦this⟧ 

TextFile

with System;
with Unchecked_Conversion;
with Unix_Base_Types;
package Socket_System_Interface is

    Sock_Stream : constant Unix_Base_Types.Int := 1;
    Af_Inet : constant Unix_Base_Types.Short := 2;
    Inaddr_Any : constant Unix_Base_Types.U_Long := 0;


    type Char_Array is array (Natural range <>) of Character;
    type Sockaddr_In is
        record
            Sin_Family : Unix_Base_Types.Short;
            Sin_Port : Unix_Base_Types.Ushort;
            Sin_Addr : Unix_Base_Types.U_Long;
            Sin_Zero : Char_Array (1 .. 8) := (others => Ascii.Nul);
        end record;

    for Sockaddr_In use
        record
            Sin_Family at 0 range 0 .. 15;
            Sin_Port at 2 range 0 .. 15;
            Sin_Addr at 4 range 0 .. 31;
            Sin_Zero at 8 range 0 .. 63;
        end record;

    type Sockaddr is
        record
            Sa_Family : Unix_Base_Types.Short;
            Sa_Data : Char_Array (1 .. 14);
        end record;

    for Sockaddr use
        record
            Sa_Family at 0 range 0 .. 15;
            Sa_Data at 2 range 0 .. 111;
        end record;

    type Sockaddr_Ptr is access Sockaddr;
    function To_Sockaddr_Ptr is new Unchecked_Conversion
                                       (System.Address, Sockaddr_Ptr);

    type Char_Ptr_Array is array (Natural range <>) of Unix_Base_Types.Char_Ptr;

    type Char_Ptr_Ptr is access Char_Ptr_Array;

    type Hostent is
        record
            H_Name : Unix_Base_Types.Char_Ptr;
            H_Aliases : Char_Ptr_Ptr;
            H_Addrtype : Unix_Base_Types.Int;
            H_Length : Unix_Base_Types.Int;
            H_Addr_List : Char_Ptr_Ptr;
        end record;

    for Hostent use
        record
            H_Name at 0 range 0 .. 31;
            H_Aliases at 4 range 0 .. 31;
            H_Addrtype at 8 range 0 .. 31;
            H_Length at 12 range 0 .. 31;
            H_Addr_List at 16 range 0 .. 31;
        end record;

    type Hostent_Ptr is access Hostent;

    function Saccept (S : Unix_Base_Types.Int;
                      Addr : in Sockaddr_Ptr;
                      Addrlen : in Unix_Base_Types.Int_Ptr)
                     return Unix_Base_Types.Int;
    pragma Interface (C, Saccept);
    pragma Import_Function
       (Internal => Saccept,
        External => "_accept",
        Parameter_Types => (Unix_Base_Types.Int, Sockaddr_Ptr,
                            Unix_Base_Types.Int_Ptr),
        Result_Type => Unix_Base_Types.Int,
        Mechanism => (Value, Reference, Reference));
    pragma Interface_Name (Saccept, "accept");


    function Bind (S : Unix_Base_Types.Int;
                   Addr : in Sockaddr_In;
                   Addrlen : Unix_Base_Types.Int) return Unix_Base_Types.Int;
    pragma Interface (C, Bind);
    pragma Import_Function
       (Internal => Bind,
        External => "_bind",
        Parameter_Types =>
           (Unix_Base_Types.Int, Sockaddr_In, Unix_Base_Types.Int),
        Result_Type => Unix_Base_Types.Int,
        Mechanism => (Value, Reference, Value));

    function Listen (S : Unix_Base_Types.Int; Backlog : Unix_Base_Types.Int)
                    return Unix_Base_Types.Int;
    pragma Interface (C, Listen);
    pragma Import_Function
       (Internal => Listen,
        External => "_listen",
        Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Int),
        Result_Type => Unix_Base_Types.Int,
        Mechanism => (Value, Value));

    function Socket (Af : Unix_Base_Types.Int;
                     Socket_Type : Unix_Base_Types.Int;
                     Protocol : Unix_Base_Types.Int) return Unix_Base_Types.Int;
    pragma Interface (C, Socket);
    pragma Import_Function
       (Internal => Socket,
        External => "_socket",
        Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Int,
                            Unix_Base_Types.Int),
        Result_Type => Unix_Base_Types.Int,
        Mechanism => (Value, Value, Value));

    function Connect (S : Unix_Base_Types.Int;
                      Addr : Sockaddr_In;
                      Addrlen : Unix_Base_Types.Int) return Unix_Base_Types.Int;
    pragma Interface (C, Connect);
    pragma Import_Function
       (Internal => Connect,
        External => "_connect",
        Parameter_Types => (Unix_Base_Types.Int, Sockaddr_In,
                            Unix_Base_Types.Int),
        Result_Type => Unix_Base_Types.Int,
        Mechanism => (Value, Reference, Value));


    function Gethostbyname (Host : Unix_Base_Types.Char_Ptr) return Hostent_Ptr;
    pragma Interface (C, Gethostbyname);
    pragma Import_Function (Internal => Gethostbyname,
                            External => "_gethostbyname",
                            Parameter_Types => (Unix_Base_Types.Char_Ptr),
                            Result_Type => Hostent_Ptr,
                            Mechanism => Value);
    pragma Interface_Name (Gethostbyname, "gethostbyname");



    function Shutdown (S : Unix_Base_Types.Int; How : Unix_Base_Types.Int)
                      return Unix_Base_Types.Int;
    pragma Interface (C, Shutdown);
    pragma Import_Function
       (Internal => Shutdown,
        External => "_shutdown",
        Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Int),
        Result_Type => Unix_Base_Types.Int,
        Mechanism => (Value, Value));
    function Setsockopt (S : Unix_Base_Types.Int;
                         Level : Unix_Base_Types.Int;
                         Optname : Unix_Base_Types.Int;
                         Optval : Unix_Base_Types.Char_Ptr;
                         Optlen : Unix_Base_Types.Int)
                        return Unix_Base_Types.Int;
    pragma Interface (C, Setsockopt);
    pragma Import_Function
       (Internal => Setsockopt,
        External => "_setsockopt",
        Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Int,
                            Unix_Base_Types.Int, Unix_Base_Types.Char_Ptr,
                            Unix_Base_Types.Int),
        Result_Type => Unix_Base_Types.Int,
        Mechanism => (Value, Value, Value, Value, Value));
end Socket_System_Interface;