PreviousUpNext

15.3.540  src/lib/std/src/socket/plain-socket–premicrothread.api

## plain-socket--premicrothread.api

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



###                "Probably the glaring error in Unix was that
###                 it undervalued the concept of remoteness."
###
###                                          -- Ken Thompson



stipulate
    package ps  =  proto_socket__premicrothread;                                # proto_socket__premicrothread  is from   src/lib/std/src/socket/proto-socket--premicrothread.pkg
    package sg  =  socket_guts;                                                 # socket_guts                   is from   src/lib/std/src/socket/socket-guts.pkg
herein

    # This api is implemented in:
    #
    #     src/lib/std/src/socket/plain-socket--premicrothread.pkg
    #     src/lib/std/src/socket/win32-plain-socket.pkg
    #
    api Plain_Socket__Premicrothread {
        #
#       addressFamilies:  Void -> List( sg::af::addr_family )
            #
            # Returns a list of the supported address families; this should include
            # at least:  sg::af::inet.

#       socketTypes:  Void -> sg::SOK::sock_type
            #
            # Returns a list of the supported socket types; this should include at
            # least:  sg::SOCKET::stream and sg::SOCKET::dgram.


        # Create socket/pair using default protocol: 
        #
        make_socket
            :
            ( sg::af::Address_Family,
              sg::typ::Socket_Type
            )
            ->
            sg::Socket( X, Y );
        #
        make_socket_pair
            :
            ( sg::af::Address_Family,
              sg::typ::Socket_Type
            )
            ->
            ( sg::Socket( X, Y ),
              sg::Socket( X, Y )
            );

        # Create socket using the specified protocol 
        #
        make_socket'
            :
            ( sg::af::Address_Family,
              sg::typ::Socket_Type,
              Int
            )
            ->
            sg::Socket( X, Y );
        #
        make_socket_pair'
            :
            ( sg::af::Address_Family,
              sg::typ::Socket_Type,
              Int
            )
            ->
            ( sg::Socket( X, Y ),
              sg::Socket( X, Y )
            );


        #######################################################################
        # 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

             c_socket__syscall:   (Int, Int, Int) -> ps::Socket_Fd;
        set__c_socket__ref:     ({ lib_name: String, fun_name: String, io_call: ((Int, Int, Int) -> ps::Socket_Fd) } -> ((Int, Int, Int) -> ps::Socket_Fd)) -> Void;

             c_socket_pair__syscall:    (Int, Int, Int) -> (ps::Socket_Fd, ps::Socket_Fd);
        set__c_socket_pair__ref:      ({ lib_name: String, fun_name: String, io_call: ((Int, Int, Int) -> (ps::Socket_Fd, ps::Socket_Fd)) } -> ((Int, Int, Int) -> (ps::Socket_Fd, ps::Socket_Fd))) -> 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