include/libssh/channels.h

00001 /*
00002  * This file is part of the SSH Library
00003  *
00004  * Copyright (c) 2009 by Aris Adamantiadis
00005  *
00006  * The SSH Library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 2.1 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * The SSH Library is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00014  * License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with the SSH Library; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019  * MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef CHANNELS_H_
00023 #define CHANNELS_H_
00024 #include "libssh/priv.h"
00025 
00030 enum ssh_channel_request_state_e {
00032   SSH_CHANNEL_REQ_STATE_NONE = 0,
00034   SSH_CHANNEL_REQ_STATE_PENDING,
00036   SSH_CHANNEL_REQ_STATE_ACCEPTED,
00038   SSH_CHANNEL_REQ_STATE_DENIED,
00040   SSH_CHANNEL_REQ_STATE_ERROR
00041 };
00042 
00043 enum ssh_channel_state_e {
00044   SSH_CHANNEL_STATE_NOT_OPEN = 0,
00045   SSH_CHANNEL_STATE_OPEN_DENIED,
00046   SSH_CHANNEL_STATE_OPEN,
00047   SSH_CHANNEL_STATE_CLOSED
00048 };
00049 
00050 struct ssh_channel_struct {
00051     ssh_session session; /* SSH_SESSION pointer */
00052     uint32_t local_channel;
00053     uint32_t local_window;
00054     int local_eof;
00055     uint32_t local_maxpacket;
00056 
00057     uint32_t remote_channel;
00058     uint32_t remote_window;
00059     int remote_eof; /* end of file received */
00060     uint32_t remote_maxpacket;
00061     enum ssh_channel_state_e state;
00062     int delayed_close;
00063     ssh_buffer stdout_buffer;
00064     ssh_buffer stderr_buffer;
00065     void *userarg;
00066     int version;
00067     int blocking;
00068     int exit_status;
00069     enum ssh_channel_request_state_e request_state;
00070     ssh_channel_callbacks callbacks;
00071 };
00072 
00073 SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf);
00074 SSH_PACKET_CALLBACK(ssh_packet_channel_open_fail);
00075 SSH_PACKET_CALLBACK(ssh_packet_channel_success);
00076 SSH_PACKET_CALLBACK(ssh_packet_channel_failure);
00077 SSH_PACKET_CALLBACK(ssh_request_success);
00078 SSH_PACKET_CALLBACK(ssh_request_denied);
00079 
00080 SSH_PACKET_CALLBACK(channel_rcv_change_window);
00081 SSH_PACKET_CALLBACK(channel_rcv_eof);
00082 SSH_PACKET_CALLBACK(channel_rcv_close);
00083 SSH_PACKET_CALLBACK(channel_rcv_request);
00084 SSH_PACKET_CALLBACK(channel_rcv_data);
00085 
00086 ssh_channel ssh_channel_new(ssh_session session);
00087 int channel_default_bufferize(ssh_channel channel, void *data, int len,
00088         int is_stderr);
00089 uint32_t ssh_channel_new_id(ssh_session session);
00090 ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id);
00091 int channel_write_common(ssh_channel channel, const void *data,
00092     uint32_t len, int is_stderr);
00093 #ifdef WITH_SSH1
00094 SSH_PACKET_CALLBACK(ssh_packet_data1);
00095 SSH_PACKET_CALLBACK(ssh_packet_close1);
00096 SSH_PACKET_CALLBACK(ssh_packet_exist_status1);
00097 
00098 /* channels1.c */
00099 int channel_open_session1(ssh_channel channel);
00100 int channel_request_pty_size1(ssh_channel channel, const char *terminal,
00101     int cols, int rows);
00102 int channel_change_pty_size1(ssh_channel channel, int cols, int rows);
00103 int channel_request_shell1(ssh_channel channel);
00104 int channel_request_exec1(ssh_channel channel, const char *cmd);
00105 int channel_write1(ssh_channel channel, const void *data, int len);
00106 ssh_channel ssh_get_channel1(ssh_session session);
00107 #endif
00108 
00109 #endif /* CHANNELS_H_ */

Generated on 19 Dec 2014 for libssh by  doxygen 1.4.7