diff options
author | Danil Zagoskin <[email protected]> | 2015-05-02 00:40:53 +0300 |
---|---|---|
committer | Danil Zagoskin <[email protected]> | 2015-05-02 00:40:53 +0300 |
commit | 8266a6056ff3b4292d98485665e5444addd689b6 (patch) | |
tree | 177254190b8902589970a20bb7a2398d84eb7554 /lib/kernel/src/inet_tcp.erl | |
parent | ff1e0b2fe44a347670a5d72c45c061fefa6abc7f (diff) | |
download | otp-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/inet_tcp.erl')
-rw-r--r-- | lib/kernel/src/inet_tcp.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/kernel/src/inet_tcp.erl b/lib/kernel/src/inet_tcp.erl index 4c2db16ce3..71d35ca8c6 100644 --- a/lib/kernel/src/inet_tcp.erl +++ b/lib/kernel/src/inet_tcp.erl @@ -26,11 +26,25 @@ -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() -> inet. + +%% Apply netmask on address +mask({M1,M2,M3,M4}, {IP1,IP2,IP3,IP4}) -> + {M1 band IP1, + M2 band IP2, + M3 band IP3, + M4 band IP4}. + +%% Parse address string +parse_address(Host) -> + inet_parse:ipv4strict_address(Host). + %% inet_tcp port lookup getserv(Port) when is_integer(Port) -> {ok, Port}; getserv(Name) when is_atom(Name) -> inet:getservbyname(Name,tcp). |