Commit Graph

6 Commits

Author SHA1 Message Date
Darren Bane
7d349d0074 Fix build of extras/net on macOS. 2023-02-10 22:33:36 +11:00
Julien Fischer
ee69c1432c Fix the networking library.
extras/net/Makefile:
    Build a Mercury.modules as some file names do not match
    their module names and the compiler no longer accepts this.

extras/net/errno.m:
    Ensure we can see the definition of MR_STRERROR_BUF_SIZE.
2020-01-13 21:49:25 +11:00
Paul Bone
3c9ebf0969 [net] Impement a Mercury interface to getaddrinfo
Add a Mercury interface to the C function getaddrinfo.  getaddrinfo
superceeds gethostbyname and getservbyname.  It is reenterant and also makes
it easier to support IPv6 amoung other things.  Other predicates in netdb.m
should be written in terms of getaddrinfo.

extras/net/getaddrinfo.m:
    As above.

extras/net/netdb.m:
    Add predicates that use getaddrinfo to perform lookups.

extras/net/types.m:
    Add predicates to convert to and from the raw values for family and
    socktype.

extras/net/test_lookups.m:
extras/net/Makefile:
    Add a test program.

.gitignore:
    This .gitignore file was causing git to ignore the Mercury.options file
    in net/extras.  A leading slash in .gitignore patterns matches the start
    of a path, this allows us to ignore these patterns when they're only in
    the root directory.

extras/net/Mercury.options:
    Work around a Mercury bug.

    Add this missing file.
2015-04-07 16:38:10 +10:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Paul Bone
5700e17e7a Update networking library
extras/net/sockets.m:
    Add read and write predicates.

extras/net/streams.m:
    New file containing implementations of stream typeclasses.

extras/net/net.m:
    Include the new streams module.

extras/net/echo.m:
    Use the new streams typeclass instances to complete the implementation
    of the echo server.  It works one byte at a time (making it slow) and
    will not handle simultanious connections.

extras/net/Makefile:
    Add clean target
2015-01-08 12:45:45 +11:00
Paul Bone
89b66d0228 extras/ Update the net library
This library had been neglected for a while and came to my attention when it
used deprecated (or at least old) C interfaces rather than newer reentrant
ones.  I've started to improve this library by giving a more typesafe and
Mercury-esque API, using only reentrant C functions, and eventually adding
support for more protocols, (eg: IPv6 and UDP) better integration with
Mercury's io module and generally making it easier to use.

What's working now:

    + creating sockets,
    + binding and listening,
    + connecting (untested),
    + accepting,
    + closing.
    + The interface is generally more type-safe, using new types suck as
      "socket" and "address" rather than "int" and "c_pointer".

What's not working/incomplete:

    + I havn't yet touched the tcp.m module, but I intend to remove it and
      create a new high-level interface for various protocols.
    + Any kind of reading / writing over sockets at all.
    + Name lookups.
    + A lot of the interface is incomplete / missing useful functions and
      predicates.

This is a work in progress.

Makefile:
    New Makefile.

README.md:
    New Readme file.

net.m:
    net is now a module containing the other modules as submodules.

sockets.m:
    Many changes as described above.

netdb.m:
    This new module contains host and other name lookups.  Only service
    lookups are currently implemented.

types.m:
    Types shared by sockets.m and netdb.m.

echo.m:
    An example echo server.

errno.m:
    strerror functionality.

tcp.m:
    Conform to changes in net.m.
2014-09-29 09:47:49 +10:00