libssh 0.5.4
|
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 SOCKET_H_ 00023 #define SOCKET_H_ 00024 00025 #include "libssh/callbacks.h" 00026 struct ssh_poll_handle_struct; 00027 /* socket.c */ 00028 00029 struct ssh_socket_struct; 00030 typedef struct ssh_socket_struct* ssh_socket; 00031 00032 int ssh_socket_init(void); 00033 void ssh_socket_cleanup(void); 00034 ssh_socket ssh_socket_new(ssh_session session); 00035 void ssh_socket_reset(ssh_socket s); 00036 void ssh_socket_free(ssh_socket s); 00037 void ssh_socket_set_fd(ssh_socket s, socket_t fd); 00038 socket_t ssh_socket_get_fd_in(ssh_socket s); 00039 #ifndef _WIN32 00040 int ssh_socket_unix(ssh_socket s, const char *path); 00041 void ssh_execute_command(const char *command, socket_t in, socket_t out); 00042 int ssh_socket_connect_proxycommand(ssh_socket s, const char *command); 00043 #endif 00044 void ssh_socket_close(ssh_socket s); 00045 int ssh_socket_write(ssh_socket s,const void *buffer, int len); 00046 int ssh_socket_is_open(ssh_socket s); 00047 int ssh_socket_fd_isset(ssh_socket s, fd_set *set); 00048 void ssh_socket_fd_set(ssh_socket s, fd_set *set, socket_t *max_fd); 00049 void ssh_socket_set_fd_in(ssh_socket s, socket_t fd); 00050 void ssh_socket_set_fd_out(ssh_socket s, socket_t fd); 00051 int ssh_socket_nonblocking_flush(ssh_socket s); 00052 void ssh_socket_set_write_wontblock(ssh_socket s); 00053 void ssh_socket_set_read_wontblock(ssh_socket s); 00054 void ssh_socket_set_except(ssh_socket s); 00055 int ssh_socket_get_status(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 00060 void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks); 00061 int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int revents, void *v_s); 00062 struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_in(ssh_socket s); 00063 struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_out(ssh_socket s); 00064 00065 void ssh_socket_set_connecting(ssh_socket s, socket_t fd); 00066 int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr); 00067 00068 #endif /* SOCKET_H_ */