aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet.erl
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2012-11-30 15:09:26 +0100
committerFredrik Gustafsson <[email protected]>2012-11-30 15:09:26 +0100
commitb563c7967185969e0607a4139a2132312581ff08 (patch)
treeaaacad0320b3ce7ae673c9527775ac3679f3eb5e /lib/kernel/src/inet.erl
parentc4d680549e11e116dcdd95ac29101ef3e54aba5f (diff)
parentdbe3c2c9a76c631b98be020b932150ecbe4dd074 (diff)
downloadotp-b563c7967185969e0607a4139a2132312581ff08.tar.gz
otp-b563c7967185969e0607a4139a2132312581ff08.tar.bz2
otp-b563c7967185969e0607a4139a2132312581ff08.zip
Merge branch 'fredrik/inet/export-ip-funcs/OTP-8067'
* fredrik/inet/export-ip-funcs/OTP-8067: Inet doc clarifications Documentation changes inet Changes to function names, tests and docs of inet Added specs and doc Exported ipv4address and ipv6address functions to inet module, changed and made testcases
Diffstat (limited to 'lib/kernel/src/inet.erl')
-rw-r--r--lib/kernel/src/inet.erl46
1 files changed, 45 insertions, 1 deletions
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index 92c1802a86..719dd00720 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -30,7 +30,9 @@
ifget/3, ifget/2, ifset/3, ifset/2,
getstat/1, getstat/2,
ip/1, stats/0, options/0,
- pushf/3, popf/1, close/1, gethostname/0, gethostname/1]).
+ pushf/3, popf/1, close/1, gethostname/0, gethostname/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]).
@@ -527,6 +529,48 @@ getservbyname(Name, Protocol) when is_atom(Name) ->
Error -> Error
end.
+-spec parse_ipv4_address(Address) ->
+ {ok, IPv4Address} | {error, einval} when
+ Address :: string(),
+ IPv4Address :: ip_address().
+parse_ipv4_address(Addr) ->
+ inet_parse:ipv4_address(Addr).
+
+-spec parse_ipv6_address(Address) ->
+ {ok, IPv6Address} | {error, einval} when
+ Address :: string(),
+ IPv6Address :: ip_address().
+parse_ipv6_address(Addr) ->
+ inet_parse:ipv6_address(Addr).
+
+-spec parse_ipv4strict_address(Address) ->
+ {ok, IPv4Address} | {error, einval} when
+ Address :: string(),
+ IPv4Address :: ip_address().
+parse_ipv4strict_address(Addr) ->
+ inet_parse:ipv4strict_address(Addr).
+
+-spec parse_ipv6strict_address(Address) ->
+ {ok, IPv6Address} | {error, einval} when
+ Address :: string(),
+ IPv6Address :: ip_address().
+parse_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).
+
%% Return a list of available options
options() ->
[