PreviousUpNext

15.4.1213  src/lib/std/src/socket/unix-domain-socket–premicrothread.pkg

## unix-domain-socket--premicrothread.pkg

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

stipulate
    package ci  =  mythryl_callable_c_library_interface;                # mythryl_callable_c_library_interface  is from   src/lib/std/src/unsafe/mythryl-callable-c-library-interface.pkg
    package gs  =  plain_socket__premicrothread;                        # plain_socket__premicrothread          is from   src/lib/std/src/socket/plain-socket--premicrothread.pkg
    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
    #
    fun cfun  fun_name
        =
        ci::find_c_function'' { lib_name => "socket", fun_name };
herein

    package   unix_domain_socket__premicrothread
    : (weak)  Unix_Domain_Socket__Premicrothread                        # Unix_Domain_Socket__Premicrothread    is from   src/lib/std/src/socket/unix-domain-socket--premicrothread.api
    {
        Unix = UNIX;                                                    # Witness type for Socket.

        Socket(X) = ps::Socket( Unix, X ); 

        Stream_Socket(X) = Socket( sg::Stream(X) );
        Datagram_Socket  = Socket( sg::Datagram );

        Unix_Domain_Socket_Address = ps::Socket_Address( Unix );

        unix_address_family
            =
            null_or::the  (sg::af::from_string  "UNIX");

        # We should probably do some error checking
        # on the length of the string.                   XXX BUGGO FIXME
        #

        (cfun "toUnixAddr")                                                                                     # toUnixAddr            def in    src/c/lib/socket/string-to-unix-domain-socket-address.c
            ->
            (      string_to_unix_domain_socket_address__syscall:    String -> ps::Internet_Address,
                   string_to_unix_domain_socket_address__ref,
              set__string_to_unix_domain_socket_address__ref
            );

        (cfun "fromUnixAddr")                                                                                   # fromUnixAddr          def in    src/c/lib/socket/unix-domain-socket-address-to-string.c
            ->
            (      unix_domain_socket_address_to_string__syscall:    ps::Internet_Address -> String,
                   unix_domain_socket_address_to_string__ref,
              set__unix_domain_socket_address_to_string__ref
            );


        fun string_to_unix_domain_socket_address  socket_path
            =
            ps::ADDRESS (*string_to_unix_domain_socket_address__ref  socket_path);

        fun unix_domain_socket_address_to_string (ps::ADDRESS socket_address)
            =
            *unix_domain_socket_address_to_string__ref  socket_address;


        package stream {
            #
            fun make_socket ()          =  gs::make_socket       (unix_address_family, sg::typ::stream);
            fun make_socket' proto      =  gs::make_socket'      (unix_address_family, sg::typ::stream, proto);                 # NOT EXPORTED BY API -- is this a bug?  XXX QUERO FIXME
            fun make_socket_pair ()     =  gs::make_socket_pair  (unix_address_family, sg::typ::stream);
            fun make_socket_pair' proto =  gs::make_socket_pair' (unix_address_family, sg::typ::stream, proto);                 # NOT EXPORTED BY API -- is this a bug?  XXX QUERO FIXME
        };

        package datagram {
            #
            fun make_socket ()          =  gs::make_socket       (unix_address_family, sg::typ::datagram);
            fun make_socket' proto      =  gs::make_socket'      (unix_address_family, sg::typ::datagram, proto);               # NOT EXPORTED BY API -- is this a bug?  XXX QUERO FIXME
            fun make_socket_pair ()     =  gs::make_socket_pair  (unix_address_family, sg::typ::datagram);
            fun make_socket_pair' proto =  gs::make_socket_pair' (unix_address_family, sg::typ::datagram, proto);               # NOT EXPORTED BY API -- is this a bug?  XXX QUERO FIXME
        };
    };
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