aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet6_tcp.erl
diff options
context:
space:
mode:
authorDanil Zagoskin <[email protected]>2015-05-02 00:40:53 +0300
committerDanil Zagoskin <[email protected]>2015-05-02 00:40:53 +0300
commit8266a6056ff3b4292d98485665e5444addd689b6 (patch)
tree177254190b8902589970a20bb7a2398d84eb7554 /lib/kernel/src/inet6_tcp.erl
parentff1e0b2fe44a347670a5d72c45c061fefa6abc7f (diff)
downloadotp-8266a6056ff3b4292d98485665e5444addd689b6.tar.gz
otp-8266a6056ff3b4292d98485665e5444addd689b6.tar.bz2
otp-8266a6056ff3b4292d98485665e5444addd689b6.zip
kernel: inet6_tcp_dist: reuse inet_tcp_dist code
inet6_tcp_dist module is an old copy of inet_tcp_dist with changed address family. New features (such as listening port range, interface and generic options) are implemented in inet_tcp_dist only, inet6_tcp_dist looks abandoned (it does not even have tests). This patch makes inet_tcp_dist internals work with abstract driver, and inet6_tcp_dist becomes just a thin wrapper for it.
Diffstat (limited to 'lib/kernel/src/inet6_tcp.erl')
-rw-r--r--lib/kernel/src/inet6_tcp.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/kernel/src/inet6_tcp.erl b/lib/kernel/src/inet6_tcp.erl
index c714b2bee0..b31f05b08a 100644
--- a/lib/kernel/src/inet6_tcp.erl
+++ b/lib/kernel/src/inet6_tcp.erl
@@ -24,10 +24,29 @@
-export([controlling_process/2]).
-export([fdopen/2]).
+-export([family/0, mask/2, parse_address/1]).
-export([getserv/1, getaddr/1, getaddr/2, getaddrs/1, getaddrs/2]).
-include("inet_int.hrl").
+%% my address family
+family() -> inet6.
+
+%% Apply netmask on address
+mask({M1,M2,M3,M4,M5,M6,M7,M8}, {IP1,IP2,IP3,IP4,IP5,IP6,IP7,IP8}) ->
+ {M1 band IP1,
+ M2 band IP2,
+ M3 band IP3,
+ M4 band IP4,
+ M5 band IP5,
+ M6 band IP6,
+ M7 band IP7,
+ M8 band IP8 }.
+
+%% Parse address string
+parse_address(Host) ->
+ inet_parse:ipv6strict_address(Host).
+
%% inet_tcp port lookup
getserv(Port) when is_integer(Port) -> {ok, Port};
getserv(Name) when is_atom(Name) -> inet:getservbyname(Name,tcp).