PreviousUpNext

15.3.535  src/lib/std/src/socket/internet-socket–premicrothread.api

## internet-socket--premicrothread.api

# Compiled by:
#     src/lib/std/src/standard-core.sublib



###                   "Beauty? What's that?"
###
###                        -- Larry Wall


stipulate
    package dhl =  dns_host_lookup;                                                         # dns_host_lookup                   is from   src/lib/std/src/socket/dns-host-lookup.pkg
    package ps  =  proto_socket__premicrothread;                                            # proto_socket__premicrothread      is from   src/lib/std/src/socket/proto-socket--premicrothread.pkg
herein

    # This api is implemented in:
    #
    #     src/lib/std/src/socket/internet-socket--premicrothread.pkg
    #
    api Internet_Socket__Premicrothread {
        #
        Inet;

        Socket( A_sock_type )
            =
            ps::Socket( Inet, A_sock_type );

        Stream_Socket( A_mode )
            =
            Socket( ps::Stream( A_mode ) );

        Datagram_Socket
            =
            Socket( ps::Datagram );

        Socket_Address
            =
            ps::Socket_Address( Inet );

        inet_af:  ps::af::Address_Family;                               # DARPA internet protocols 

        to_address
            :
            ( dhl::Internet_Address,
              Int
            )
            ->
            Socket_Address;

        from_address
            :
            Socket_Address
            ->
            ( dhl::Internet_Address,
              Int
            );


        any:   Int -> Socket_Address;

        package udp:  api { make_socket:   Void -> Datagram_Socket;
                            make_socket':  Int  -> Datagram_Socket;
                          };

        package tcp:  api { make_socket:   Void -> Stream_Socket( A_mode );
                            make_socket' : Int  -> Stream_Socket( A_mode );

                            # TCP control options:
                            # 
                            get_nodelay:    Stream_Socket( A_mode ) -> Bool;
                            set_nodelay:   (Stream_Socket( A_mode ), Bool) -> Void;
                          };

        to_string: Socket(X) -> String;                         # For debug printouts etc.

        set_printif_fd: Int -> Void;                            # Enable C-level socket I/O debug print_ifs to given fd -- see src/c/lib/socket/setprintiffd.c


        #######################################################################
        # Below stuff is intended only for one-time use during
        # booting, to switch from direct to indirect syscalls:                  # For background see Note[1]            in   src/lib/std/src/unsafe/mythryl-callable-c-library-interface.pkg

             to_inet_addr__syscall:    (ps::Internet_Address, Int) ->  ps::Internet_Address;
        set__to_inet_addr__ref:      ({ lib_name: String, fun_name: String, io_call: ((ps::Internet_Address, Int) ->  ps::Internet_Address) } -> ((ps::Internet_Address, Int) ->  ps::Internet_Address)) -> Void;

             from_inet_addr__syscall:   ps::Internet_Address       -> (ps::Internet_Address, Int);
        set__from_inet_addr__ref:     ({ lib_name: String, fun_name: String, io_call: (ps::Internet_Address       -> (ps::Internet_Address, Int)) } -> (ps::Internet_Address       -> (ps::Internet_Address, Int))) -> Void;

             inet_any__syscall:         Int                        ->  ps::Internet_Address;
        set__inet_any__ref:           ({ lib_name: String, fun_name: String, io_call: (Int                        ->  ps::Internet_Address) } -> (Int                        ->  ps::Internet_Address)) -> Void;

             ctl_delay__syscall:        (Int, Null_Or(Bool)) -> Bool;
        set__ctl_delay__ref:          ({ lib_name: String, fun_name: String, io_call: ((Int, Null_Or(Bool)) -> Bool) } -> ((Int, Null_Or(Bool)) -> Bool)) -> Void;

             set_printif_fd__syscall:    Int -> Void;
        set__set_printif_fd__ref:      ({ lib_name: String, fun_name: String, io_call: (Int -> Void ) } -> (Int -> Void)) -> Void;
    };
end;

## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext