|
libssh
0.5.1
|
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 struct ssh_channel_struct *prev; 00052 struct ssh_channel_struct *next; 00053 ssh_session session; /* SSH_SESSION pointer */ 00054 uint32_t local_channel; 00055 uint32_t local_window; 00056 int local_eof; 00057 uint32_t local_maxpacket; 00058 00059 uint32_t remote_channel; 00060 uint32_t remote_window; 00061 int remote_eof; /* end of file received */ 00062 uint32_t remote_maxpacket; 00063 enum ssh_channel_state_e state; 00064 int delayed_close; 00065 ssh_buffer stdout_buffer; 00066 ssh_buffer stderr_buffer; 00067 void *userarg; 00068 int version; 00069 int blocking; 00070 int exit_status; 00071 enum ssh_channel_request_state_e request_state; 00072 ssh_channel_callbacks callbacks; 00073 }; 00074 00075 SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf); 00076 SSH_PACKET_CALLBACK(ssh_packet_channel_open_fail); 00077 SSH_PACKET_CALLBACK(ssh_packet_channel_success); 00078 SSH_PACKET_CALLBACK(ssh_packet_channel_failure); 00079 SSH_PACKET_CALLBACK(ssh_request_success); 00080 SSH_PACKET_CALLBACK(ssh_request_denied); 00081 00082 SSH_PACKET_CALLBACK(channel_rcv_change_window); 00083 SSH_PACKET_CALLBACK(channel_rcv_eof); 00084 SSH_PACKET_CALLBACK(channel_rcv_close); 00085 SSH_PACKET_CALLBACK(channel_rcv_request); 00086 SSH_PACKET_CALLBACK(channel_rcv_data); 00087 00088 ssh_channel ssh_channel_new(ssh_session session); 00089 int channel_default_bufferize(ssh_channel channel, void *data, int len, 00090 int is_stderr); 00091 uint32_t ssh_channel_new_id(ssh_session session); 00092 ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id); 00093 int channel_write_common(ssh_channel channel, const void *data, 00094 uint32_t len, int is_stderr); 00095 #ifdef WITH_SSH1 00096 SSH_PACKET_CALLBACK(ssh_packet_data1); 00097 SSH_PACKET_CALLBACK(ssh_packet_close1); 00098 00099 /* channels1.c */ 00100 int channel_open_session1(ssh_channel channel); 00101 int channel_request_pty_size1(ssh_channel channel, const char *terminal, 00102 int cols, int rows); 00103 int channel_change_pty_size1(ssh_channel channel, int cols, int rows); 00104 int channel_request_shell1(ssh_channel channel); 00105 int channel_request_exec1(ssh_channel channel, const char *cmd); 00106 int channel_write1(ssh_channel channel, const void *data, int len); 00107 00108 #endif 00109 00110 #endif /* CHANNELS_H_ */
1.7.5.1