libssh 0.4.8
|
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 /* socket.c */ 00026 00027 struct socket; 00028 int ssh_socket_init(void); 00029 struct socket *ssh_socket_new(ssh_session session); 00030 void ssh_socket_free(struct socket *s); 00031 void ssh_socket_set_fd(struct socket *s, socket_t fd); 00032 socket_t ssh_socket_get_fd(struct socket *s); 00033 void ssh_socket_cleanup(void); 00034 #ifndef _WIN32 00035 int ssh_socket_unix(struct socket *s, const char *path); 00036 #endif 00037 void ssh_socket_close(struct socket *s); 00038 int ssh_socket_read(struct socket *s, void *buffer, int len); 00039 int ssh_socket_write(struct socket *s,const void *buffer, int len); 00040 int ssh_socket_is_open(struct socket *s); 00041 int ssh_socket_fd_isset(struct socket *s, fd_set *set); 00042 void ssh_socket_fd_set(struct socket *s, fd_set *set, socket_t *max_fd); 00043 int ssh_socket_completeread(struct socket *s, void *buffer, uint32_t len); 00044 int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len); 00045 int ssh_socket_wait_for_data(struct socket *s, ssh_session session, uint32_t len); 00046 int ssh_socket_nonblocking_flush(struct socket *s); 00047 int ssh_socket_blocking_flush(struct socket *s); 00048 int ssh_socket_poll(struct socket *s, int *writeable, int *except); 00049 void ssh_socket_set_towrite(struct socket *s); 00050 void ssh_socket_set_toread(struct socket *s); 00051 void ssh_socket_set_except(struct socket *s); 00052 int ssh_socket_get_status(struct socket *s); 00053 int ssh_socket_data_available(struct socket *s); 00054 int ssh_socket_data_writable(struct socket *s); 00055 00056 #ifndef _WIN32 00057 void ssh_execute_command(const char *command, socket_t in, socket_t out); 00058 socket_t ssh_socket_connect_proxycommand(ssh_session session, 00059 const char *command); 00060 #endif 00061 00062 #endif /* SOCKET_H_ */