diff options
Diffstat (limited to 'include/libssh/socket.h')
-rw-r--r-- | include/libssh/socket.h | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/include/libssh/socket.h b/include/libssh/socket.h index 0c2a6c9e..c0bc7d52 100644 --- a/include/libssh/socket.h +++ b/include/libssh/socket.h @@ -26,38 +26,40 @@ struct ssh_poll_handle_struct; /* socket.c */ -struct socket; +struct ssh_socket_struct; +typedef struct ssh_socket_struct* ssh_socket; + int ssh_socket_init(void); -struct socket *ssh_socket_new(ssh_session session); -void ssh_socket_free(struct socket *s); -void ssh_socket_set_fd(struct socket *s, socket_t fd); -socket_t ssh_socket_get_fd(struct socket *s); +ssh_socket ssh_socket_new(ssh_session session); +void ssh_socket_free(ssh_socket s); +void ssh_socket_set_fd(ssh_socket s, socket_t fd); +socket_t ssh_socket_get_fd(ssh_socket s); #ifndef _WIN32 -int ssh_socket_unix(struct socket *s, const char *path); +int ssh_socket_unix(ssh_socket s, const char *path); #endif -void ssh_socket_close(struct socket *s); -int ssh_socket_read(struct socket *s, void *buffer, int len); -int ssh_socket_write(struct socket *s,const void *buffer, int len); -int ssh_socket_is_open(struct socket *s); -int ssh_socket_fd_isset(struct socket *s, fd_set *set); -void ssh_socket_fd_set(struct socket *s, fd_set *set, int *fd_max); -int ssh_socket_completeread(struct socket *s, void *buffer, uint32_t len); -int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len); -int ssh_socket_wait_for_data(struct socket *s, ssh_session session, uint32_t len); -int ssh_socket_nonblocking_flush(struct socket *s); -int ssh_socket_blocking_flush(struct socket *s); -int ssh_socket_poll(struct socket *s, int *writeable, int *except); -void ssh_socket_set_towrite(struct socket *s); -void ssh_socket_set_toread(struct socket *s); -void ssh_socket_set_except(struct socket *s); -int ssh_socket_get_status(struct socket *s); -int ssh_socket_data_available(struct socket *s); -int ssh_socket_data_writable(struct socket *s); +void ssh_socket_close(ssh_socket s); +int ssh_socket_read(ssh_socket s, void *buffer, int len); +int ssh_socket_write(ssh_socket s,const void *buffer, int len); +int ssh_socket_is_open(ssh_socket s); +int ssh_socket_fd_isset(ssh_socket s, fd_set *set); +void ssh_socket_fd_set(ssh_socket s, fd_set *set, int *fd_max); +int ssh_socket_completeread(ssh_socket s, void *buffer, uint32_t len); +int ssh_socket_completewrite(ssh_socket s, const void *buffer, uint32_t len); +int ssh_socket_wait_for_data(ssh_socket s, ssh_session session, uint32_t len); +int ssh_socket_nonblocking_flush(ssh_socket s); +int ssh_socket_blocking_flush(ssh_socket s); +int ssh_socket_poll(ssh_socket s, int *writeable, int *except); +void ssh_socket_set_towrite(ssh_socket s); +void ssh_socket_set_toread(ssh_socket s); +void ssh_socket_set_except(ssh_socket s); +int ssh_socket_get_status(ssh_socket s); +int ssh_socket_data_available(ssh_socket s); +int ssh_socket_data_writable(ssh_socket s); -void ssh_socket_set_callbacks(struct socket *s, ssh_socket_callbacks callbacks); +void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks); int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, int fd, int revents, void *s); -void ssh_socket_register_pollcallback(struct socket *s, struct ssh_poll_handle_struct *p); -struct ssh_poll_handle_struct * ssh_socket_get_poll_handle(struct socket *s); -int ssh_socket_connect(struct socket *s, const char *host, int port, const char *bind_addr); +void ssh_socket_register_pollcallback(ssh_socket s, struct ssh_poll_handle_struct *p); +struct ssh_poll_handle_struct * ssh_socket_get_poll_handle(ssh_socket s); +int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr); #endif /* SOCKET_H_ */ |