diff --git a/lib/libc/net/resolver.3 b/lib/libc/net/resolver.3 --- a/lib/libc/net/resolver.3 +++ b/lib/libc/net/resolver.3 @@ -34,6 +34,7 @@ .Nm res_mkquery , .Nm res_send , .Nm res_init , +.Nm res_findzonecut2 , .Nm dn_comp , .Nm dn_expand , .Nm dn_skipname , @@ -84,6 +85,17 @@ .Ft int .Fn res_init void .Ft int +.Fo res_findzonecut2 +.Fa "res_state statp" +.Fa "const char *dname" +.Fa "ns_class class" +.Fa "int options" +.Fa "char *zname" +.Fa "size_t zsize" +.Fa "union res_sockaddr_union *ns" +.Fa "int nns" +.Fc +.Ft int .Fo dn_comp .Fa "const char *exp_dn" .Fa "u_char *comp_dn" @@ -140,24 +152,15 @@ should continue until it finds an authoritative answer or finds an error. Currently this is not implemented. .It Dv RES_USEVC -Use -.Tn TCP -connections for queries instead of -.Tn UDP -datagrams. +Use TCP connections for queries instead of UDP datagrams. .It Dv RES_STAYOPEN Used with .Dv RES_USEVC -to keep the -.Tn TCP -connection open between -queries. +to keep the TCP connection open between queries. This is useful only in programs that regularly do many queries. -.Tn UDP -should be the normal mode used. +UDP should be the normal mode used. .It Dv RES_IGNTC -Unused currently (ignore truncation errors, i.e., do not retry with -.Tn TCP ) . +Unused currently (ignore truncation errors, i.e., do not retry with TCP). .It Dv RES_RECURSE Set the recursion-desired bit in queries. This is the default. @@ -304,6 +307,49 @@ \-1 if there were errors. .Pp The +.Fn res_findzonecut2 +function locates the nearest enclosing zone cut for domain name +.Fa dname +and returns the zone name where delegation occurs +and the list of name server addresses. +The +.Fn res_findzonecut2 +returns 0 on success or -1 on failure. +.Pp +The three options supported by +.Fn res_findzonecut2 +are +.Bl -tag -width "RES_EXHAUSTIVE" +.It Dv RES_EXHAUSTIVE +Always do all queries. +.It Dv RES_IPV4ONLY +Only search using IPv4. +.It Dv RES_IPV6ONLY +Only search using IPv6. +.El +.Bl -column "union res_sockaddr_union *ns" "Description" +.It Em "Function parameter" Ta Em "Description" +.It Fa res_state statp Ta Pointer to the resolver state. +.It Fa "const char *dname" Ta Domain name to inspect, +e.g. "www.sub.example.com". +.It Fa "ns_class class" Ta DNS class. +.It Fa "int options" Ta Options for searching. +.It Fa "char *zname" Ta Output buffer to hold the zone name at the zone cut, +e.g. "example.com". +Note: you must ensure +.Fa zname +is large enough to hold a full domain. +.Dv NS_MAXDNAME +is often used for buffer size. +.It Fa "size_t zsize" Ta Size of zname buffer. +.It Fa "union res_sockaddr_union *ns" Ta Output array of name +server addresses (IPv4 or IPv6), one per NS. +.It Fa "int nns" Ta Number of elements available in +.Fa ns +array. +.El +.Pp +The .Fn dn_comp function compresses the domain name