aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/kernel/doc/src/inet.xml20
-rw-r--r--lib/kernel/src/inet.erl20
-rw-r--r--lib/kernel/test/inet_SUITE.erl8
3 files changed, 25 insertions, 23 deletions
diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml
index c6e9242a4f..330a188ab8 100644
--- a/lib/kernel/doc/src/inet.xml
+++ b/lib/kernel/doc/src/inet.xml
@@ -372,45 +372,47 @@ fe80::204:acff:fe17:bf38
</desc>
</func>
<func>
- <name name="ipv4_address" arity="1" />
+ <name name="parse_ipv4_address" arity="1" />
<fsummary>Parse an IPv4 address</fsummary>
<desc>
<p>Returns a ipv4 address tuple</p>
</desc>
</func>
<func>
- <name name="ipv4strict_address" arity="1" />
+ <name name="parse_ipv4strict_address" arity="1" />
<fsummary>Parse an IPv4 address strict.</fsummary>
<desc>
- <p>Returns a ipv4 address tuple</p>
+ <p>Parses an IPv4 address and returns a ipv4 address tuple. Must contain four fields.</p>
</desc>
</func>
<func>
- <name name="ipv6_address" arity="1" />
+ <name name="parse_ipv6_address" arity="1" />
<fsummary>Parse an IPv6 address</fsummary>
<desc>
- <p>Returns a ipv6 address tuple</p>
+ <p>Parses an IPv6 address and returns a ipv6 address tuple.
+ If an IPv4 address is passed, an IPv4-mapped IPv6 address is returned.</p>
</desc>
</func>
<func>
- <name name="ipv6strict_address" arity="1" />
+ <name name="parse_ipv6strict_address" arity="1" />
<fsummary>Parse an IPv6 address strict.</fsummary>
<desc>
- <p>Returns a ipv4 address tuple</p>
+ <p>Parses an IPv6 address and returns a ipv6 address tuple.
+ Does <b>not</b> accept IPv4 adresses.</p>
</desc>
</func>
<func>
<name name="parse_address" arity="1" />
<fsummary>Parse an IPv4 or IPv6 address.</fsummary>
<desc>
- <p>Returns a ipv4 or ipv6 address tuple</p>
+ <p>Parses an IPv4 or IPv6 address and returns a ipv4 or ipv6 address tuple. Accepts a shortened IPv4 address.</p>
</desc>
</func>
<func>
<name name="parse_strict_address" arity="1" />
<fsummary>Parse an IPv4 or IPv6 address strict.</fsummary>
<desc>
- <p>Returns a ipv4 or ipv6 address tuple</p>
+ <p>Parses an IPv4 or IPv6 address and returns a ipv4 or ipv6 address tuple. Does <b>not</b> accept a shortened IPv4 address.</p>
</desc>
</func>
<func>
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index e6f6a28896..767b1c6bfd 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -31,8 +31,8 @@
getstat/1, getstat/2,
ip/1, stats/0, options/0,
pushf/3, popf/1, close/1, gethostname/0, gethostname/1,
- ipv4_address/1, ipv6_address/1, ipv4strict_address/1,
- ipv6strict_address/1, parse_address/1, parse_strict_address/1]).
+ parse_ipv4_address/1, parse_ipv6_address/1, parse_ipv4strict_address/1,
+ parse_ipv6strict_address/1, parse_address/1, parse_strict_address/1]).
-export([connect_options/2, listen_options/2, udp_options/2, sctp_options/2]).
@@ -529,32 +529,32 @@ getservbyname(Name, Protocol) when is_atom(Name) ->
Error -> Error
end.
--spec ipv4_address(Address) ->
+-spec parse_ipv4_address(Address) ->
{ok, IPv4Address} | {error, einval} when
Address :: string(),
IPv4Address :: ip_address().
-ipv4_address(Addr) ->
+parse_ipv4_address(Addr) ->
inet_parse:ipv4_address(Addr).
--spec ipv6_address(Address) ->
+-spec parse_ipv6_address(Address) ->
{ok, IPv6Address} | {error, einval} when
Address :: string(),
IPv6Address :: ip_address().
-ipv6_address(Addr) ->
+parse_ipv6_address(Addr) ->
inet_parse:ipv6_address(Addr).
--spec ipv4strict_address(Address) ->
+-spec parse_ipv4strict_address(Address) ->
{ok, IPv4Address} | {error, einval} when
Address :: string(),
IPv4Address :: ip_address().
-ipv4strict_address(Addr) ->
+parse_ipv4strict_address(Addr) ->
inet_parse:ipv4strict_address(Addr).
--spec ipv6strict_address(Address) ->
+-spec parse_ipv6strict_address(Address) ->
{ok, IPv6Address} | {error, einval} when
Address :: string(),
IPv6Address :: ip_address().
-ipv6strict_address(Addr) ->
+parse_ipv6strict_address(Addr) ->
inet_parse:ipv6strict_address(Addr).
-spec parse_address(Address) ->
diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl
index d70df1efe6..d28e9a207d 100644
--- a/lib/kernel/test/inet_SUITE.erl
+++ b/lib/kernel/test/inet_SUITE.erl
@@ -583,16 +583,16 @@ parse_address(Config) when is_list(Config) ->
"fe80::198.168.0.",
"fec0::fFfF:127.0.0.1."],
t_parse_address
- (ipv6_address,
+ (parse_ipv6_address,
V6Strict++V6Sloppy++V6Err++V4Err),
t_parse_address
- (ipv6strict_address,
+ (parse_ipv6strict_address,
V6Strict++V6Err++V4Err++[S || {_,S} <- V6Sloppy]),
t_parse_address
- (ipv4_address,
+ (parse_ipv4_address,
V4Strict++V4Sloppy++V4Err++V6Err++[S || {_,S} <- V6Strict]),
t_parse_address
- (ipv4strict_address,
+ (parse_ipv4strict_address,
V4Strict++V4Err++V6Err++[S || {_,S} <- V4Sloppy++V6Strict]).
t_parse_address(Func, []) ->