Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0337-Fix-type-specs-for-SCTP-get-set-opts-revis...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0337-Fix-type-specs-for-SCTP-get-set-opts-revised.patch of Package erlang
From 700633259eac28b889f3a7d2a38c66185a994717 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Wed, 18 May 2022 15:59:56 +0200 Subject: [PATCH 2/2] Fix type specs for SCTP get/set opts, revised Revert the exported type names in gen_sctp to option() and option_name(). We cannot change them since they are a part of the API. So we should be backwards compatible and keep the names although they are somewhat misleading. Add gen_sctp:option_value() for the returned option values, and use that in an also added inet:socket_optval(). Use the latter for the return value of inet:getopts/2, which is the a correction and therefore not backwards incompatible. Separate the "Data Types" section in gen_sctp and inet into "Exported data types" and "Internal data types", and place the defined types in the right sub section. --- lib/kernel/doc/src/gen_sctp.xml | 50 +++++++++----- lib/kernel/doc/src/inet.xml | 113 +++++++++++++++++--------------- lib/kernel/src/gen_sctp.erl | 31 ++++----- lib/kernel/src/inet.erl | 12 ++-- 4 files changed, 115 insertions(+), 91 deletions(-) diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml index 77659c7b47..86a0019f29 100644 --- a/lib/kernel/doc/src/gen_sctp.xml +++ b/lib/kernel/doc/src/gen_sctp.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2007</year><year>2021</year> + <year>2007</year><year>2022</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -69,6 +69,7 @@ </description> <datatypes> + <datatype_title>Exported data types</datatype_title> <datatype> <name>assoc_id()</name> <desc> @@ -79,26 +80,47 @@ </desc> </datatype> <datatype> - <name name="setoption"/> + <name name="option"/> <desc> - <p>One of the - <seeerl marker="#options">SCTP Socket Options</seeerl> used to set an option.</p> + <p> + One of the + <seeerl marker="#options">SCTP Socket Options</seeerl> + used to set an option. + </p> </desc> </datatype> <datatype> - <name name="getoption"/> + <name name="option_name"/> <desc> - <p>One of the - <seeerl marker="#options">SCTP Socket Options</seeerl> or name used to get an option.</p> + <p> + An option name or one of the + <seeerl marker="#options">SCTP Socket Options</seeerl> + used to get an option. + </p> </desc> </datatype> <datatype> - <name name="optionval"/> + <name name="option_value"/> <desc> - <p>One of the - <seeerl marker="#options">SCTP Socket Options</seeerl>.</p> + <p> + One of the + <seeerl marker="#options">SCTP Socket Options</seeerl> + as returned when getting an option. + </p> + </desc> + </datatype> + <datatype> + <name>sctp_socket()</name> + <desc> + <p>Socket identifier returned from + <seemfa marker="#open/0"><c>open/*</c></seemfa>.</p> + <marker id="exports"></marker> </desc> </datatype> + </datatypes> + + <datatypes> + <datatype_title>Internal data types</datatype_title> <datatype> <name name="elementary_option"/> </datatype> @@ -111,14 +133,6 @@ <datatype> <name name="ro_option"/> </datatype> - <datatype> - <name>sctp_socket()</name> - <desc> - <p>Socket identifier returned from - <seemfa marker="#open/0"><c>open/*</c></seemfa>.</p> - <marker id="exports"></marker> - </desc> - </datatype> </datatypes> <funcs> diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index def35d4c97..1e32d5a815 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2021</year> + <year>1997</year><year>2022</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -92,6 +92,7 @@ fe80::204:acff:fe17:bf38 </description> <datatypes> + <datatype_title>Exported data types</datatype_title> <datatype> <name name="hostent"/> <desc> @@ -129,30 +130,6 @@ fe80::204:acff:fe17:bf38 </p> </desc> </datatype> - <datatype> - <name name="inet_address" since="OTP 22.1"/> - <desc> - <warning> - <p> - This address format is for now experimental - and for completeness to make all address families have a - <c>{Family, Destination}</c> representation. - </p> - </warning> - </desc> - </datatype> - <datatype> - <name name="inet6_address" since="OTP 22.1"/> - <desc> - <warning> - <p> - This address format is for now experimental - and for completeness to make all address families have a - <c>{Family, Destination}</c> representation. - </p> - </warning> - </desc> - </datatype> <datatype> <name name="local_address"/> <desc> @@ -259,6 +236,61 @@ fe80::204:acff:fe17:bf38 </p> </desc> </datatype> + <datatype> + <name name="posix"/> + <desc> + <p>An atom that is named from the POSIX error codes used in Unix, + and in the runtime libraries of most C compilers. See section + <seeerl marker="#error_codes">POSIX Error Codes</seeerl>.</p> + </desc> + </datatype> + <datatype> + <name>socket()</name> + <desc> + <p>See + <seetype marker="gen_tcp#socket"><c>gen_tcp:type-socket</c></seetype> + and + <seetype marker="gen_udp#socket"><c>gen_udp:type-socket</c></seetype>. + </p> + </desc> + </datatype> + <datatype> + <name name="address_family"/> + </datatype> + <datatype> + <name name="socket_protocol"/> + </datatype> + <datatype> + <name name="stat_option"/> + </datatype> + </datatypes> + + <datatypes> + <datatype_title>Internal data types</datatype_title> + <datatype> + <name name="inet_address" since="OTP 22.1"/> + <desc> + <warning> + <p> + This address format is for now experimental + and for completeness to make all address families have a + <c>{Family, Destination}</c> representation. + </p> + </warning> + </desc> + </datatype> + <datatype> + <name name="inet6_address" since="OTP 22.1"/> + <desc> + <warning> + <p> + This address format is for now experimental + and for completeness to make all address families have a + <c>{Family, Destination}</c> representation. + </p> + </warning> + </desc> + </datatype> <datatype> <name name="getifaddrs_ifopts"/> <desc> @@ -332,35 +364,9 @@ fe80::204:acff:fe17:bf38 </warning> </desc> </datatype> - <datatype> - <name name="posix"/> - <desc> - <p>An atom that is named from the POSIX error codes used in Unix, - and in the runtime libraries of most C compilers. See section - <seeerl marker="#error_codes">POSIX Error Codes</seeerl>.</p> - </desc> - </datatype> - <datatype> - <name>socket()</name> - <desc> - <p>See - <seetype marker="gen_tcp#socket"><c>gen_tcp:type-socket</c></seetype> - and - <seetype marker="gen_udp#socket"><c>gen_udp:type-socket</c></seetype>. - </p> - </desc> - </datatype> - <datatype> - <name name="address_family"/> - </datatype> - <datatype> - <name name="socket_protocol"/> - </datatype> - <datatype> - <name name="stat_option"/> - </datatype> </datatypes> + <funcs> <func> <name name="close" arity="1" since=""/> @@ -560,7 +566,8 @@ fe80::204:acff:fe17:bf38 <p>Gets one or more options for a socket. For a list of available inet options, see <seemfa marker="#setopts/2"><c>setopts/2</c></seemfa>. - See also the descriptions for the protocol specific types referenced by + See also the descriptions + for the protocol specific types referenced by <seetype marker="#socket_optval"> <c>socket_optval()</c> </seetype>.</p> diff --git a/lib/kernel/src/gen_sctp.erl b/lib/kernel/src/gen_sctp.erl index 2092f6cb24..32b661b9f0 100644 --- a/lib/kernel/src/gen_sctp.erl +++ b/lib/kernel/src/gen_sctp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2021. All Rights Reserved. +%% Copyright Ericsson AB 2007-2022. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -38,16 +38,16 @@ -type assoc_id() :: term(). --type setoption() :: +-type option() :: elementary_option() | record_option(). --type getoption() :: +-type option_name() :: elementary_option_name() | record_option() | ro_option(). --type optionval() :: +-type option_value() :: elementary_option() | record_option() | ro_option(). @@ -120,7 +120,8 @@ -type sctp_socket() :: port(). --export_type([assoc_id/0, setoption/0, getoption/0, optionval/0, sctp_socket/0]). +-export_type( + [assoc_id/0, option/0, option_name/0, option_value/0, sctp_socket/0]). -spec open() -> {ok, Socket} | {error, inet:posix()} when Socket :: sctp_socket(). @@ -140,7 +141,7 @@ open() -> | {type, SockType} | {netns, file:filename_all()} | {bind_to_device, binary()} - | setoption(), + | option(), IP :: inet:ip_address() | any | loopback, SockAddr :: socket:sockaddr_in() | socket:sockaddr_in6(), Port :: inet:port_number(), @@ -170,7 +171,7 @@ open(X) -> | {type, SockType} | {netns, file:filename_all()} | {bind_to_device, binary()} - | setoption(), + | option(), IP :: inet:ip_address() | any | loopback, SockAddr :: socket:sockaddr_in() | socket:sockaddr_in6(), Port :: inet:port_number(), @@ -238,7 +239,7 @@ peeloff(S, AssocId) when is_port(S), is_integer(AssocId) -> when Socket :: sctp_socket(), SockAddr :: socket:sockaddr_in() | socket:sockaddr_in6(), - Opts :: [Opt :: setoption()]. + Opts :: [Opt :: option()]. connect(S, SockAddr, Opts) -> connect(S, SockAddr, Opts, infinity). @@ -250,7 +251,7 @@ connect(S, SockAddr, Opts) -> when Socket :: sctp_socket(), SockAddr :: socket:sockaddr_in() | socket:sockaddr_in6(), - Opts :: [Opt :: setoption()], + Opts :: [Opt :: option()], Timeout :: timeout(); (Socket, Addr, Port, Opts) -> {ok, #sctp_assoc_change{state :: 'comm_up'}} | @@ -260,7 +261,7 @@ connect(S, SockAddr, Opts) -> Socket :: sctp_socket(), Addr :: inet:ip_address() | inet:hostname(), Port :: inet:port_number(), - Opts :: [Opt :: setoption()]. + Opts :: [Opt :: option()]. connect(S, SockAddr, Opts, Timeout) when is_map(SockAddr) andalso is_list(Opts) -> @@ -281,7 +282,7 @@ connect(S, Addr, Port, Opts) -> Socket :: sctp_socket(), Addr :: inet:ip_address() | inet:hostname(), Port :: inet:port_number(), - Opts :: [Opt :: setoption()], + Opts :: [Opt :: option()], Timeout :: timeout(). connect(S, Addr, Port, Opts, Timeout) -> @@ -296,7 +297,7 @@ connect(S, Addr, Port, Opts, Timeout) -> ok | {error, inet:posix()} when Socket :: sctp_socket(), SockAddr :: socket:sockaddr_in() | socket:sockaddr_in6(), - Opts :: [setoption()]. + Opts :: [option()]. connect_init(S, SockAddr, Opts) -> connect_init(S, SockAddr, Opts, infinity). @@ -305,14 +306,14 @@ connect_init(S, SockAddr, Opts) -> ok | {error, inet:posix()} when Socket :: sctp_socket(), SockAddr :: socket:sockaddr_in() | socket:sockaddr_in6(), - Opts :: [setoption()], + Opts :: [option()], Timeout :: timeout(); (Socket, Addr, Port, Opts) -> ok | {error, inet:posix()} when Socket :: sctp_socket(), Addr :: inet:ip_address() | inet:hostname(), Port :: inet:port_number(), - Opts :: [setoption()]. + Opts :: [option()]. connect_init(S, SockAddr, Opts, Timeout) when is_map(SockAddr) andalso is_list(Opts) -> @@ -330,7 +331,7 @@ connect_init(S, Addr, Port, Opts) -> Socket :: sctp_socket(), Addr :: inet:ip_address() | inet:hostname(), Port :: inet:port_number(), - Opts :: [setoption()], + Opts :: [option()], Timeout :: timeout(). connect_init(S, Addr, Port, Opts, Timeout) -> diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl index a315625e4c..ea803edbc2 100644 --- a/lib/kernel/src/inet.erl +++ b/lib/kernel/src/inet.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2021. All Rights Reserved. +%% Copyright Ericsson AB 1997-2022. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -85,7 +85,8 @@ ip6_address/0, ip_address/0, port_number/0, family_address/0, local_address/0, socket_address/0, returned_non_ip_address/0, - socket_setopt/0, socket_getopt/0, ancillary_data/0, + socket_setopt/0, socket_getopt/0, socket_optval/0, + ancillary_data/0, posix/0, socket/0, inet_backend/0, stat_option/0]). %% imports -import(lists, [append/1, duplicate/2, filter/2, foldl/3]). @@ -144,13 +145,14 @@ -type inet_backend() :: {'inet_backend', 'inet' | 'socket'}. -type socket_setopt() :: - gen_sctp:setoption() | gen_tcp:option() | gen_udp:option(). + gen_sctp:option() | gen_tcp:option() | gen_udp:option(). -type socket_optval() :: - gen_sctp:optionval() | gen_tcp:option() | gen_udp:option() | gen_tcp:pktoptions_value(). + gen_sctp:option_value() | gen_tcp:option() | gen_udp:option() | + gen_tcp:pktoptions_value(). -type socket_getopt() :: - gen_sctp:getoption() | gen_tcp:option_name() | gen_udp:option_name(). + gen_sctp:option_name() | gen_tcp:option_name() | gen_udp:option_name(). -type ether_address() :: [0..255]. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor