From 8f038ff05525c650d7538c895761a33b268fae9a Mon Sep 17 00:00:00 2001 From: Jakub Witczak Date: Mon, 28 Oct 2024 17:52:23 +0100 Subject: [PATCH 1/4] ssh: docs polishing - typo fix in system/doc/reference_manual/typespec.md rename - ConnectionHandler to ConnectionRef to make docs less confusing - add description summary(1st sentence) for ssh_connection:send/4 --- lib/ssh/src/ssh.erl | 2 +- lib/ssh/src/ssh_connection.erl | 118 ++++++++++++------------ system/doc/reference_manual/typespec.md | 2 +- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index b8f5957ac09d..8b93cd97908b 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -61,7 +61,7 @@ To write your own client channel handler, use the behaviour `m:ssh_client_channel`. For server channel handlers use `m:ssh_server_channel` behaviour (replaces ssh_daemon_channel). -Both clients and daemons accepts options that controls the exact behaviour. Some +Both clients and daemons accept options that control the exact behaviour. Some options are common to both. The three sets are called [Client Options](`t:client_options/0`), [Daemon Options](`t:daemon_options/0`) and [Common Options](`t:common_options/0`). diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index fe8b5e942f68..429aa02e7d1b 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -340,8 +340,8 @@ dummy(_) -> false. Timeout :: timeout(), Result :: {ok, ssh:channel_id()} | {error, reason()} . -session_channel(ConnectionHandler, Timeout) -> - session_channel(ConnectionHandler, undefined, undefined, Timeout). +session_channel(ConnectionRef, Timeout) -> + session_channel(ConnectionRef, undefined, undefined, Timeout). -doc """ @@ -355,8 +355,8 @@ is the id used as input to the other functions in this module. Timeout :: timeout(), Result :: {ok, ssh:channel_id()} | {error, reason()} . -session_channel(ConnectionHandler, InitialWindowSize, MaxPacketSize, Timeout) -> - open_channel(ConnectionHandler, "session", <<>>, +session_channel(ConnectionRef, InitialWindowSize, MaxPacketSize, Timeout) -> + open_channel(ConnectionRef, "session", <<>>, InitialWindowSize, MaxPacketSize, Timeout). @@ -365,11 +365,11 @@ session_channel(ConnectionHandler, InitialWindowSize, MaxPacketSize, Timeout) -> %% Description: Opens a channel for the given type. %% -------------------------------------------------------------------- -doc false. -open_channel(ConnectionHandler, Type, ChanData, Timeout) -> - open_channel(ConnectionHandler, Type, ChanData, undefined, undefined, Timeout). +open_channel(ConnectionRef, Type, ChanData, Timeout) -> + open_channel(ConnectionRef, Type, ChanData, undefined, undefined, Timeout). -open_channel(ConnectionHandler, Type, ChanData, InitialWindowSize, MaxPacketSize, Timeout) -> - case ssh_connection_handler:open_channel(ConnectionHandler, Type, ChanData, +open_channel(ConnectionRef, Type, ChanData, InitialWindowSize, MaxPacketSize, Timeout) -> + case ssh_connection_handler:open_channel(ConnectionRef, Type, ChanData, InitialWindowSize, MaxPacketSize, Timeout) of {open, Channel} -> @@ -414,8 +414,8 @@ See the User's Guide section on Command :: string(), Timeout :: timeout(). -exec(ConnectionHandler, ChannelId, Command, TimeOut) -> - ssh_connection_handler:request(ConnectionHandler, self(), ChannelId, "exec", +exec(ConnectionRef, ChannelId, Command, TimeOut) -> + ssh_connection_handler:request(ConnectionRef, self(), ChannelId, "exec", true, [?string(Command)], TimeOut). %%-------------------------------------------------------------------- @@ -437,8 +437,8 @@ would break a large number of existing software. ChannelId :: ssh:channel_id(), Result :: ok | success | failure | {error, timeout} . -shell(ConnectionHandler, ChannelId) -> - ssh_connection_handler:request(ConnectionHandler, self(), ChannelId, +shell(ConnectionRef, ChannelId) -> + ssh_connection_handler:request(ConnectionRef, self(), ChannelId, "shell", false, <<>>, 0). %%-------------------------------------------------------------------- %% @@ -457,8 +457,8 @@ The function [`subsystem/4`](`subsystem/4`) and subsequent calls of Subsystem :: string(), Timeout :: timeout(). -subsystem(ConnectionHandler, ChannelId, SubSystem, TimeOut) -> - ssh_connection_handler:request(ConnectionHandler, self(), +subsystem(ConnectionRef, ChannelId, SubSystem, TimeOut) -> + ssh_connection_handler:request(ConnectionRef, self(), ChannelId, "subsystem", true, [?string(SubSystem)], TimeOut). %%-------------------------------------------------------------------- @@ -466,51 +466,51 @@ subsystem(ConnectionHandler, ChannelId, SubSystem, TimeOut) -> %%-------------------------------------------------------------------- -doc(#{equiv => send/5}). -spec send(connection_ref(), channel_id(), iodata()) -> - ok | {error, timeout | closed}. + ok | {error, reason()}. -send(ConnectionHandler, ChannelId, Data) -> - send(ConnectionHandler, ChannelId, 0, Data, infinity). +send(ConnectionRef, ChannelId, Data) -> + send(ConnectionRef, ChannelId, 0, Data, infinity). -doc """ send(ConnectionRef, ChannelId, Type, Data) +Depending on input arguments equivalent to one of `send/5` calls specified below. + Equivalent to [send(ConnectionRef, ChannelId, 0, Data, TimeOut)](`send/5`) if called with TimeOut being integer. Equivalent to [send(ConnectionRef, ChannelId, 0, Data, infinity)](`send/5`) if called with TimeOut being infinity atom. -Equivalent to [send(ConnectionHandler, ChannelId, Type, Data, infinity)](`send/5`) if +Equivalent to [send(ConnectionRef, ChannelId, Type, Data, infinity)](`send/5`) if called with last argument which is not integer or infinity atom. """. --spec send(connection_ref(), channel_id(), iodata(), timeout()) -> ok | {error, reason()}; - (connection_ref(), channel_id(), ssh_data_type_code(), iodata()) -> ok | {error, reason()}. +-spec send(connection_ref(), channel_id(), iodata(), timeout()) -> ok | {error, reason()}; + (connection_ref(), channel_id(), ssh_data_type_code(), iodata()) -> ok | {error, reason()}. -send(ConnectionHandler, ChannelId, Data, TimeOut) when is_integer(TimeOut) -> - send(ConnectionHandler, ChannelId, 0, Data, TimeOut); +send(ConnectionRef, ChannelId, Data, TimeOut) when is_integer(TimeOut) -> + send(ConnectionRef, ChannelId, 0, Data, TimeOut); -send(ConnectionHandler, ChannelId, Data, infinity) -> - send(ConnectionHandler, ChannelId, 0, Data, infinity); +send(ConnectionRef, ChannelId, Data, infinity) -> + send(ConnectionRef, ChannelId, 0, Data, infinity); -send(ConnectionHandler, ChannelId, Type, Data) -> - send(ConnectionHandler, ChannelId, Type, Data, infinity). +send(ConnectionRef, ChannelId, Type, Data) -> + send(ConnectionRef, ChannelId, Type, Data, infinity). -doc """ -send(ConnectionRef, ChannelId, Type, Data, TimeOut) - Is to be called by client- and server-channel processes to send data to each other. The function `subsystem/4` and subsequent calls of `send/3,4,5` must be executed in the same process. """. --spec send(connection_ref(), channel_id(), ssh_data_type_code(), iodata(), timeout()) -> ok | {error, reason()}. +-spec send(connection_ref(), channel_id(), ssh_data_type_code(), iodata(), timeout()) -> ok | {error, reason()}. -send(ConnectionHandler, ChannelId, Type, Data, TimeOut) -> - ssh_connection_handler:send(ConnectionHandler, ChannelId, +send(ConnectionRef, ChannelId, Type, Data, TimeOut) -> + ssh_connection_handler:send(ConnectionRef, ChannelId, Type, Data, TimeOut). %%-------------------------------------------------------------------- -doc "Sends EOF on channel `ChannelId`.". @@ -521,8 +521,8 @@ send(ConnectionHandler, ChannelId, Type, Data, TimeOut) -> %% %% Description: Sends eof on the channel . %%-------------------------------------------------------------------- -send_eof(ConnectionHandler, Channel) -> - ssh_connection_handler:send_eof(ConnectionHandler, Channel). +send_eof(ConnectionRef, Channel) -> + ssh_connection_handler:send_eof(ConnectionRef, Channel). %%-------------------------------------------------------------------- -doc """ @@ -545,8 +545,8 @@ server-side channel processes. %% %% Description: Adjusts the ssh flowcontrol window. %%-------------------------------------------------------------------- -adjust_window(ConnectionHandler, Channel, Bytes) -> - ssh_connection_handler:adjust_window(ConnectionHandler, Channel, Bytes). +adjust_window(ConnectionRef, Channel, Bytes) -> + ssh_connection_handler:adjust_window(ConnectionRef, Channel, Bytes). %%-------------------------------------------------------------------- -doc """ @@ -563,11 +563,11 @@ called by a client channel processes. %% %% Description: Environment variables may be passed to the shell/command to be %% started later. -setenv(ConnectionHandler, ChannelId, Var, Value, TimeOut) -> - setenv(ConnectionHandler, ChannelId, true, Var, Value, TimeOut). +setenv(ConnectionRef, ChannelId, Var, Value, TimeOut) -> + setenv(ConnectionRef, ChannelId, true, Var, Value, TimeOut). -setenv(ConnectionHandler, ChannelId, WantReply, Var, Value, TimeOut) -> - case ssh_connection_handler:request(ConnectionHandler, ChannelId, +setenv(ConnectionRef, ChannelId, WantReply, Var, Value, TimeOut) -> + case ssh_connection_handler:request(ConnectionRef, ChannelId, "env", WantReply, [?string(Var), ?string(Value)], TimeOut) of ok when WantReply == false -> @@ -593,8 +593,8 @@ a close event. %% %% Description: Sends a close message on the channel . %%-------------------------------------------------------------------- -close(ConnectionHandler, ChannelId) -> - ssh_connection_handler:close(ConnectionHandler, ChannelId). +close(ConnectionRef, ChannelId) -> + ssh_connection_handler:close(ConnectionRef, ChannelId). %%-------------------------------------------------------------------- -doc """ @@ -612,8 +612,8 @@ Protocol message containing a `WantReply` boolean value. %% %% Description: Send status replies to requests that want such replies. %%-------------------------------------------------------------------- -reply_request(ConnectionHandler, true, Status, ChannelId) -> - ssh_connection_handler:reply_request(ConnectionHandler, Status, ChannelId); +reply_request(ConnectionRef, true, Status, ChannelId) -> + ssh_connection_handler:reply_request(ConnectionRef, Status, ChannelId); reply_request(_,false, _, _) -> ok. @@ -627,8 +627,8 @@ reply_request(_,false, _, _) -> ChannelId :: ssh:channel_id(), Options :: proplists:proplist(). -ptty_alloc(ConnectionHandler, Channel, Options) -> - ptty_alloc(ConnectionHandler, Channel, Options, infinity). +ptty_alloc(ConnectionRef, Channel, Options) -> + ptty_alloc(ConnectionRef, Channel, Options, infinity). -doc """ @@ -659,11 +659,11 @@ Options: Options :: proplists:proplist(), Timeout :: timeout(). -ptty_alloc(ConnectionHandler, Channel, Options0, TimeOut) -> +ptty_alloc(ConnectionRef, Channel, Options0, TimeOut) -> TermData = backwards_compatible(Options0, []), % FIXME {Width, PixWidth} = pty_default_dimensions(width, TermData), {Height, PixHeight} = pty_default_dimensions(height, TermData), - pty_req(ConnectionHandler, Channel, + pty_req(ConnectionRef, Channel, proplists:get_value(term, TermData, os:getenv("TERM", ?DEFAULT_TERMINAL)), proplists:get_value(width, TermData, Width), proplists:get_value(height, TermData, Height), @@ -678,19 +678,19 @@ ptty_alloc(ConnectionHandler, Channel, Options0, TimeOut) -> %% Should they be documented and tested? %%-------------------------------------------------------------------- -doc false. -window_change(ConnectionHandler, Channel, Width, Height) -> - window_change(ConnectionHandler, Channel, Width, Height, 0, 0). +window_change(ConnectionRef, Channel, Width, Height) -> + window_change(ConnectionRef, Channel, Width, Height, 0, 0). -doc false. -window_change(ConnectionHandler, Channel, Width, Height, +window_change(ConnectionRef, Channel, Width, Height, PixWidth, PixHeight) -> - ssh_connection_handler:request(ConnectionHandler, Channel, + ssh_connection_handler:request(ConnectionRef, Channel, "window-change", false, [?uint32(Width), ?uint32(Height), ?uint32(PixWidth), ?uint32(PixHeight)], 0). -doc false. -signal(ConnectionHandler, Channel, Sig) -> - ssh_connection_handler:request(ConnectionHandler, Channel, +signal(ConnectionRef, Channel, Sig) -> + ssh_connection_handler:request(ConnectionRef, Channel, "signal", false, [?string(Sig)], 0). @@ -702,8 +702,8 @@ to the client. ConnectionRef :: ssh:connection_ref(), ChannelId :: ssh:channel_id(), Status :: integer(). -exit_status(ConnectionHandler, Channel, Status) -> - ssh_connection_handler:request(ConnectionHandler, Channel, +exit_status(ConnectionRef, Channel, Status) -> + ssh_connection_handler:request(ConnectionRef, Channel, "exit-status", false, [?uint32(Status)], 0). %%-------------------------------------------------------------------- @@ -1555,9 +1555,9 @@ flow_control(_,_,_) -> %%% Pseudo terminal stuff %%% -pty_req(ConnectionHandler, Channel, Term, Width, Height, +pty_req(ConnectionRef, Channel, Term, Width, Height, PixWidth, PixHeight, PtyOpts, TimeOut) -> - ssh_connection_handler:request(ConnectionHandler, + ssh_connection_handler:request(ConnectionRef, Channel, "pty-req", true, [?string(Term), ?uint32(Width), ?uint32(Height), @@ -1867,14 +1867,14 @@ request_reply_or_data(#channel{local_id = ChannelId, user = ChannelPid}, %%%---------------------------------------------------------------- -doc false. -send_environment_vars(ConnectionHandler, Channel, VarNames) -> +send_environment_vars(ConnectionRef, Channel, VarNames) -> lists:foldl( fun(Var, success) -> case os:getenv(Var) of false -> success; Value -> - setenv(ConnectionHandler, Channel, false, + setenv(ConnectionRef, Channel, false, Var, Value, infinity) end end, success, VarNames). diff --git a/system/doc/reference_manual/typespec.md b/system/doc/reference_manual/typespec.md index 5dd75934b50c..07931e81f062 100644 --- a/system/doc/reference_manual/typespec.md +++ b/system/doc/reference_manual/typespec.md @@ -263,7 +263,7 @@ Records are extended to possibly contain type information. This is described in > #### Change {: .info } > -> Starting from Erlang/OTP 26, is is permitted to define a type having the same +> Starting from Erlang/OTP 26, it is permitted to define a type having the same > name as a built-in type. It is recommended to avoid deliberately reusing built-in names because it can be From 5c7d7bb34eb4ec0433353174826670b5e052e9f8 Mon Sep 17 00:00:00 2001 From: Jakub Witczak Date: Tue, 29 Oct 2024 15:37:06 +0100 Subject: [PATCH 2/4] ssh: docs reduce length of types categories --- lib/ssh/doc/docs.exs | 8 ++++ lib/ssh/src/ssh.erl | 2 +- lib/ssh/src/ssh.hrl | 76 +++++++++++++++--------------- lib/ssh/src/ssh_agent.erl | 8 ++-- lib/ssh/src/ssh_client_channel.erl | 17 ++++--- lib/ssh/src/ssh_connection.erl | 62 ++++++++++++++---------- lib/ssh/src/ssh_file.erl | 20 ++++---- lib/ssh/src/ssh_server_channel.erl | 11 ++--- lib/ssh/src/ssh_sftp.erl | 25 +++++----- 9 files changed, 123 insertions(+), 106 deletions(-) diff --git a/lib/ssh/doc/docs.exs b/lib/ssh/doc/docs.exs index 5be009769193..da49fb1cf7b2 100644 --- a/lib/ssh/doc/docs.exs +++ b/lib/ssh/doc/docs.exs @@ -1,4 +1,12 @@ [ + annotations_for_docs: fn + md -> + if md[:rfc] do + [md[:rfc]] + else + [] + end + end, ## The order of these items determine ## how they are listed in the docs extras: [ diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 8b93cd97908b..aa9452103a7e 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -133,7 +133,7 @@ The directory could be changed with the option """. -moduledoc(#{titles => [{type,<<"Client Options">>}, - {type,<<"Daemon Options (Server Options)">>}, + {type,<<"Daemon Options">>}, {type,<<"Common Options">>}, {type,<<"Other data types">>}]}). diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl index f78a6e4cea88..fc3259d929b0 100644 --- a/lib/ssh/src/ssh.hrl +++ b/lib/ssh/src/ssh.hrl @@ -150,7 +150,7 @@ If the subsystems option is not present, the value of default. The option can be set to the empty list if you do not want the daemon to run any subsystems. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type subsystem_spec() :: {Name::string(), mod_args()} . -doc(#{title => <<"Common Options">>, @@ -327,7 +327,7 @@ For background and more examples see the -doc(#{title => <<"Client Options">>,equiv => client_option/0}). -type client_options() :: [ client_option() ] . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => daemon_option/0}). -type daemon_options() :: [ daemon_option() ]. @@ -712,7 +712,7 @@ Also note that setting a `t:gen_tcp:listen_option/0` could change the socket in a way that impacts the ssh deamon's behaviour negatively. You use it on your own risk. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type daemon_option() :: subsystem_daemon_option() | shell_daemon_option() @@ -732,23 +732,23 @@ risk. | gen_tcp:listen_option() | ?COMMON_OPTION . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => subsystem_spec/0}). -type subsystem_daemon_option() :: {subsystems, subsystem_specs()}. --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => subsystem_spec/0}). -type subsystem_specs() :: [ subsystem_spec() ]. --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => 'shell_fun/2'/0}). -type shell_daemon_option() :: {shell, shell_spec()} . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => 'shell_fun/2'/0}). -type shell_spec() :: mod_fun_args() | shell_fun() | disabled . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => 'shell_fun/2'/0}). -type shell_fun() :: 'shell_fun/1'() | 'shell_fun/2'() . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => 'shell_fun/2'/0}). -type 'shell_fun/1'() :: fun((User::string()) -> pid()) . -doc """ @@ -759,23 +759,23 @@ See the option [`exec-option`](`t:exec_daemon_option/0`) for a description of how the daemon executes shell-requests and exec-requests depending on the shell- and exec-options. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type 'shell_fun/2'() :: fun((User::string(), PeerAddr::inet:ip_address()) -> pid()). --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => exec_spec/0}). -type exec_daemon_option() :: {exec, exec_spec()} . --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type exec_spec() :: {direct, exec_fun()} | disabled | deprecated_exec_opt(). --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type exec_fun() :: 'exec_fun/1'() | 'exec_fun/2'() | 'exec_fun/3'(). --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => 'exec_fun/3'/0}). -type 'exec_fun/1'() :: fun((Cmd::string()) -> exec_result()) . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => 'exec_fun/3'/0}). -type 'exec_fun/2'() :: fun((Cmd::string(), User::string()) -> exec_result()) . --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type 'exec_fun/3'() :: fun((Cmd::string(), User::string(), ClientAddr::ip_port()) -> exec_result()) . -doc """ This option changes how the daemon executes exec-requests from clients. The term @@ -847,13 +847,13 @@ implied by the custom CLI. > retained but obey the rules 1-6 above if conflicting. The old and undocumented > style should not be used in new programs. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type exec_result() :: {ok,Result::term()} | {error,Reason::term()} . -doc """ Old-style exec specification that are kept for compatibility, but should not be used in new programs """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type deprecated_exec_opt() :: fun() | mod_fun_args() . -doc """ @@ -866,20 +866,20 @@ own CLI channel. If `ssh_cli` is set to `no_cli`, the CLI channels like [`shell`](`t:shell_daemon_option/0`) and [`exec`](`t:exec_daemon_option/0`) are disabled and only subsystem channels are allowed. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type ssh_cli_daemon_option() :: {ssh_cli, mod_args() | no_cli }. -doc """ Enables (`true`) or disables (`false`) the possibility to tunnel a TCP/IP connection out of a [server](`daemon/2`). Disabled per default. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type tcpip_tunnel_out_daemon_option() :: {tcpip_tunnel_out, boolean()} . -doc """ Enables (`true`) or disables (`false`) the possibility to tunnel a TCP/IP connection in to a [server](`daemon/2`). Disabled per default. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type tcpip_tunnel_in_daemon_option() :: {tcpip_tunnel_in, boolean()} . -doc """ @@ -892,10 +892,10 @@ extensions. Default value is `true` which is compatible with other implementations not supporting ext-info. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type send_ext_info_daemon_option() :: {send_ext_info, boolean()} . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => pwdfun_4/0}). -type authentication_daemon_options() :: ssh_file:system_dir_daemon_option() @@ -907,7 +907,7 @@ supporting ext-info. | {no_auth_needed, boolean()} . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => pwdfun_4/0}). -type prompt_texts() :: kb_int_tuple() @@ -915,17 +915,17 @@ supporting ext-info. | kb_int_fun_4() . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => pwdfun_4/0}). -type kb_int_fun_3() :: fun((Peer::ip_port(), User::string(), Service::string()) -> kb_int_tuple()). --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => pwdfun_4/0}). -type kb_int_fun_4() :: fun((Peer::ip_port(), User::string(), Service::string(), State::any()) -> kb_int_tuple()). --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => pwdfun_4/0}). -type kb_int_tuple() :: {Name::string(), Instruction::string(), Prompt::string(), Echo::boolean()}. --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => pwdfun_4/0}). -type pwdfun_2() :: fun((User::string(), Password::string()|pubkey) -> boolean()) . -doc """ @@ -1025,7 +1025,7 @@ supporting ext-info. The default value is `false`. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type pwdfun_4() :: fun((User::string(), Password::string()|pubkey, PeerAddress::ip_port(), @@ -1033,16 +1033,16 @@ supporting ext-info. boolean() | disconnect | {boolean(),NewState::any()} ) . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => ssh_moduli_file/0}). -type diffie_hellman_group_exchange_daemon_option() :: {dh_gex_groups, [explicit_group()] | explicit_group_file() | ssh_moduli_file()} | {dh_gex_limits, {Min::pos_integer(), Max::pos_integer()} } . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => ssh_moduli_file/0}). -type explicit_group() :: {Size::pos_integer(),G::pos_integer(),P::pos_integer()} . --doc(#{title => <<"Daemon Options (Server Options)">>, +-doc(#{title => <<"Daemon Options">>, equiv => ssh_moduli_file/0}). -type explicit_group_file() :: {file,string()} . -doc """ @@ -1078,7 +1078,7 @@ supporting ext-info. See [RFC 4419](https://tools.ietf.org/html/rfc4419) for the function of the Max and Min values. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type ssh_moduli_file() :: {ssh_moduli_file,string()}. -doc """ @@ -1089,7 +1089,7 @@ For more information about timeouts, see the [Timeouts section ](hardening.md#timeouts)in the User's Guide [Hardening](hardening.md) chapter. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type max_initial_idle_time_daemon_option() :: {max_initial_idle_time, timeout()} . -doc """ Maximum time in milliseconds for the authentication negotiation. Defaults to @@ -1100,7 +1100,7 @@ For more information about timeouts, see the [Timeouts section ](hardening.md#timeouts)in the User's Guide [Hardening](hardening.md) chapter. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type negotiation_timeout_daemon_option() :: {negotiation_timeout, timeout()} . -doc """ Maximum time in milliseconds for the first part of the ssh session setup, the @@ -1111,7 +1111,7 @@ For more information about timeouts, see the [Timeouts section ](hardening.md#timeouts)in the User's Guide [Hardening](hardening.md) chapter. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type hello_timeout_daemon_option() :: {hello_timeout, timeout()} . -doc """ @@ -1160,7 +1160,7 @@ in the User's Guide chapter. maximum packet size that the daemon will accept in channel open requests from the client. The default value is 0. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type hardening_daemon_options() :: {max_sessions, pos_integer()} | {max_channels, pos_integer()} @@ -1174,7 +1174,7 @@ in the User's Guide chapter. - **`failfun`** - Provides a fun to implement your own logging when a user fails to authenticate. """. --doc(#{title => <<"Daemon Options (Server Options)">>}). +-doc(#{title => <<"Daemon Options">>}). -type callbacks_daemon_options() :: {failfun, fun((User::string(), PeerAddress::inet:ip_address(), Reason::term()) -> _)} | {connectfun, fun((User::string(), PeerAddress::inet:ip_address(), Method::string()) ->_)} . diff --git a/lib/ssh/src/ssh_agent.erl b/lib/ssh/src/ssh_agent.erl index f8713a544519..5b1d0a00d7c0 100644 --- a/lib/ssh/src/ssh_agent.erl +++ b/lib/ssh/src/ssh_agent.erl @@ -58,7 +58,7 @@ option can be set. """. -moduledoc(#{since => "OTP 23.0", titles => - [{type,<<"Options for the ssh_agent callback module">>}]}). + [{type,<<"Options">>}]}). -behaviour(ssh_client_key_api). @@ -72,19 +72,19 @@ option can be set. Sets the [socket path](`m:ssh_agent#SOCKET_PATH`) for the communication with the agent. """. --doc(#{title => <<"Options for the ssh_agent callback module">>}). +-doc(#{title => <<"Options">>}). -type socket_path_option() :: {socket_path, string()}. -doc """ Sets the time-out in milliseconds when communicating with the agent via the socket. The default value is `1000`. """. --doc(#{title => <<"Options for the ssh_agent callback module">>}). +-doc(#{title => <<"Options">>}). -type timeout_option() :: {timeout, integer()}. -doc """ The module which the `add_host_key` and `is_host_key` callbacks are delegated to. Defaults to the `m:ssh_file` module. """. --doc(#{title => <<"Options for the ssh_agent callback module">>}). +-doc(#{title => <<"Options">>}). -type call_ssh_file_option() :: {call_ssh_file, atom()}. %% ssh_client_key_api implementation diff --git a/lib/ssh/src/ssh_client_channel.erl b/lib/ssh/src/ssh_client_channel.erl index 35ac3ba2e055..bcc2848b50ef 100644 --- a/lib/ssh/src/ssh_client_channel.erl +++ b/lib/ssh/src/ssh_client_channel.erl @@ -58,8 +58,7 @@ The timeout values that can be returned by the callback functions have the same semantics as in a `m:gen_server`. If the time-out occurs, `c:handle_msg/2` is called as handle_msg(timeout, State). """. --moduledoc(#{since => "OTP 21.0", - titles => [{callback,<<"Callback Functions">>}]}). +-moduledoc(#{since => "OTP 21.0"}). -include("ssh.hrl"). -include("ssh_connect.hrl"). @@ -71,7 +70,7 @@ initializations succeed. For more detailed information on time-outs, see Section [Callback timeouts](`m:ssh_client_channel#module-callback-timeouts`). """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback init(Args :: term()) -> {ok, State :: term()} | {ok, State :: term(), timeout() | hibernate} | {stop, Reason :: term()} | ignore. @@ -81,7 +80,7 @@ Handles messages sent by calling [call/2,3](`call/2`) For more detailed information on time-outs,, see Section [Callback timeouts](`m:ssh_client_channel#module-callback-timeouts`). """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback handle_call(Request :: term(), From :: {pid(), Tag :: term()}, State :: term()) -> {reply, Reply :: term(), NewState :: term()} | @@ -96,7 +95,7 @@ Handles messages sent by calling [`cast/2`](`cast/2`). For more detailed information on time-outs, see Section [Callback timeouts](`m:ssh_client_channel#module-callback-timeouts`). """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback handle_cast(Request :: term(), State :: term()) -> {noreply, NewState :: term()} | {noreply, NewState :: term(), timeout() | hibernate} | @@ -110,7 +109,7 @@ called earlier. This function does any necessary cleaning up. When it returns, the channel process terminates with reason `Reason`. The return value is ignored. """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback terminate(Reason :: (normal | shutdown | {shutdown, term()} | term()), State :: term()) -> @@ -134,7 +133,7 @@ Handling Instructions in the > handle two versions of the state, but this function cannot be used in the > normal way. """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback code_change(OldVsn :: (term() | {down, term()}), State :: term(), Extra :: term()) -> {ok, NewState :: term()} | {error, Reason :: term()}. @@ -153,7 +152,7 @@ channels are to handle the following message. from it. If the message is not useful for your particular scenario, ignore it by immediately returning `{ok, State}`. """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback handle_msg(Msg ::term(), State :: term()) -> {ok, State::term()} | {stop, ChannelId::ssh:channel_id(), State::term()}. @@ -167,7 +166,7 @@ The following message is taken care of by the `ssh_client_channel` behavior. message to the other side, if such a message has not already been sent. Then it terminates the channel with reason `normal`. """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback handle_ssh_msg(ssh_connection:event(), State::term()) -> {ok, State::term()} | {stop, ChannelId::ssh:channel_id(), diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index 429aa02e7d1b..0743feb29731 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -29,7 +29,7 @@ This module provides API functions to send SSH Connection Protocol events to the other side of an SSH channel. -The [SSH Connection Protocol](http://www.ietf.org/rfc/rfc4254.txt) is used by +The [SSH Connection Protocol (RFC 4254)](http://www.ietf.org/rfc/rfc4254.txt) is used by clients and servers, that is, SSH channels, to communicate over the SSH connection. The API functions in this module send SSH Connection Protocol events, which are received as messages by the remote channel handling the remote @@ -43,15 +43,15 @@ these messages are handled by [handle_ssh_msg/2](`c:ssh_client_channel:handle_ssh_msg/2`). """. -moduledoc(#{titles => - [{type,<<"SSH Connection Protocol: General">>}, - {type,<<"Data Transfer (RFC 4254, section 5.2)">>}, - {type,<<"Closing a Channel (RFC 4254, section 5.3)">>}, - {type,<<"Requesting a Pseudo-Terminal (RFC 4254, section 6.2)">>}, - {type,<<"Environment Variable Passing (RFC 4254, section 6.4)">>}, - {type,<<"Starting a Shell or Command (RFC 4254, section 6.5)">>}, - {type,<<"Window Dimension Change Message (RFC 4254, section 6.7)">>}, - {type,<<"Signals (RFC 4254, section 6.9)">>}, - {type,<<"Returning Exit Status (RFC 4254, section 6.10)">>}]}). + [{type,<<"General">>}, + {type,<<"Data Transfer">>}, + {type,<<"Closing a Channel">>}, + {type,<<"Pseudo-Terminal">>}, + {type,<<"Environment Variable">>}, + {type,<<"Shell or Command">>}, + {type,<<"Window Change">>}, + {type,<<"Signals">>}, + {type,<<"Exit Status">>}]}). -include("ssh.hrl"). -include("ssh_connect.hrl"). @@ -150,7 +150,7 @@ The valid values are `0` ("normal") and `1` ("stderr"), see exec_ch_msg/0 ]). --doc(#{title => <<"SSH Connection Protocol: General">>, +-doc(#{title => <<"General">>, equiv => channel_msg/0}). -type event() :: {ssh_cm, ssh:connection_ref(), channel_msg()}. -doc """ @@ -160,7 +160,7 @@ handled as messages. When writing a channel handling process without using the support by the `m:ssh_client_channel` behavior the process must handle thoose messages. """. --doc(#{title => <<"SSH Connection Protocol: General">>}). +-doc(#{title => <<"General">>}). -type channel_msg() :: data_ch_msg() | eof_ch_msg() | closed_ch_msg() @@ -179,14 +179,15 @@ Messages that include a `WantReply` expect the channel handling process to call [ssh_connection:reply_request/4](`reply_request/4`) with the boolean value of `WantReply` as the second argument. """. --doc(#{title => <<"SSH Connection Protocol: General">>}). +-doc(#{title => <<"General">>}). -type want_reply() :: boolean(). -doc """ Data has arrived on the channel. This event is sent as a result of calling [ssh_connection:send/3,4,5](`send/3`). """. --doc(#{title => <<"Data Transfer (RFC 4254, section 5.2)">>}). +-doc(#{title => <<"Data Transfer">>, + rfc => ~"RFC 4254, section 5.2"}). -type data_ch_msg() :: {data, ssh:channel_id(), ssh_data_type_code(), @@ -196,7 +197,8 @@ Data has arrived on the channel. This event is sent as a result of calling Indicates that the other side sends no more data. This event is sent as a result of calling [ssh_connection:send_eof/2](`send_eof/2`). """. --doc(#{title => <<"Closing a Channel (RFC 4254, section 5.3)">>}). +-doc(#{title => <<"Closing a Channel">>, + rfc => ~"RFC 4254, section 5.3"}). -type eof_ch_msg() :: {eof, ssh:channel_id() } . @@ -207,7 +209,8 @@ this message. There is currently no function to generate this event as the signals referred to are on OS-level and not something generated by an Erlang program. """. --doc(#{title => <<"Signals (RFC 4254, section 6.9)">>}). +-doc(#{title => <<"Signals">>, + rfc => ~"RFC 4254, section 6.9"}). -type signal_ch_msg() :: {signal, ssh:channel_id(), SignalName :: string() @@ -218,7 +221,8 @@ message can be received. For details on valid string values, see [RFC 4254](https://tools.ietf.org/html/rfc4254#section-6.10) Section 6.10, which shows a special case of these signals. """. --doc(#{title => <<"Returning Exit Status (RFC 4254, section 6.10)">>}). +-doc(#{title => <<"Exit Status">>, + rfc => ~"RFC 4254, section 6.10"}). -type exit_signal_ch_msg() :: {exit_signal, ssh:channel_id(), ExitSignal :: string(), ErrorMsg :: string(), @@ -229,7 +233,8 @@ be sent to return the exit status of the command. A zero `exit_status` usually means that the command terminated successfully. This event is sent as a result of calling [ssh_connection:exit_status/3](`exit_status/3`). """. --doc(#{title => <<"Returning Exit Status (RFC 4254, section 6.10)">>}). +-doc(#{title => <<"Exit Status">>, + rfc => ~"RFC 4254, section 6.10"}). -type exit_status_ch_msg() :: {exit_status, ssh:channel_id(), ExitStatus :: non_neg_integer() @@ -239,7 +244,8 @@ This event is sent as a result of calling [ssh_connection:close/2](`close/2`). Both the handling of this event and sending it are taken care of by the `m:ssh_client_channel` behavior. """. --doc(#{title => <<"Closing a Channel (RFC 4254, section 5.3)">>}). +-doc(#{title => <<"Closing a Channel">>, + rfc => ~"RFC 4254, section 5.3"}). -type closed_ch_msg() :: {closed, ssh:channel_id() } . @@ -247,14 +253,16 @@ Both the handling of this event and sending it are taken care of by the Environment variables can be passed to the shell/command to be started later. This event is sent as a result of calling [ssh_connection:setenv/5](`setenv/5`). """. --doc(#{title => <<"Environment Variable Passing (RFC 4254, section 6.4)">>}). +-doc(#{title => <<"Environment Variable">>, + rfc => ~"RFC 4254, section 6.4"}). -type env_ch_msg() :: {env, ssh:channel_id(), want_reply(), Var :: string(), Value :: string() } . --doc(#{title => <<"Requesting a Pseudo-Terminal (RFC 4254, section 6.2)">>, +-doc(#{title => <<"Pseudo-Terminal">>, + rfc => ~"RFC 4254, section 6.2", equiv => term_mode/0}). -type pty_ch_msg() :: {pty, ssh:channel_id(), @@ -280,7 +288,8 @@ also be an `Opcode` if the mnemonic name is not listed in the RFC. Example: `OP code: 53, mnemonic name ECHO erlang atom: echo`. This event is sent as a result of calling [ssh_connection:ptty_alloc/4](`ptty_alloc/4`). """. --doc(#{title => <<"Requesting a Pseudo-Terminal (RFC 4254, section 6.2)">>}). +-doc(#{title => <<"Pseudo-Terminal">>, + rfc => ~"RFC 4254, section 6.2"}). -type term_mode() :: {Opcode :: atom() | byte(), Value :: non_neg_integer()} . @@ -288,7 +297,8 @@ result of calling [ssh_connection:ptty_alloc/4](`ptty_alloc/4`). This message requests that the user default shell is started at the other end. This event is sent as a result of calling [ssh_connection:shell/2](`shell/2`). """. --doc(#{title => <<"Starting a Shell or Command (RFC 4254, section 6.5)">>}). +-doc(#{title => <<"Shell or Command">>, + rfc => ~"RFC 4254, section 6.5"}). -type shell_ch_msg() :: {shell, ssh:channel_id(), want_reply() @@ -298,7 +308,8 @@ When the window (terminal) size changes on the client side, it _can_ send a message to the server side to inform it of the new dimensions. No API function generates this event. """. --doc(#{title => <<"Window Dimension Change Message (RFC 4254, section 6.7)">>}). +-doc(#{title => <<"Window Change">>, + rfc => ~"RFC 4254, section 6.7"}). -type window_change_ch_msg() :: {window_change, ssh:channel_id(), CharWidth :: non_neg_integer(), @@ -310,7 +321,8 @@ generates this event. This message requests that the server starts execution of the given command. This event is sent as a result of calling [ssh_connection:exec/4 ](`exec/4`). """. --doc(#{title => <<"Starting a Shell or Command (RFC 4254, section 6.5)">>}). +-doc(#{title => <<"Shell or Command">>, + rfc => ~"RFC 4254, section 6.5"}). -type exec_ch_msg() :: {exec, ssh:channel_id(), want_reply(), diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl index 403973dc81f0..d45b6df5a330 100644 --- a/lib/ssh/src/ssh_file.erl +++ b/lib/ssh/src/ssh_file.erl @@ -170,7 +170,7 @@ Clients uses all files stored in the [USERDIR](`m:ssh_file#USERDIR`) directory. """. -moduledoc(#{since => "OTP 21.2", titles => - [{type,<<"Options for the default ssh_file callback module">>}]}). + [{type,<<"Options">>}]}). -include_lib("public_key/include/public_key.hrl"). -include_lib("kernel/include/file.hrl"). @@ -186,7 +186,7 @@ Clients uses all files stored in the [USERDIR](`m:ssh_file#USERDIR`) directory. -export([host_key/2, is_auth_key/3]). -export_type([system_dir_daemon_option/0]). -doc "Sets the [system directory](`m:ssh_file#SYSDIR`).". --doc(#{title => <<"Options for the default ssh_file callback module">>}). +-doc(#{title => <<"Options">>}). -type system_dir_daemon_option() :: {system_dir, string()}. %%%--------------------- client exports --------------------------- @@ -199,7 +199,7 @@ supplied with thoose options. Note that EdDSA passhrases (Curves 25519 and 448) are not implemented. """. --doc(#{title => <<"Options for the default ssh_file callback module">>}). +-doc(#{title => <<"Options">>}). -type pubkey_passphrase_client_options() :: {dsa_pass_phrase, string()} | {rsa_pass_phrase, string()} %% Not yet implemented: | {ed25519_pass_phrase, string()} @@ -218,16 +218,16 @@ Note that EdDSA passhrases (Curves 25519 and 448) are not implemented. ]). -doc "Sets the [user directory](`m:ssh_file#USERDIR`).". --doc(#{title => <<"Options for the default ssh_file callback module">>}). +-doc(#{title => <<"Options">>}). -type user_dir_common_option() :: {user_dir, string()}. --doc(#{title => <<"Options for the default ssh_file callback module">>, +-doc(#{title => <<"Options">>, equiv => user2dir/0}). -type user_dir_fun_common_option() :: {user_dir_fun, user2dir()}. -doc """ Sets the [user directory](`m:ssh_file#USERDIR`) dynamically by evaluating the `user2dir` function. """. --doc(#{title => <<"Options for the default ssh_file callback module">>}). +-doc(#{title => <<"Options">>}). -type user2dir() :: fun((RemoteUserName::string()) -> UserDir :: string()) . -doc """ @@ -239,17 +239,17 @@ To set it, set the option `{key_cb, {ssh_file, [{optimize,TimeOrSpace}]}` in the call of ["ssh:connect/3](`ssh:connect/3`), `ssh:daemon/2` or similar function call that initiates an ssh connection. """. --doc(#{title => <<"Options for the default ssh_file callback module">>}). +-doc(#{title => <<"Options">>}). -type optimize_key_lookup() :: {optimize, time|space} . -doc "The key representation". --doc(#{title => <<"Options for the default ssh_file callback module">>}). +-doc(#{title => <<"Options">>}). -type key() :: public_key:public_key() | public_key:private_key() . --doc(#{title => <<"Options for the default ssh_file callback module">>, +-doc(#{title => <<"Options">>, equiv => openssh_key_v1_attributes/0}). -type experimental_openssh_key_v1() :: [{key(), openssh_key_v1_attributes()}]. -doc "Types for the experimental implementaition of the `openssh_key_v1` format.". --doc(#{title => <<"Options for the default ssh_file callback module">>}). +-doc(#{title => <<"Options">>}). -type openssh_key_v1_attributes() :: [{atom(),term()}]. %%%================================================================ diff --git a/lib/ssh/src/ssh_server_channel.erl b/lib/ssh/src/ssh_server_channel.erl index 77b013726245..955b34537dec 100644 --- a/lib/ssh/src/ssh_server_channel.erl +++ b/lib/ssh/src/ssh_server_channel.erl @@ -51,8 +51,7 @@ tree. > When implementing a client subsystem handler, use > [\-behaviour(ssh_client_channel)](`m:ssh_client_channel`) instead. """. --moduledoc(#{since => "OTP 21.0", - titles => [{callback,<<"Callback Functions">>}]}). +-moduledoc(#{since => "OTP 21.0"}). %% API to server side channel that can be plugged into the erlang ssh daemeon -doc """ @@ -63,7 +62,7 @@ The time-out values that can be returned have the same semantics as in a `m:gen_server`. If the time-out occurs, `c:handle_msg/2` is called as [`handle_msg(timeout, State)`](`c:handle_msg/2`). """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback init(Args :: term()) -> {ok, State :: term()} | {ok, State :: term(), timeout() | hibernate} | {stop, Reason :: term()} | ignore. @@ -76,7 +75,7 @@ called earlier. This function does any necessary cleaning up. When it returns, the channel process terminates with reason `Reason`. The return value is ignored. """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback terminate(Reason :: (normal | shutdown | {shutdown, term()} | term()), State :: term()) -> @@ -95,7 +94,7 @@ channels are to handle the following message. message from it. If the message is not useful for your particular scenario, ignore it by immediately returning `{ok, State}`. """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback handle_msg(Msg ::term(), State :: term()) -> {ok, State::term()} | {stop, ChannelId::ssh:channel_id(), State::term()}. -doc """ @@ -108,7 +107,7 @@ The following message is taken care of by the `ssh_server_channel` behavior. message to the other side, if such a message has not already been sent. Then it terminates the channel with reason `normal`. """. --doc(#{title => <<"Callback Functions">>,since => <<"OTP 21.0">>}). +-doc(#{since => <<"OTP 21.0">>}). -callback handle_ssh_msg(ssh_connection:event(), State::term()) -> {ok, State::term()} | {stop, ChannelId::ssh:channel_id(), diff --git a/lib/ssh/src/ssh_sftp.erl b/lib/ssh/src/ssh_sftp.erl index 31d3013e1f9f..cc9e27e00bf9 100644 --- a/lib/ssh/src/ssh_sftp.erl +++ b/lib/ssh/src/ssh_sftp.erl @@ -30,8 +30,7 @@ This module implements an SSH FTP (SFTP) client. SFTP is a secure, encrypted file transfer service available for SSH. """. -moduledoc(#{titles => - [{type,<<"Error cause">>}, - {type,<<"Crypto operations for open_tar">>}]}). + [{type,<<"Crypto open_tar">>}]}). -behaviour(ssh_client_channel). @@ -125,7 +124,7 @@ exit-signal. If that information is empty, the reason is the exit signal name. The `t:tuple/0` reason are other errors like for example `{exit_status,1}`. """. --doc(#{title => <<"Error cause">>}). +-doc(#{}). -type reason() :: atom() | string() | tuple() . %%==================================================================== @@ -318,11 +317,11 @@ open(Pid, File, Mode, FileOpTimeout) -> call(Pid, {open, false, File, Mode}, FileOpTimeout). --doc(#{title => <<"Crypto operations for open_tar">>, +-doc(#{title => <<"Crypto open_tar">>, equiv => decrypt_spec/0}). -type tar_crypto_spec() :: encrypt_spec() | decrypt_spec() . --doc(#{title => <<"Crypto operations for open_tar">>, +-doc(#{title => <<"Crypto open_tar">>, equiv => decrypt_spec/0}). -type encrypt_spec() :: {init_fun(), crypto_fun(), final_fun()} . -doc """ @@ -336,15 +335,15 @@ For code examples see Section [Example with encryption](using_ssh.md#example-with-encryption) in the ssh Users Guide. """. --doc(#{title => <<"Crypto operations for open_tar">>}). +-doc(#{title => <<"Crypto open_tar">>}). -type decrypt_spec() :: {init_fun(), crypto_fun()} . --doc(#{title => <<"Crypto operations for open_tar">>, +-doc(#{title => <<"Crypto open_tar">>, equiv => crypto_state/0}). -type init_fun() :: fun(() -> {ok,crypto_state()}) | fun(() -> {ok,crypto_state(),chunk_size()}) . --doc(#{title => <<"Crypto operations for open_tar">>, +-doc(#{title => <<"Crypto open_tar">>, equiv => crypto_result/0}). -type crypto_fun() :: fun((TextIn::binary(), crypto_state()) -> crypto_result()) . -doc """ @@ -357,7 +356,7 @@ next call of the `t:crypto_fun/0`. If the `t:crypto_fun/0` reurns a `t:chunk_size/0`, that value is as block size for further blocks in calls to `t:crypto_fun/0`. """. --doc(#{title => <<"Crypto operations for open_tar">>}). +-doc(#{title => <<"Crypto open_tar">>}). -type crypto_result() :: {ok,TextOut::binary(),crypto_state()} | {ok,TextOut::binary(),crypto_state(),chunk_size()} . @@ -367,10 +366,10 @@ If doing encryption, the `t:final_fun/0` in the The `t:final_fun/0` is responsible for padding (if needed) and encryption of that last piece. """. --doc(#{title => <<"Crypto operations for open_tar">>}). +-doc(#{title => <<"Crypto open_tar">>}). -type final_fun() :: fun((FinalTextIn::binary(),crypto_state()) -> {ok,FinalTextOut::binary()}) . --doc(#{title => <<"Crypto operations for open_tar">>, +-doc(#{title => <<"Crypto open_tar">>, equiv => crypto_state/0}). -type chunk_size() :: undefined | pos_integer(). -doc """ @@ -388,7 +387,7 @@ stream crypto, whereas a fixed `t:chunk_size/0` is intended for block crypto. A `t:chunk_size/0` can be changed in the return from the `t:crypto_fun/0`. The value can be changed between `t:pos_integer/0` and `undefined`. """. --doc(#{title => <<"Crypto operations for open_tar">>}). +-doc(#{title => <<"Crypto open_tar">>}). -type crypto_state() :: any() . @@ -414,7 +413,7 @@ For code examples see Section in the ssh Users Guide. The `crypto` mode option is explained in the data types section above, see -[Crypto operations for open_tar](`m:ssh_sftp#types-crypto-operations-for-open_tar`). +[Crypto operations for open_tar](`m:ssh_sftp#types-crypto-open_tar`). Encryption is assumed if the `Mode` contains `write`, and decryption if the `Mode` contains `read`. """. From ac6eb1e875e62c5670bd8e021200855413aaef9c Mon Sep 17 00:00:00 2001 From: Jakub Witczak Date: Tue, 29 Oct 2024 19:06:13 +0100 Subject: [PATCH 3/4] ssh: Equivalent statements clean up --- lib/ssh/src/ssh.erl | 10 +-- lib/ssh/src/ssh.hrl | 139 +++++++++++++-------------------- lib/ssh/src/ssh_connection.erl | 8 +- lib/ssh/src/ssh_file.erl | 6 +- lib/ssh/src/ssh_sftp.erl | 15 ++-- 5 files changed, 69 insertions(+), 109 deletions(-) diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index aa9452103a7e..1914f11119f1 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -427,13 +427,13 @@ close(ConnectionRef) -> %%-------------------------------------------------------------------- %% Description: Retrieves information about a connection. %%--------------------------------------------------------------------- --doc(#{title => <<"Other data types">>,equiv => conn_info_channels/0}). +-doc(#{title => <<"Other data types">>}). -type version() :: {protocol_version(), software_version()}. --doc(#{title => <<"Other data types">>,equiv => conn_info_channels/0}). +-doc(#{title => <<"Other data types">>}). -type protocol_version() :: {Major::pos_integer(), Minor::non_neg_integer()}. --doc(#{title => <<"Other data types">>,equiv => conn_info_channels/0}). +-doc(#{title => <<"Other data types">>}). -type software_version() :: string(). --doc(#{title => <<"Other data types">>,equiv => conn_info_channels/0}). +-doc(#{title => <<"Other data types">>}). -type conn_info_algs() :: [{kex, kex_alg()} | {hkey, pubkey_alg()} | {encrypt, cipher_alg()} @@ -454,7 +454,7 @@ default values. -doc(#{title => <<"Other data types">>}). -type conn_info_channels() :: [proplists:proplist()]. --doc(#{title => <<"Other data types">>,equiv => conn_info_channels/0}). +-doc(#{title => <<"Other data types">>}). -type connection_info_tuple() :: {client_version, version()} | {server_version, version()} diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl index fc3259d929b0..f1cecf30c3cd 100644 --- a/lib/ssh/src/ssh.hrl +++ b/lib/ssh/src/ssh.hrl @@ -153,19 +153,16 @@ to run any subsystems. -doc(#{title => <<"Daemon Options">>}). -type subsystem_spec() :: {Name::string(), mod_args()} . --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type algs_list() :: list( alg_entry() ). --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type alg_entry() :: {kex, [kex_alg()]} | {public_key, [pubkey_alg()]} | {cipher, double_algs(cipher_alg())} | {mac, double_algs(mac_alg())} | {compression, double_algs(compression_alg())} . --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type kex_alg() :: 'curve25519-sha256' | 'curve25519-sha256@libssh.org' | 'curve448-sha512' | @@ -181,8 +178,7 @@ to run any subsystems. 'diffie-hellman-group1-sha1' . --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type pubkey_alg() :: 'ssh-ed25519' | 'ssh-ed448' | 'ecdsa-sha2-nistp521' | @@ -194,8 +190,7 @@ to run any subsystems. 'ssh-dss' . --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type cipher_alg() :: 'aes256-gcm@openssh.com' | 'aes256-ctr' | 'aes192-ctr' | @@ -210,8 +205,7 @@ to run any subsystems. '3des-cbc' . --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type mac_alg() :: 'hmac-sha2-512-etm@openssh.com' | 'hmac-sha2-256-etm@openssh.com' | 'hmac-sha2-512' | @@ -223,8 +217,7 @@ to run any subsystems. 'AEAD_AES_128_GCM' . --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type compression_alg() :: 'none' | 'zlib' | 'zlib@openssh.com' @@ -324,23 +317,20 @@ For background and more examples see the -type internal_options() :: ssh_options:private_options(). -type socket_options() :: [gen_tcp:connect_option() | gen_tcp:listen_option()]. - --doc(#{title => <<"Client Options">>,equiv => client_option/0}). + +-doc(#{title => <<"Client Options">>}). -type client_options() :: [ client_option() ] . --doc(#{title => <<"Daemon Options">>, - equiv => daemon_option/0}). +-doc(#{title => <<"Daemon Options">>}). -type daemon_options() :: [ daemon_option() ]. - --doc(#{title => <<"Common Options">>, - equiv => common_option/0}). +-doc(#{title => <<"Common Options">>}). -type common_options() :: [ common_option() ]. -doc """ The options above can be used both in clients and in daemons (servers). They are further explained below. """. -doc(#{title => <<"Common Options">>}). --type common_option() :: +-type common_option() :: ssh_file:user_dir_common_option() | profile_common_option() | max_idle_time_common_option() @@ -383,8 +373,7 @@ For more information about timeouts, see the """. -doc(#{title => <<"Common Options">>}). -type max_idle_time_common_option() :: {idle_time, timeout()}. --doc(#{title => <<"Common Options">>, - equiv => limit_time/0}). +-doc(#{title => <<"Common Options">>}). -type rekey_limit_common_option() :: {rekey_limit, Bytes::limit_bytes() | {Minutes::limit_time(), Bytes::limit_bytes()} }. @@ -395,8 +384,7 @@ and the value defaults to 500. -doc(#{title => <<"Common Options">>}). -type max_log_item_len_common_option() :: {max_log_item_len, limit_bytes()} . --doc(#{title => <<"Common Options">>, - equiv => limit_time/0}). +-doc(#{title => <<"Common Options">>}). -type limit_bytes() :: non_neg_integer() | infinity . % non_neg_integer due to compatibility -doc """ Sets the limit when rekeying is to be initiated. Both the max time and max @@ -497,11 +485,9 @@ specifying the path to the user's keys. """. -doc(#{title => <<"Common Options">>}). -type pref_public_key_algs_common_option() :: {pref_public_key_algs, [pubkey_alg()] } . --doc(#{title => <<"Common Options">>, - equiv => double_algs/1}). +-doc(#{title => <<"Common Options">>}). -type preferred_algorithms_common_option():: {preferred_algorithms, algs_list()}. --doc(#{title => <<"Common Options">>, - equiv => modify_algs_list/0}). +-doc(#{title => <<"Common Options">>}). -type modify_algorithms_common_option() :: {modify_algorithms, modify_algs_list()}. -doc """ Comma-separated string that determines which authentication methods that the @@ -561,8 +547,7 @@ risk. | gen_tcp:connect_option() | ?COMMON_OPTION . --doc(#{title => <<"Other data types">>, - equiv => opaque_common_options/0}). +-doc(#{title => <<"Other data types">>}). -type opaque_client_options() :: {keyboard_interact_fun, fun((Name::iodata(), Instruction::iodata(), @@ -572,25 +557,6 @@ risk. )} | opaque_common_options(). --doc(#{title => <<"Client Options">>,equiv => fingerprint/0}). --type host_accepting_client_options() :: - {silently_accept_hosts, accept_hosts()} - | {user_interaction, boolean()} - | {save_accepted_host, boolean()} - | {quiet_mode, boolean()} . - --doc(#{title => <<"Client Options">>,equiv => fingerprint/0}). --type accept_hosts() :: boolean() - | accept_callback() - | {HashAlgoSpec::fp_digest_alg(), accept_callback()}. - --doc(#{title => <<"Client Options">>,equiv => fingerprint/0}). --type fp_digest_alg() :: 'md5' | crypto:sha1() | crypto:sha2() . - --doc(#{title => <<"Client Options">>,equiv => fingerprint/0}). --type accept_callback() :: fun((PeerName::string(), fingerprint() ) -> boolean()) % Old style - | fun((PeerName::string(), Port::inet:port_number(), fingerprint() ) -> boolean()) % New style - . -doc """ - **`silently_accept_hosts`{: #hardening_client_options-silently_accept_hosts }** - This option guides the `connect` function on how to act when the @@ -650,6 +616,26 @@ risk. Defaults to `false` """. +-doc(#{title => <<"Client Options">>}). +-type host_accepting_client_options() :: + {silently_accept_hosts, accept_hosts()} + | {user_interaction, boolean()} + | {save_accepted_host, boolean()} + | {quiet_mode, boolean()} . + +-doc(#{title => <<"Client Options">>}). +-type accept_hosts() :: boolean() + | accept_callback() + | {HashAlgoSpec::fp_digest_alg(), accept_callback()}. + +-doc(#{title => <<"Client Options">>}). +-type fp_digest_alg() :: 'md5' | crypto:sha1() | crypto:sha2() . + +-doc(#{title => <<"Client Options">>}). +-type accept_callback() :: fun((PeerName::string(), fingerprint() ) -> boolean()) % Old style + | fun((PeerName::string(), Port::inet:port_number(), fingerprint() ) -> boolean()) % New style + . + -doc(#{title => <<"Client Options">>}). -type fingerprint() :: string() | [string()]. @@ -732,18 +718,15 @@ risk. | gen_tcp:listen_option() | ?COMMON_OPTION . --doc(#{title => <<"Daemon Options">>, - equiv => subsystem_spec/0}). +-doc(#{title => <<"Daemon Options">>}). -type subsystem_daemon_option() :: {subsystems, subsystem_specs()}. --doc(#{title => <<"Daemon Options">>, - equiv => subsystem_spec/0}). +-doc(#{title => <<"Daemon Options">>}). -type subsystem_specs() :: [ subsystem_spec() ]. -doc(#{title => <<"Daemon Options">>, equiv => 'shell_fun/2'/0}). -type shell_daemon_option() :: {shell, shell_spec()} . --doc(#{title => <<"Daemon Options">>, - equiv => 'shell_fun/2'/0}). +-doc(#{title => <<"Daemon Options">>}). -type shell_spec() :: mod_fun_args() | shell_fun() | disabled . -doc(#{title => <<"Daemon Options">>, equiv => 'shell_fun/2'/0}). @@ -762,18 +745,15 @@ and exec-options. -doc(#{title => <<"Daemon Options">>}). -type 'shell_fun/2'() :: fun((User::string(), PeerAddr::inet:ip_address()) -> pid()). --doc(#{title => <<"Daemon Options">>, - equiv => exec_spec/0}). +-doc(#{title => <<"Daemon Options">>}). -type exec_daemon_option() :: {exec, exec_spec()} . -doc(#{title => <<"Daemon Options">>}). -type exec_spec() :: {direct, exec_fun()} | disabled | deprecated_exec_opt(). -doc(#{title => <<"Daemon Options">>}). -type exec_fun() :: 'exec_fun/1'() | 'exec_fun/2'() | 'exec_fun/3'(). --doc(#{title => <<"Daemon Options">>, - equiv => 'exec_fun/3'/0}). +-doc(#{title => <<"Daemon Options">>}). -type 'exec_fun/1'() :: fun((Cmd::string()) -> exec_result()) . --doc(#{title => <<"Daemon Options">>, - equiv => 'exec_fun/3'/0}). +-doc(#{title => <<"Daemon Options">>}). -type 'exec_fun/2'() :: fun((Cmd::string(), User::string()) -> exec_result()) . -doc(#{title => <<"Daemon Options">>}). -type 'exec_fun/3'() :: fun((Cmd::string(), User::string(), ClientAddr::ip_port()) -> exec_result()) . @@ -895,8 +875,7 @@ supporting ext-info. -doc(#{title => <<"Daemon Options">>}). -type send_ext_info_daemon_option() :: {send_ext_info, boolean()} . --doc(#{title => <<"Daemon Options">>, - equiv => pwdfun_4/0}). +-doc(#{title => <<"Daemon Options">>}). -type authentication_daemon_options() :: ssh_file:system_dir_daemon_option() | {auth_method_kb_interactive_data, prompt_texts() } @@ -904,25 +883,19 @@ supporting ext-info. | {pk_check_user, boolean()} | {password, string()} | {pwdfun, pwdfun_2() | pwdfun_4()} - | {no_auth_needed, boolean()} - . + | {no_auth_needed, boolean()}. --doc(#{title => <<"Daemon Options">>, - equiv => pwdfun_4/0}). +-doc(#{title => <<"Daemon Options">>}). -type prompt_texts() :: kb_int_tuple() | kb_int_fun_3() - | kb_int_fun_4() - . + | kb_int_fun_4(). --doc(#{title => <<"Daemon Options">>, - equiv => pwdfun_4/0}). +-doc(#{title => <<"Daemon Options">>}). -type kb_int_fun_3() :: fun((Peer::ip_port(), User::string(), Service::string()) -> kb_int_tuple()). --doc(#{title => <<"Daemon Options">>, - equiv => pwdfun_4/0}). +-doc(#{title => <<"Daemon Options">>}). -type kb_int_fun_4() :: fun((Peer::ip_port(), User::string(), Service::string(), State::any()) -> kb_int_tuple()). --doc(#{title => <<"Daemon Options">>, - equiv => pwdfun_4/0}). +-doc(#{title => <<"Daemon Options">>}). -type kb_int_tuple() :: {Name::string(), Instruction::string(), Prompt::string(), Echo::boolean()}. -doc(#{title => <<"Daemon Options">>, @@ -1033,17 +1006,14 @@ supporting ext-info. boolean() | disconnect | {boolean(),NewState::any()} ) . --doc(#{title => <<"Daemon Options">>, - equiv => ssh_moduli_file/0}). +-doc(#{title => <<"Daemon Options">>}). -type diffie_hellman_group_exchange_daemon_option() :: {dh_gex_groups, [explicit_group()] | explicit_group_file() | ssh_moduli_file()} | {dh_gex_limits, {Min::pos_integer(), Max::pos_integer()} } . --doc(#{title => <<"Daemon Options">>, - equiv => ssh_moduli_file/0}). +-doc(#{title => <<"Daemon Options">>}). -type explicit_group() :: {Size::pos_integer(),G::pos_integer(),P::pos_integer()} . --doc(#{title => <<"Daemon Options">>, - equiv => ssh_moduli_file/0}). +-doc(#{title => <<"Daemon Options">>}). -type explicit_group_file() :: {file,string()} . -doc """ - **`dh_gex_groups`** - Defines the groups the server may choose among when @@ -1179,8 +1149,7 @@ in the User's Guide chapter. {failfun, fun((User::string(), PeerAddress::inet:ip_address(), Reason::term()) -> _)} | {connectfun, fun((User::string(), PeerAddress::inet:ip_address(), Method::string()) ->_)} . --doc(#{title => <<"Other data types">>, - equiv => opaque_common_options/0}). +-doc(#{title => <<"Other data types">>}). -type opaque_daemon_options() :: {infofun, fun()} | opaque_common_options(). diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index 0743feb29731..cef81e56a57d 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -122,7 +122,7 @@ If not, the `t:reason/0` indicates what went wrong: """. -type reason() :: closed | timeout . --doc(#{equiv => reason/0}). +-doc(#{}). -type result() :: req_status() | {error, reason()} . -doc """ @@ -150,8 +150,7 @@ The valid values are `0` ("normal") and `1` ("stderr"), see exec_ch_msg/0 ]). --doc(#{title => <<"General">>, - equiv => channel_msg/0}). +-doc(#{title => <<"General">>}). -type event() :: {ssh_cm, ssh:connection_ref(), channel_msg()}. -doc """ As mentioned in the introduction, the @@ -262,8 +261,7 @@ This event is sent as a result of calling [ssh_connection:setenv/5](`setenv/5`). Value :: string() } . -doc(#{title => <<"Pseudo-Terminal">>, - rfc => ~"RFC 4254, section 6.2", - equiv => term_mode/0}). + rfc => ~"RFC 4254, section 6.2"}). -type pty_ch_msg() :: {pty, ssh:channel_id(), want_reply(), diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl index d45b6df5a330..582058e988d2 100644 --- a/lib/ssh/src/ssh_file.erl +++ b/lib/ssh/src/ssh_file.erl @@ -220,8 +220,7 @@ Note that EdDSA passhrases (Curves 25519 and 448) are not implemented. -doc "Sets the [user directory](`m:ssh_file#USERDIR`).". -doc(#{title => <<"Options">>}). -type user_dir_common_option() :: {user_dir, string()}. --doc(#{title => <<"Options">>, - equiv => user2dir/0}). +-doc(#{title => <<"Options">>}). -type user_dir_fun_common_option() :: {user_dir_fun, user2dir()}. -doc """ Sets the [user directory](`m:ssh_file#USERDIR`) dynamically by evaluating the @@ -245,8 +244,7 @@ call that initiates an ssh connection. -doc "The key representation". -doc(#{title => <<"Options">>}). -type key() :: public_key:public_key() | public_key:private_key() . --doc(#{title => <<"Options">>, - equiv => openssh_key_v1_attributes/0}). +-doc(#{title => <<"Options">>}). -type experimental_openssh_key_v1() :: [{key(), openssh_key_v1_attributes()}]. -doc "Types for the experimental implementaition of the `openssh_key_v1` format.". -doc(#{title => <<"Options">>}). diff --git a/lib/ssh/src/ssh_sftp.erl b/lib/ssh/src/ssh_sftp.erl index cc9e27e00bf9..e2ce584f2d34 100644 --- a/lib/ssh/src/ssh_sftp.erl +++ b/lib/ssh/src/ssh_sftp.erl @@ -317,12 +317,10 @@ open(Pid, File, Mode, FileOpTimeout) -> call(Pid, {open, false, File, Mode}, FileOpTimeout). --doc(#{title => <<"Crypto open_tar">>, - equiv => decrypt_spec/0}). +-doc(#{title => <<"Crypto open_tar">>}). -type tar_crypto_spec() :: encrypt_spec() | decrypt_spec() . --doc(#{title => <<"Crypto open_tar">>, - equiv => decrypt_spec/0}). +-doc(#{title => <<"Crypto open_tar">>}). -type encrypt_spec() :: {init_fun(), crypto_fun(), final_fun()} . -doc """ Specifies the encryption or decryption applied to tar files when using @@ -338,13 +336,11 @@ Guide. -doc(#{title => <<"Crypto open_tar">>}). -type decrypt_spec() :: {init_fun(), crypto_fun()} . --doc(#{title => <<"Crypto open_tar">>, - equiv => crypto_state/0}). +-doc(#{title => <<"Crypto open_tar">>}). -type init_fun() :: fun(() -> {ok,crypto_state()}) | fun(() -> {ok,crypto_state(),chunk_size()}) . --doc(#{title => <<"Crypto open_tar">>, - equiv => crypto_result/0}). +-doc(#{title => <<"Crypto open_tar">>}). -type crypto_fun() :: fun((TextIn::binary(), crypto_state()) -> crypto_result()) . -doc """ The initial `t:crypto_state/0` returned from the `t:init_fun/0` is folded into @@ -369,8 +365,7 @@ that last piece. -doc(#{title => <<"Crypto open_tar">>}). -type final_fun() :: fun((FinalTextIn::binary(),crypto_state()) -> {ok,FinalTextOut::binary()}) . --doc(#{title => <<"Crypto open_tar">>, - equiv => crypto_state/0}). +-doc(#{title => <<"Crypto open_tar">>}). -type chunk_size() :: undefined | pos_integer(). -doc """ The `t:init_fun/0` in the [tar_crypto_spec](`t:tar_crypto_spec/0`) is applied From d23db608a5032675f0ceb40abbc4e1c30a3cfc9b Mon Sep 17 00:00:00 2001 From: Jakub Witczak Date: Tue, 12 Nov 2024 16:20:53 +0100 Subject: [PATCH 4/4] ssh: reduce field type definition --- lib/ssh/src/ssh.hrl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl index f1cecf30c3cd..46d93a166212 100644 --- a/lib/ssh/src/ssh.hrl +++ b/lib/ssh/src/ssh.hrl @@ -1171,7 +1171,7 @@ in the User's Guide chapter. -record(ssh, { - role :: client | role(), + role :: role(), peer :: undefined | {inet:hostname(),ip_port()}, %% string version of peer address