libssh  0.7.2
include/libssh/socket.h
00001 /*
00002  * This file is part of the SSH Library
00003  *
00004  * Copyright (c) 2009 by Aris Adamantiadis
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #ifndef SOCKET_H_
00022 #define SOCKET_H_
00023 
00024 #include "libssh/callbacks.h"
00025 struct ssh_poll_handle_struct;
00026 /* socket.c */
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 /* SOCKET_H_ */