PreviousUpNext

15.3.541  src/lib/std/src/socket/plain-socket.api

## plain-socket.api

# Compiled by:
#     src/lib/std/standard.lib



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



stipulate
    package pre =  proto_socket;                                # proto_socket          is from   src/lib/std/src/socket/proto-socket.pkg
    package sok =  socket_guts;                                 # socket_guts                   is from   src/lib/std/src/socket/socket-guts.pkg
herein

    # This api is implemented by:
    #     src/lib/std/src/socket/plain-socket.pkg
    #
    api Plain_Socket {


    /*
        addressFamilies:  Void -> List( sok::af::addr_family )
            /* returns a list of the supported address families; this should include
             * at least:  sok::af::inet.
             */

        socketTypes:  Void -> sok::SOCKET::sock_type
            /* returns a list of the supported socket types; this should include at
             * least:  sok::SOCKET::stream and sok::SOCKET::dgram.
             */
    */

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

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

    };
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