head 1.2; access; symbols perseant-exfatfs-base-20250801:1.2 perseant-exfatfs-base-20240630:1.2 perseant-exfatfs:1.2.0.6 perseant-exfatfs-base:1.2 netbsd-8-3-RELEASE:1.1.1.11.8.1 cjep_sun2x:1.2.0.4 cjep_sun2x-base:1.2 cjep_staticlib_x-base1:1.2 cjep_staticlib_x:1.2.0.2 cjep_staticlib_x-base:1.2 phil-wifi-20200421:1.2 phil-wifi-20200411:1.2 phil-wifi-20200406:1.2 netbsd-8-2-RELEASE:1.1.1.11.8.1 netbsd-8-1-RELEASE:1.1.1.11.8.1 netbsd-8-1-RC1:1.1.1.11.8.1 pgoyette-compat-merge-20190127:1.1.1.12 pgoyette-compat-20190127:1.1.1.12 pgoyette-compat-20190118:1.1.1.12 pgoyette-compat-1226:1.1.1.12 pgoyette-compat-1126:1.1.1.12 pgoyette-compat-1020:1.1.1.12 pgoyette-compat-0930:1.1.1.12 pgoyette-compat-0906:1.1.1.12 netbsd-7-2-RELEASE:1.1.1.8.2.3 pgoyette-compat-0728:1.1.1.12 netbsd-8-0-RELEASE:1.1.1.11.8.1 phil-wifi:1.1.1.12.0.6 phil-wifi-base:1.1.1.12 pgoyette-compat-0625:1.1.1.12 netbsd-8-0-RC2:1.1.1.11.8.1 pgoyette-compat-0521:1.1.1.12 pgoyette-compat-0502:1.1.1.12 pgoyette-compat-0422:1.1.1.12 netbsd-8-0-RC1:1.1.1.11.8.1 pgoyette-compat-0415:1.1.1.12 bind-9-10-7:1.1.1.12 pgoyette-compat-0407:1.1.1.12 pgoyette-compat-0330:1.1.1.12 pgoyette-compat-0322:1.1.1.12 pgoyette-compat-0315:1.1.1.12 netbsd-7-1-2-RELEASE:1.1.1.8.2.2.2.1 pgoyette-compat:1.1.1.12.0.4 pgoyette-compat-base:1.1.1.12 netbsd-7-1-1-RELEASE:1.1.1.8.2.2.2.1 matt-nb8-mediatek:1.1.1.11.8.1.0.2 matt-nb8-mediatek-base:1.1.1.11.8.1 perseant-stdc-iso10646:1.1.1.12.0.2 perseant-stdc-iso10646-base:1.1.1.12 bind-9-10-5-P2:1.1.1.12 bind-9-10-5-P1:1.1.1.12 netbsd-8:1.1.1.11.0.8 netbsd-8-base:1.1.1.11 prg-localcount2-base3:1.1.1.11 prg-localcount2-base2:1.1.1.11 prg-localcount2-base1:1.1.1.11 prg-localcount2:1.1.1.11.0.6 prg-localcount2-base:1.1.1.11 pgoyette-localcount-20170426:1.1.1.11 bouyer-socketcan-base1:1.1.1.11 bind-9-10-4-P8:1.1.1.11 pgoyette-localcount-20170320:1.1.1.11 netbsd-7-1:1.1.1.8.2.2.0.2 netbsd-7-1-RELEASE:1.1.1.8.2.2 netbsd-7-1-RC2:1.1.1.8.2.2 bind-9-10-4-P6:1.1.1.11 netbsd-7-nhusb-base-20170116:1.1.1.8.2.2 bouyer-socketcan:1.1.1.11.0.4 bouyer-socketcan-base:1.1.1.11 bind-9-10-4-P5:1.1.1.11 pgoyette-localcount-20170107:1.1.1.11 netbsd-7-1-RC1:1.1.1.8.2.2 pgoyette-localcount-20161104:1.1.1.11 bind-9-10-4-P4:1.1.1.11 netbsd-7-0-2-RELEASE:1.1.1.8.2.1.2.1 bind-9-10-4-P3:1.1.1.11 localcount-20160914:1.1.1.11 netbsd-7-nhusb:1.1.1.8.2.1.0.4 netbsd-7-nhusb-base:1.1.1.8.2.1 pgoyette-localcount-20160806:1.1.1.11 pgoyette-localcount-20160726:1.1.1.11 pgoyette-localcount:1.1.1.11.0.2 pgoyette-localcount-base:1.1.1.11 bind-9-10-4-P1:1.1.1.11 netbsd-7-0-1-RELEASE:1.1.1.8.2.1 bind-9-10-3-P4:1.1.1.10 bind-9-10-3-P3:1.1.1.10 bind-9-10-3-P2:1.1.1.10 netbsd-7-0:1.1.1.8.2.1.0.2 netbsd-7-0-RELEASE:1.1.1.8.2.1 bind-9-10-2-P4:1.1.1.10 netbsd-7-0-RC3:1.1.1.8.2.1 bind-9-10-2-P3:1.1.1.10 netbsd-7-0-RC2:1.1.1.8.2.1 bind-9-10-2-P2:1.1.1.10 netbsd-7-0-RC1:1.1.1.8.2.1 bind-9-10-1-P1:1.1.1.10 netbsd-6-0-6-RELEASE:1.1.1.6.4.1 netbsd-6-1-5-RELEASE:1.1.1.6.4.1 netbsd-7:1.1.1.8.0.2 netbsd-7-base:1.1.1.8 bind-9-10-0-P2:1.1.1.8 yamt-pagecache-base9:1.1.1.7 yamt-pagecache-tag8:1.1.1.6.2.1 netbsd-6-1-4-RELEASE:1.1.1.6.4.1 netbsd-6-0-5-RELEASE:1.1.1.6.4.1 tls-earlyentropy:1.1.1.7.0.10 tls-earlyentropy-base:1.1.1.8 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.7 riastradh-drm2-base3:1.1.1.7 bind-9-10-0b1:1.1.1.7 netbsd-6-1-3-RELEASE:1.1.1.6.4.1 netbsd-6-0-4-RELEASE:1.1.1.6.4.1 bind-9-9-5b1:1.1.1.7 netbsd-6-1-2-RELEASE:1.1.1.6.4.1 netbsd-6-0-3-RELEASE:1.1.1.6.4.1 netbsd-6-1-1-RELEASE:1.1.1.6.4.1 bind-9-9-3-P2:1.1.1.7 riastradh-drm2-base2:1.1.1.7 riastradh-drm2-base1:1.1.1.7 riastradh-drm2:1.1.1.7.0.4 riastradh-drm2-base:1.1.1.7 netbsd-6-1:1.1.1.6.4.1.0.6 netbsd-6-0-2-RELEASE:1.1.1.6.4.1 netbsd-6-1-RELEASE:1.1.1.6.4.1 khorben-n900:1.1.1.7.0.8 netbsd-6-1-RC4:1.1.1.6.4.1 netbsd-6-1-RC3:1.1.1.6.4.1 agc-symver:1.1.1.7.0.6 agc-symver-base:1.1.1.7 netbsd-6-1-RC2:1.1.1.6.4.1 netbsd-6-1-RC1:1.1.1.6.4.1 yamt-pagecache-base8:1.1.1.7 netbsd-6-0-1-RELEASE:1.1.1.6.4.1 yamt-pagecache-base7:1.1.1.7 bind-9-9-2-P1:1.1.1.7 matt-nb6-plus-nbase:1.1.1.6.4.1 yamt-pagecache-base6:1.1.1.7 netbsd-6-0:1.1.1.6.4.1.0.4 netbsd-6-0-RELEASE:1.1.1.6.4.1 netbsd-6-0-RC2:1.1.1.6.4.1 tls-maxphys:1.1.1.7.0.2 tls-maxphys-base:1.1.1.8 matt-nb6-plus:1.1.1.6.4.1.0.2 matt-nb6-plus-base:1.1.1.6.4.1 netbsd-6-0-RC1:1.1.1.6.4.1 bind-9-9-1-P1:1.1.1.7 yamt-pagecache-base5:1.1.1.6 yamt-pagecache-base4:1.1.1.6 netbsd-6:1.1.1.6.0.4 netbsd-6-base:1.1.1.6 yamt-pagecache-base3:1.1.1.6 yamt-pagecache-base2:1.1.1.6 yamt-pagecache:1.1.1.6.0.2 yamt-pagecache-base:1.1.1.6 bind-9-9-0a1:1.1.1.6 bind-9-8-0-P4:1.1.1.5 cherry-xenmp:1.1.1.4.0.2 cherry-xenmp-base:1.1.1.4 bind-9-8-0-P2:1.1.1.4 bind9-8-0rc1:1.1.1.4 bouyer-quota2-nbase:1.1.1.4 bouyer-quota2:1.1.1.3.0.2 bouyer-quota2-base:1.1.1.4 matt-mips64-premerge-20101231:1.1.1.3 bind-9-7-2-P3:1.1.1.3 bind-9-7-2b1:1.1.1.2 bind-9-7-0rc1:1.1.1.2 matt-premerge-20091211:1.1.1.2 bind-9-7-0-b1:1.1.1.2 bind-9-6-1-P1:1.1.1.1 jym-xensuspend-base:1.1.1.1 jym-xensuspend:1.1.1.1.0.2 jym-xensuspend-nbase:1.1.1.1 bind9-6-1b1:1.1.1.1 ISC:1.1.1; locks; strict; comment @# @; 1.2 date 2019.05.10.09.14.58; author wiz; state dead; branches; next 1.1; commitid SEgY3sFTlDvvDDmB; 1.1 date 2009.03.22.15.02.47; author christos; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2009.03.22.15.02.47; author christos; state Exp; branches 1.1.1.1.2.1; next 1.1.1.2; 1.1.1.2 date 2009.10.25.00.02.55; author christos; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2010.12.02.14.23.38; author christos; state Exp; branches 1.1.1.3.2.1; next 1.1.1.4; 1.1.1.4 date 2011.02.15.19.39.00; author christos; state Exp; branches; next 1.1.1.5; 1.1.1.5 date 2011.07.05.21.31.12; author spz; state Exp; branches; next 1.1.1.6; 1.1.1.6 date 2011.09.11.17.20.02; author christos; state Exp; branches 1.1.1.6.2.1 1.1.1.6.4.1; next 1.1.1.7; 1.1.1.7 date 2012.06.04.17.57.08; author christos; state Exp; branches 1.1.1.7.2.1 1.1.1.7.10.1; next 1.1.1.8; 1.1.1.8 date 2014.07.08.04.50.06; author spz; state Exp; branches 1.1.1.8.2.1; next 1.1.1.9; commitid Mcep1OIjY5QWWwHx; 1.1.1.9 date 2014.12.10.02.25.34; author christos; state Exp; branches; next 1.1.1.10; commitid ZA8gmIRTml5lcr1y; 1.1.1.10 date 2014.12.10.03.31.36; author christos; state Exp; branches; next 1.1.1.11; commitid Kjjxv3fot5DZyr1y; 1.1.1.11 date 2016.05.26.15.45.53; author christos; state Exp; branches 1.1.1.11.8.1; next 1.1.1.12; commitid rNgyUOhc6UpKu08z; 1.1.1.12 date 2017.06.15.15.22.51; author christos; state Exp; branches 1.1.1.12.6.1; next ; commitid AgIo44k7APizZtVz; 1.1.1.1.2.1 date 2009.03.22.15.02.47; author jym; state dead; branches; next 1.1.1.1.2.2; 1.1.1.1.2.2 date 2009.05.13.18.51.46; author jym; state Exp; branches; next ; 1.1.1.3.2.1 date 2011.02.17.11.59.11; author bouyer; state Exp; branches; next ; 1.1.1.6.2.1 date 2012.10.30.18.54.41; author yamt; state Exp; branches; next ; 1.1.1.6.4.1 date 2012.06.06.18.18.32; author bouyer; state Exp; branches 1.1.1.6.4.1.4.1 1.1.1.6.4.1.6.1; next 1.1.1.6.4.2; 1.1.1.6.4.2 date 2014.12.25.17.54.32; author msaitoh; state Exp; branches; next 1.1.1.6.4.3; commitid DOs7YhzjNdulQr3y; 1.1.1.6.4.3 date 2017.04.25.19.54.34; author snj; state Exp; branches; next ; commitid tS2hfyOu155P7XOz; 1.1.1.6.4.1.4.1 date 2014.12.31.11.59.09; author msaitoh; state Exp; branches; next 1.1.1.6.4.1.4.2; commitid UwPiTbNnARsHGb4y; 1.1.1.6.4.1.4.2 date 2017.04.25.22.02.02; author snj; state Exp; branches; next ; commitid Mh89qlSRw0ICPXOz; 1.1.1.6.4.1.6.1 date 2014.12.26.03.08.39; author msaitoh; state Exp; branches; next 1.1.1.6.4.1.6.2; commitid yqTOlsoWsWVLUu3y; 1.1.1.6.4.1.6.2 date 2017.04.25.20.53.57; author snj; state Exp; branches; next ; commitid w3an9o5yFMZisXOz; 1.1.1.7.2.1 date 2014.08.19.23.46.35; author tls; state Exp; branches; next ; commitid jTnpym9Qu0o4R1Nx; 1.1.1.7.10.1 date 2014.08.10.07.06.44; author tls; state Exp; branches; next ; commitid vuZWZSMzG2mZFMLx; 1.1.1.8.2.1 date 2014.12.22.03.28.47; author msaitoh; state Exp; branches 1.1.1.8.2.1.2.1 1.1.1.8.2.1.4.1; next 1.1.1.8.2.2; commitid s9mHA4qvt0AE9Z2y; 1.1.1.8.2.2 date 2016.10.14.12.01.34; author martin; state Exp; branches 1.1.1.8.2.2.2.1; next 1.1.1.8.2.3; commitid cv7oxX6XYIZfG6qz; 1.1.1.8.2.3 date 2017.06.20.17.09.57; author snj; state Exp; branches; next ; commitid 9D6h68tqKy82q8Wz; 1.1.1.8.2.1.2.1 date 2016.10.14.11.42.51; author martin; state Exp; branches; next 1.1.1.8.2.1.2.2; commitid 0Q0oidhFkBBMz6qz; 1.1.1.8.2.1.2.2 date 2017.06.20.16.40.26; author snj; state Exp; branches; next ; commitid 3tX9hN0zVj6Ff8Wz; 1.1.1.8.2.1.4.1 date 2017.01.18.08.46.18; author skrll; state Exp; branches; next ; commitid M6f3RyDtiAR3wqCz; 1.1.1.8.2.2.2.1 date 2017.06.20.17.02.28; author snj; state Exp; branches; next ; commitid GxuFZUGrvwdun8Wz; 1.1.1.11.8.1 date 2017.06.21.18.03.50; author snj; state Exp; branches; next ; commitid jnXpTnVXWnBaGgWz; 1.1.1.12.6.1 date 2019.06.10.21.44.31; author christos; state dead; branches; next ; commitid jtc8rnCzWiEEHGqB; desc @@ 1.2 log @Remove src/external/bsd/bind - latest version is in src/external/mpl/bind This directory was already unhooked from the build (in August 2018). ok christos@@ @ text @
lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr — lightweight resolver utility functions
#include <lwres/lwres.h>
lwres_result_t
lwres_string_parse( |
lwres_buffer_t * | b, |
| char ** | c, | |
| lwres_uint16_t * |
len); |
lwres_result_t
lwres_addr_parse( |
lwres_buffer_t * | b, |
| lwres_addr_t * |
addr); |
lwres_result_t
lwres_getaddrsbyname( |
lwres_context_t * | ctx, |
| const char * | name, | |
| lwres_uint32_t | addrtypes, | |
| lwres_gabnresponse_t ** |
structp); |
lwres_result_t
lwres_getnamebyaddr( |
lwres_context_t * | ctx, |
| lwres_uint32_t | addrtype, | |
| lwres_uint16_t | addrlen, | |
| const unsigned char * | addr, | |
| lwres_gnbaresponse_t ** |
structp); |
lwres_string_parse()
retrieves a DNS-encoded string starting the current pointer of
lightweight resolver buffer b: i.e.
b->current. When the function returns,
the address of the first byte of the encoded string is returned
via *c and the length of that string is
given by *len. The buffer's current
pointer is advanced to point at the character following the
string length, the encoded string, and the trailing
NULL character.
lwres_addr_parse()
extracts an address from the buffer b.
The buffer's current pointer b->current
is presumed to point at an encoded address: the address preceded
by a 32-bit protocol family identifier and a 16-bit length
field. The encoded address is copied to
addr->address and
addr->length indicates the size in bytes
of the address that was copied.
b->current is advanced to point at the
next byte of available data in the buffer following the encoded
address.
lwres_getaddrsbyname()
and lwres_getnamebyaddr() use the
lwres_gnbaresponse_t structure defined below:
typedef struct {
lwres_uint32_t flags;
lwres_uint16_t naliases;
lwres_uint16_t naddrs;
char *realname;
char **aliases;
lwres_uint16_t realnamelen;
lwres_uint16_t *aliaslen;
lwres_addrlist_t addrs;
void *base;
size_t baselen;
} lwres_gabnresponse_t;
The contents of this structure are not manipulated directly but they are controlled through the lwres_gabn(3) functions.
The lightweight resolver uses
lwres_getaddrsbyname() to perform
foward lookups.
Hostname name is looked up using the
resolver
context ctx for memory allocation.
addrtypes is a bitmask indicating
which type of
addresses are to be looked up. Current values for this bitmask are
LWRES_ADDRTYPE_V4 for IPv4 addresses and
LWRES_ADDRTYPE_V6 for IPv6 addresses. Results of the
lookup are returned in *structp.
lwres_getnamebyaddr()
performs reverse lookups. Resolver context
ctx is used for memory allocation. The
address type is indicated by addrtype:
LWRES_ADDRTYPE_V4 or
LWRES_ADDRTYPE_V6. The address to be looked up is
given by addr and its length is
addrlen bytes. The result of the
function call is made available through
*structp.
Successful calls to
lwres_string_parse()
and
lwres_addr_parse()
return
LWRES_R_SUCCESS.
Both functions return
LWRES_R_FAILURE
if the buffer is corrupt or
LWRES_R_UNEXPECTEDEND
if the buffer has less space than expected for the components of the
encoded string or address.
lwres_getaddrsbyname()
returns LWRES_R_SUCCESS on success and it
returns LWRES_R_NOTFOUND if the hostname
name could not be found.
LWRES_R_SUCCESS
is returned by a successful call to
lwres_getnamebyaddr().
Both
lwres_getaddrsbyname()
and
lwres_getnamebyaddr()
return
LWRES_R_NOMEMORY
when memory allocation requests fail and
LWRES_R_UNEXPECTEDEND
if the buffers used for sending queries and receiving replies are too
small.