Ssh services are implemented as channels that are multiplexed over an ssh connection and communicates via the ssh connection protocol. This module provides a callback API that takes care of generic channel aspects such as flow control and close messages and lets the callback functions take care of the service specific parts.
Type definitions that are used more than once in this module and/or abstractions to indicate the intended use of the data type:
Makes a synchronous call to the channel process by sending
a message and waiting until a reply arrives or a timeout
occurs. The channel will call
Sends an asynchronous message to the channel process and
returns ok immediately, ignoring if the destination node or
channel process does not exist. The channel will call
Makes an existing process into a
The following options must be present:
This function is normally not called by the user, it is
only needed if for some reason the channel process needs
to be started with help of
This function can be used by a channel to explicitly send a
reply to a client that called
Starts a processes that handles a ssh channel. Will be called internally by the ssh daemon or explicitly by the ssh client implementations. A channel process traps exit signals by default.
The functions init/1, terminate/2, handle_ssh_msg/2 and
handle_msg/2 are the functions that are required to provide the
implementation for a server side channel, such as a ssh subsystem
channel that can be plugged into the erlang ssh daemon see
If an integer timeout value is provided in a return value of
one of the callback functions, a timeout will occur unless a
message is received within
This function is called by a client side channel when it
should update its internal state during a release
upgrade/downgrade, i.e. when the instruction
If there are long lived ssh connections and more than one upgrade in a short time this may cause the old connections to fail as only two versions of the code may be loaded simultaneously.
In the case of an upgrade,
The function should return the updated internal state.
Makes necessary initializations and returns the initial channel state if the initializations succeed.
For more detailed information on timeouts see the section
Handles messages sent by calling
For more detailed information on timeouts see the section
Handles messages sent by calling
For more detailed information on timeouts see the section
Handle other messages than ssh connection protocol, call or cast messages sent to the channel.
Possible erlang 'EXIT'-messages should be handled by this function and all channels should handle the following message.
Handles ssh connection protocol messages that may need service specific attention.
All channels should handle the following messages. For channels implementing subsystems the handle_ssh_msg-callback will not be called for any other messages.
Channels implementing a shell and command execution on the server side should also handle the following messages.
The following message is completely taken care of by the ssh channel behavior
This function is called by a channel process when it is
about to terminate. Before this function is called ssh_connection:close/2
will be called if it has not been called earlier.
This function should be the opposite of