aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet_parse.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_parse.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_parse.erl')
-rw-r--r--lib/kernel/src/inet_parse.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/kernel/src/inet_parse.erl b/lib/kernel/src/inet_parse.erl
index ba62a59068..3551e701b6 100644
--- a/lib/kernel/src/inet_parse.erl
+++ b/lib/kernel/src/inet_parse.erl
@@ -36,7 +36,7 @@
-export([ipv4_address/1, ipv6_address/1]).
-export([ipv4strict_address/1, ipv6strict_address/1]).
--export([address/1]).
+-export([address/1, strict_address/1]).
-export([visible_string/1, domain/1]).
-export([ntoa/1, dots/1]).
-export([split_line/1]).
@@ -456,6 +456,17 @@ address(Cs) when is_list(Cs) ->
address(_) ->
{error, einval}.
+%%Parse ipv4 strict address or ipv6 strict address
+strict_address(Cs) when is_list(Cs) ->
+ case ipv4strict_address(Cs) of
+ {ok,IP} ->
+ {ok,IP};
+ _ ->
+ ipv6strict_address(Cs)
+ end;
+strict_address(Cs) ->
+ {error, einval}.
+
%%
%% Parse IPv4 address:
%% d1.d2.d3.d4