1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2013-2020. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20 21%% 22%% Description: a gen_server implementing a simple 23%% terminal (using the group module) for a CLI 24%% over SSH 25 26-module(ssh_server_channel). 27 28%% API to server side channel that can be pluged into the erlang ssh daemeon 29-callback init(Args :: term()) -> 30 {ok, State :: term()} | {ok, State :: term(), timeout() | hibernate} | 31 {stop, Reason :: term()} | ignore. 32 33-callback terminate(Reason :: (normal | shutdown | {shutdown, term()} | 34 term()), 35 State :: term()) -> 36 term(). 37 38-callback handle_msg(Msg ::term(), State :: term()) -> 39 {ok, State::term()} | {stop, ChannelId::ssh:channel_id(), State::term()}. 40-callback handle_ssh_msg(ssh_connection:event(), 41 State::term()) -> {ok, State::term()} | 42 {stop, ChannelId::ssh:channel_id(), 43 State::term()}. 44 45%%% Internal API 46-export([start_link/5, 47 get_print_info/1, get_print_info/2 48 ]). 49 50start_link(ConnectionManager, ChannelId, CallBack, CbInitArgs, Exec) -> 51 ssh_client_channel:start_link(ConnectionManager, ChannelId, CallBack, CbInitArgs, Exec). 52 53 54get_print_info(Pid) -> 55 ssh_client_channel:get_print_info(Pid). 56 57get_print_info(Pid, Arg) -> 58 ssh_client_channel:get_print_info(Pid, Arg). 59