diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libssh/agent.h | 2 | ||||
-rw-r--r-- | include/libssh/poll.h | 2 | ||||
-rw-r--r-- | include/libssh/priv.h | 4 | ||||
-rw-r--r-- | include/libssh/session.h | 2 | ||||
-rw-r--r-- | include/libssh/socket.h | 58 |
5 files changed, 35 insertions, 33 deletions
diff --git a/include/libssh/agent.h b/include/libssh/agent.h index fca577d1..b620b332 100644 --- a/include/libssh/agent.h +++ b/include/libssh/agent.h @@ -48,7 +48,7 @@ #define SSH_AGENT_OLD_SIGNATURE 0x01 struct ssh_agent_struct { - struct socket *sock; + struct ssh_socket_struct *sock; ssh_buffer ident; unsigned int count; }; diff --git a/include/libssh/poll.h b/include/libssh/poll.h index ca5ec181..5d8bd3cc 100644 --- a/include/libssh/poll.h +++ b/include/libssh/poll.h @@ -95,7 +95,7 @@ void ssh_poll_set_callback(ssh_poll_handle p, ssh_poll_callback cb, void *userda ssh_poll_ctx ssh_poll_ctx_new(size_t chunk_size); void ssh_poll_ctx_free(ssh_poll_ctx ctx); int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p); -int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, struct socket *s); +int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, struct ssh_socket_struct *s); void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p); int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout); diff --git a/include/libssh/priv.h b/include/libssh/priv.h index c251140a..8413a22a 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -136,10 +136,10 @@ unsigned char *packet_encrypt(ssh_session session,void *packet,unsigned int len) /* it returns the hmac buffer if exists*/ int packet_hmac_verify(ssh_session session,ssh_buffer buffer,unsigned char *mac); -struct socket; +struct ssh_socket_struct; int ssh_packet_socket_callback(const void *data, size_t len, void *user); -void ssh_packet_register_socket_callback(ssh_session session, struct socket *s); +void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s); void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks); void ssh_packet_set_default_callbacks(ssh_session session); void ssh_packet_process(ssh_session session, uint8_t type); diff --git a/include/libssh/session.h b/include/libssh/session.h index cea2f739..09ed655d 100644 --- a/include/libssh/session.h +++ b/include/libssh/session.h @@ -41,7 +41,7 @@ enum ssh_session_state_e { struct ssh_session_struct { struct error_struct error; - struct socket *socket; + struct ssh_socket_struct *socket; char *serverbanner; char *clientbanner; int protoversion; 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_ */ |