ssh_server_channel(3erl) | Erlang Module Definition | ssh_server_channel(3erl) |
ssh_server_channel - -behaviour(ssh_server_channel). (Replaces ssh_daemon_channel)
This module replaces ssh_daemon_channel.
The old module is still available for compatibility, but should not be used for new programs. The old module will not be maintained except for some error corrections
SSH services (clients and servers) are implemented as channels that are multiplexed over an SSH connection and communicates over the SSH Connection Protocol. This module provides a callback API that takes care of generic channel aspects for daemons, such as flow control and close messages. It lets the callback functions take care of the service (application) specific parts. This behavior also ensures that the channel process honors the principal of an OTP-process so that it can be part of a supervisor tree. This is a requirement of channel processes implementing a subsystem that will be added to the ssh applications supervisor tree.
The following functions are to be exported from a ssh_server_channel callback module.
Module:init(Args) -> {ok, State} | {ok, State, timeout()} |
{stop, Reason}
Types:
Makes necessary initializations and returns the initial channel state if the initializations succeed.
The time-out values that can be returned have the same semantics as in a gen_server. If the time-out occurs, handle_msg/2 is called as handle_msg(timeout, State).
Module:handle_msg(Msg, State) -> {ok, State} | {stop,
ChannelId, State}
Types:
Handles other messages than SSH Connection Protocol, call, or cast messages sent to the channel.
Possible Erlang 'EXIT' messages is to be handled by this function and all channels are to handle the following message.
Module:handle_ssh_msg(Msg, State) -> {ok, State} | {stop,
ChannelId, State}
Types:
Handles SSH Connection Protocol messages that may need service-specific attention. For details, see ssh_connection:event().
The following message is taken care of by the ssh_server_channel behavior.
Module:terminate(Reason, State) -> _
Types:
This function is called by a channel process when it is about to terminate. Before this function is called, ssh_connection:close/2 is called, if it has not been called earlier. This function does any necessary cleaning up. When it returns, the channel process terminates with reason Reason. The return value is ignored.
ssh 4.7.3 | Ericsson AB |