aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/kernel/doc/src/inet.xml43
-rw-r--r--lib/kernel/src/inet.erl24
2 files changed, 66 insertions, 1 deletions
diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml
index b727960d96..c6e9242a4f 100644
--- a/lib/kernel/doc/src/inet.xml
+++ b/lib/kernel/doc/src/inet.xml
@@ -371,7 +371,48 @@ fe80::204:acff:fe17:bf38
</taglist>
</desc>
</func>
-
+ <func>
+ <name name="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" />
+ <fsummary>Parse an IPv4 address strict.</fsummary>
+ <desc>
+ <p>Returns a ipv4 address tuple</p>
+ </desc>
+ </func>
+ <func>
+ <name name="ipv6_address" arity="1" />
+ <fsummary>Parse an IPv6 address</fsummary>
+ <desc>
+ <p>Returns a ipv6 address tuple</p>
+ </desc>
+ </func>
+ <func>
+ <name name="ipv6strict_address" arity="1" />
+ <fsummary>Parse an IPv6 address strict.</fsummary>
+ <desc>
+ <p>Returns a ipv4 address tuple</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>
+ </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>
+ </desc>
+ </func>
<func>
<name name="peername" arity="1"/>
<fsummary>Return the address and port for the other end of a connection</fsummary>
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index 133cc523fa..e6f6a28896 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -529,21 +529,45 @@ getservbyname(Name, Protocol) when is_atom(Name) ->
Error -> Error
end.
+-spec ipv4_address(Address) ->
+ {ok, IPv4Address} | {error, einval} when
+ Address :: string(),
+ IPv4Address :: ip_address().
ipv4_address(Addr) ->
inet_parse:ipv4_address(Addr).
+-spec ipv6_address(Address) ->
+ {ok, IPv6Address} | {error, einval} when
+ Address :: string(),
+ IPv6Address :: ip_address().
ipv6_address(Addr) ->
inet_parse:ipv6_address(Addr).
+-spec ipv4strict_address(Address) ->
+ {ok, IPv4Address} | {error, einval} when
+ Address :: string(),
+ IPv4Address :: ip_address().
ipv4strict_address(Addr) ->
inet_parse:ipv4strict_address(Addr).
+-spec ipv6strict_address(Address) ->
+ {ok, IPv6Address} | {error, einval} when
+ Address :: string(),
+ IPv6Address :: ip_address().
ipv6strict_address(Addr) ->
inet_parse:ipv6strict_address(Addr).
+-spec parse_address(Address) ->
+ {ok, IPAddress} | {error, einval} when
+ Address :: string(),
+ IPAddress :: ip_address().
parse_address(Addr) ->
inet_parse:address(Addr).
+-spec parse_strict_address(Address) ->
+ {ok, IPAddress} | {error, einval} when
+ Address :: string(),
+ IPAddress :: ip_address().
parse_strict_address(Addr) ->
inet_parse:strict_address(Addr).