Files
mercury/extras/net/README.md
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

1.3 KiB

Networking Library

This library is inteded to provide support for networking with both 1) a simple binding around the BSD sockets interface 2) a higher-level set of predicates and functions for common patterns. This is a work in progress and many things are unimplemented.

Copying

Copyright (C) 2014 The Mercury Team This file may only be copied under the terms of the GNU Library General Public Licence - see the file COPYING in the Mercury distribution.

TODO

+ Currently no method is provided to connect these sockets to the
  standard libraries IO or stream modules.
+ sendmsg()/recvmsg().
+ Cross platform functionality (Only tested on Linux so far).
+ Non blocking support.
+ Improved name lookup / reverse lookup
+ Network layer:

    + IPv6
    + Unix domain sockets

+ Protocol layer:

    + UDP
    + SCTP

+ High level interface

Modules

+ net.

    Main library module

+ net.types.

    Common datatypes

+ net.sockets.

    Sockets predicates.  This includes the most fundermental operations
    such as listen/connect.

+ net.netdb.

    Network name lookups.

+ net.tcp

    Deprecated module.

+ net.errno

    Internal module with errno functionality.

+ echo

    An example echo server (incomplete).