Module:code_change(OldVsn,State,Extra)->{ok,NewState}
Types:
OldVsn = term()
In the case of an upgrade, OldVsn is Vsn, and in the case of a downgrade, OldVsn is
{down,Vsn}. Vsn is defined by the vsn attribute(s) of the old version of the callback module
Module. If no such attribute is defined, the version is the checksum of the BEAM file.
State = term()
Internal state of the channel.
Extra = term()
Passed "as-is" from the {advanced,Extra} part of the update instruction.
Converts process state when code is changed.
This function is called by a client-side channel when it is to update its internal state during a
release upgrade or downgrade, that is, when the instruction {update,Module,Change,...}, where
Change={advanced,Extra}, is given in the appup file. For more information, refer to Section 9.11.6
Release Handling Instructions in the System Documentation.
Note:
Soft upgrade according to the OTP release concept is not straight forward for the server side, as
subsystem channel processes are spawned by the ssh application and hence added to its supervisor
tree. The subsystem channels can be upgraded when upgrading the user application, if the callback
functions can handle two versions of the state, but this function cannot be used in the normal
way.
Module:init(Args)->{ok,State}|{ok,State,timeout()}|{stop,Reason}
Types:
Args = term()
Last argument to start_link/4.
State = term()
Reason = term()
Makes necessary initializations and returns the initial channel state if the initializations
succeed.
For more detailed information on time-outs, see Section Callback timeouts.
Module:handle_call(Msg,From,State)->Result
Types:
Msg = term()
From = opaque()
Is to be used as argument to reply/2
State = term()
Result = {reply, Reply, NewState} | {reply, Reply, NewState, timeout()} | {noreply, NewState} |
{noreply , NewState, timeout()} | {stop, Reason, Reply, NewState} | {stop, Reason, NewState}
Reply = term()
Will be the return value of call/[2,3]
NewState = term()
Reason = term()
Handles messages sent by calling call/[2,3]
For more detailed information on time-outs,, see Section Callback timeouts.
Module:handle_cast(Msg,State)->Result
Types:
Msg = term()
State = term()
Result = {noreply, NewState} | {noreply, NewState, timeout()} | {stop, Reason, NewState}
NewState = term()
Reason = term()
Handles messages sent by calling cast/2.
For more detailed information on time-outs, see Section Callback timeouts.
Module:handle_msg(Msg,State)->{ok,State}|{stop,ChannelId,State}
Types:
Msg = timeout | term()
ChannelId = ssh:channel_id()
State = term()
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.
{ssh_channel_up, ssh:channel_id(), ssh:connection_ref()}:
This is the first message that the channel receives. It is sent just before the init/1
function returns successfully. This is especially useful if the server wants to send a message
to the client without first receiving a message from it. If the message is not useful for your
particular scenario, ignore it by immediately returning {ok,State}.
Module:handle_ssh_msg(Msg,State)->{ok,State}|{stop,ChannelId,State}
Types:
Msg = ssh_connection:event()
ChannelId = ssh:channel_id()
State = term()
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_client_channel behavior.
{closed, ssh:channel_id()}:
The channel behavior sends a close message to the other side, if such a message has not
already been sent. Then it terminates the channel with reason normal.
Module:terminate(Reason,State)->_
Types:
Reason = term()
State = term()
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.
Ericsson AB ssh 4.13 ssh_client_channel(3erl)