00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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;
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;
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
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