aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2012-11-20 10:07:11 +0100
committerFredrik Gustafsson <[email protected]>2012-11-20 10:07:11 +0100
commite082a9bd5b08c5b8b95a3592c7bf2b449655bcb2 (patch)
treeba11ce7bc7d8e8fb7a5488d56efa0f0ef47e51c8 /lib/kernel
parente367eb44969b00cac910c8eb14e7b3ce3ee0cc91 (diff)
downloadotp-e082a9bd5b08c5b8b95a3592c7bf2b449655bcb2.tar.gz
otp-e082a9bd5b08c5b8b95a3592c7bf2b449655bcb2.tar.bz2
otp-e082a9bd5b08c5b8b95a3592c7bf2b449655bcb2.zip
Added specs and doc
Diffstat (limited to 'lib/kernel')
-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).