00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SOCKET_H_
00022 #define SOCKET_H_
00023
00024 #include "libssh/callbacks.h"
00025 struct ssh_poll_handle_struct;
00026
00027
00028 struct ssh_socket_struct;
00029 typedef struct ssh_socket_struct* ssh_socket;
00030
00031 int ssh_socket_init(void);
00032 void ssh_socket_cleanup(void);
00033 ssh_socket ssh_socket_new(ssh_session session);
00034 void ssh_socket_reset(ssh_socket s);
00035 void ssh_socket_free(ssh_socket s);
00036 void ssh_socket_set_fd(ssh_socket s, socket_t fd);
00037 socket_t ssh_socket_get_fd_in(ssh_socket s);
00038 #ifndef _WIN32
00039 int ssh_socket_unix(ssh_socket s, const char *path);
00040 void ssh_execute_command(const char *command, socket_t in, socket_t out);
00041 int ssh_socket_connect_proxycommand(ssh_socket s, const char *command);
00042 #endif
00043 void ssh_socket_close(ssh_socket s);
00044 int ssh_socket_write(ssh_socket s,const void *buffer, int len);
00045 int ssh_socket_is_open(ssh_socket s);
00046 int ssh_socket_fd_isset(ssh_socket s, fd_set *set);
00047 void ssh_socket_fd_set(ssh_socket s, fd_set *set, socket_t *max_fd);
00048 void ssh_socket_set_fd_in(ssh_socket s, socket_t fd);
00049 void ssh_socket_set_fd_out(ssh_socket s, socket_t fd);
00050 int ssh_socket_nonblocking_flush(ssh_socket s);
00051 void ssh_socket_set_write_wontblock(ssh_socket s);
00052 void ssh_socket_set_read_wontblock(ssh_socket s);
00053 void ssh_socket_set_except(ssh_socket s);
00054 int ssh_socket_get_status(ssh_socket s);
00055 int ssh_socket_get_poll_flags(ssh_socket s);
00056 int ssh_socket_buffered_write_bytes(ssh_socket s);
00057 int ssh_socket_data_available(ssh_socket s);
00058 int ssh_socket_data_writable(ssh_socket s);
00059 int ssh_socket_set_nonblocking(socket_t fd);
00060 int ssh_socket_set_blocking(socket_t fd);
00061
00062 void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks);
00063 int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int revents, void *v_s);
00064 struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_in(ssh_socket s);
00065 struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_out(ssh_socket s);
00066
00067 int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr);
00068
00069 #endif