hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 0f2b0612024968d194c3ca10009c77d51050e362
parent acd139606f7c2289b2a2190c3f3442ea8cd2f533
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon, 21 Jun 2021 14:40:40 -0400

net::dial: add resolve stub

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mnet/dial/dial.ha | 4++--
Anet/dial/resolve.ha | 9+++++++++
Mscripts/gen-stdlib | 3++-
Mstdlib.mk | 6++++--
4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/net/dial/dial.ha b/net/dial/dial.ha @@ -19,8 +19,8 @@ use net; // // The service parameter can be a service name (e.g. "submission") or a default // port to use, if one is not specified by address. If a service name is used, -// an internal list of services is consulted (see [[dial::registersvc]]), and if -// not known to Hare, the system service list (e.g. /etc/services) will be +// an internal list of services is consulted (see [[registersvc]]), and if not +// known to Hare, the system service list (e.g. /etc/services) will be // consulted. If the connection port cannot be established, [[errors::invalid]] // is returned. The special service name "unknown" will always consult the // address parameter for a desired port, and will return [[errors::invalid]] if diff --git a/net/dial/resolve.ha b/net/dial/resolve.ha @@ -0,0 +1,9 @@ +use net::dns; +use net::ip; + +// Performs DNS resolution on a given address string for a given service, +// including /etc/hosts lookup and SRV resolution, and returns a list of +// candidate IP addresses and the appropriate port, or an error. +export fn resolve(addr: str, service: str) (([]ip::addr, u16) | dns::error) = { + abort(); // TODO +}; diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib @@ -555,7 +555,8 @@ net_dial() { gen_srcs net::dial \ dial.ha \ ip.ha \ - registry.ha + registry.ha \ + resolve.ha gen_ssa net::dial io net net::ip net::tcp net::udp } diff --git a/stdlib.mk b/stdlib.mk @@ -837,7 +837,8 @@ $(HARECACHE)/net/net.ssa: $(stdlib_net_srcs) $(stdlib_rt) $(stdlib_io) $(stdlib_ stdlib_net_dial_srcs= \ $(STDLIB)/net/dial/dial.ha \ $(STDLIB)/net/dial/ip.ha \ - $(STDLIB)/net/dial/registry.ha + $(STDLIB)/net/dial/registry.ha \ + $(STDLIB)/net/dial/resolve.ha $(HARECACHE)/net/dial/net_dial.ssa: $(stdlib_net_dial_srcs) $(stdlib_rt) $(stdlib_io) $(stdlib_net) $(stdlib_net_ip) $(stdlib_net_tcp) $(stdlib_net_udp) @printf 'HAREC \t$@\n' @@ -2005,7 +2006,8 @@ $(TESTCACHE)/net/net.ssa: $(testlib_net_srcs) $(testlib_rt) $(testlib_io) $(test testlib_net_dial_srcs= \ $(STDLIB)/net/dial/dial.ha \ $(STDLIB)/net/dial/ip.ha \ - $(STDLIB)/net/dial/registry.ha + $(STDLIB)/net/dial/registry.ha \ + $(STDLIB)/net/dial/resolve.ha $(TESTCACHE)/net/dial/net_dial.ssa: $(testlib_net_dial_srcs) $(testlib_rt) $(testlib_io) $(testlib_net) $(testlib_net_ip) $(testlib_net_tcp) $(testlib_net_udp) @printf 'HAREC \t$@\n'