Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:20
erlang
4373-Fix-types-for-getbyname-2-3.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4373-Fix-types-for-getbyname-2-3.patch of Package erlang
From 9edbf8a5ab74fb7e7b6e433e8827c02469281aad Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Mon, 21 Mar 2022 15:21:51 +0100 Subject: [PATCH 3/5] Fix types for getbyname/2,3 --- lib/kernel/doc/src/inet_res.xml | 22 ++++++++++++++++++---- lib/kernel/src/inet_res.erl | 16 +++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/lib/kernel/doc/src/inet_res.xml b/lib/kernel/doc/src/inet_res.xml index 0d654bbc0e..9f2304a630 100644 --- a/lib/kernel/doc/src/inet_res.xml +++ b/lib/kernel/doc/src/inet_res.xml @@ -195,6 +195,9 @@ inet_dns:record_type(_) -> undefined.</pre> in the UTF-8 coding standard.</p> </desc> </datatype> + <datatype> + <name name="hostent"/> + </datatype> </datatypes> <funcs> @@ -204,9 +207,20 @@ inet_dns:record_type(_) -> undefined.</pre> <fsummary>Resolve a DNS record of the specified type for the specified host.</fsummary> <desc> - <p>Resolves a DNS record of the specified type for the specified host, - of class <c>in</c>. Returns, on success, a <c>hostent()</c> record - with <c>dns_data()</c> elements in the address list field.</p> + <p>Resolves a DNS record of the specified <c><anno>Type</anno></c> + for the specified host, of class <c>in</c>. + Returns, on success, when resolving a + <c><anno>Type</anno> = a|aaaa</c> DNS record, + a <c>#hostent{}</c> record with + <c>#hostent.h_addrtype = inet|inet6</c>, + respectively; see + <seealso marker="inet#type-hostent"><c>inet:hostent()</c></seealso>.</p> + <p>When resolving other + <c><anno>Type</anno> = rr_type()</c>:s + also returns a <c>#hostent{}</c> record but with + <c>#hostent.h_addrtype = </c><seealso marker="#type-rr_type"><c>rr_type()</c></seealso>, and + <c>#hostent.h_addr_list = </c>[<seealso marker="#type-dns_data"><c>dns_data()</c></seealso>]; see + <seealso marker="#type-hostent"><c>hostent()</c></seealso>.</p> <p>This function uses resolver option <c>search</c> that is a list of domain names. If the name to resolve contains no dots, it is prepended to each domain name in the diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl index 4e71944492..b0d5b6dc7b 100644 --- a/lib/kernel/src/inet_res.erl +++ b/lib/kernel/src/inet_res.erl @@ -453,10 +453,20 @@ gethostbyname_tm(_Name, _Family, _Timer) -> %% Caches the answer. %% -------------------------------------------------------------------------- +%% Duplicate of inet.hrl: #hostent{}, but with DNS RR types in h_addrtype +%% and dns_data() in h_addr_list. +-type hostent() :: + {'hostent', + H_name :: inet:hostname(), + H_aliases :: [inet:hostname()], + H_addrtype :: rr_type(), + H_length :: non_neg_integer(), + H_addr_list :: [dns_data()]}. + -spec getbyname(Name, Type) -> {ok, Hostent} | {error, Reason} when Name :: dns_name(), Type :: rr_type(), - Hostent :: inet:hostent(), + Hostent :: inet:hostent() | hostent(), Reason :: inet:posix() | res_error(). getbyname(Name, Type) -> @@ -466,7 +476,7 @@ getbyname(Name, Type) -> Name :: dns_name(), Type :: rr_type(), Timeout :: timeout(), - Hostent :: inet:hostent(), + Hostent :: inet:hostent() | hostent(), Reason :: inet:posix() | res_error(). getbyname(Name, Type, Timeout) -> -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor