From 8266a6056ff3b4292d98485665e5444addd689b6 Mon Sep 17 00:00:00 2001 From: Danil Zagoskin Date: Sat, 2 May 2015 00:40:53 +0300 Subject: 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. --- lib/kernel/src/inet6_tcp.erl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/kernel/src/inet6_tcp.erl') 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). -- cgit v1.2.3