diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-10-09 22:37:23 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-10-09 22:37:23 +0200 |
commit | 71ab0cf6ccad12ff8454005cbe9a62cf1f9ae91d (patch) | |
tree | 240a9bb3f6fe6318d035892d8a71efb43e2c64d1 | |
parent | 1e0e8a54939ca84c6cd20a5447059364e789b720 (diff) | |
download | libssh-71ab0cf6ccad12ff8454005cbe9a62cf1f9ae91d.tar.gz libssh-71ab0cf6ccad12ff8454005cbe9a62cf1f9ae91d.tar.xz libssh-71ab0cf6ccad12ff8454005cbe9a62cf1f9ae91d.zip |
No more SSH_BIND SSH_MESSAGE etc.
-rw-r--r-- | include/libssh/server.h | 23 | ||||
-rw-r--r-- | libssh/server.c | 22 |
2 files changed, 23 insertions, 22 deletions
diff --git a/include/libssh/server.h b/include/libssh/server.h index 1b6e3e5..c53f4bf 100644 --- a/include/libssh/server.h +++ b/include/libssh/server.h @@ -1,3 +1,4 @@ +/* Public include file for server support */ /* * This file is part of the SSH Library * @@ -44,15 +45,15 @@ enum ssh_bind_options_e { SSH_BIND_OPTIONS_BANNER }; -typedef struct ssh_bind_struct SSH_BIND; -typedef struct ssh_bind_struct *ssh_bind; +//typedef struct ssh_bind_struct SSH_BIND; +typedef struct ssh_bind_struct* ssh_bind; /** * @brief Creates a new SSH server bind. * * @return A newly allocated ssh_bind session pointer. */ -LIBSSH_API SSH_BIND *ssh_bind_new(void); +LIBSSH_API ssh_bind ssh_bind_new(void); /** * @brief Set the opitons for the current SSH server bind. @@ -71,7 +72,7 @@ LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind, * * @return 0 on success, < 0 on error. */ -LIBSSH_API int ssh_bind_listen(SSH_BIND *ssh_bind); +LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind); /** * @brief Set the session to blocking/nonblocking mode. @@ -80,7 +81,7 @@ LIBSSH_API int ssh_bind_listen(SSH_BIND *ssh_bind); * * @param blocking Zero for nonblocking mode. */ -LIBSSH_API void ssh_bind_set_blocking(SSH_BIND *sshbind, int blocking); +LIBSSH_API void ssh_bind_set_blocking(ssh_bind sshbind, int blocking); /** * @brief Recover the file descriptor from the session. @@ -89,23 +90,23 @@ LIBSSH_API void ssh_bind_set_blocking(SSH_BIND *sshbind, int blocking); * * @return The file descriptor. */ -LIBSSH_API socket_t ssh_bind_get_fd(SSH_BIND *sshbind); +LIBSSH_API socket_t ssh_bind_get_fd(ssh_bind ssh_bind); /** * @brief Set the file descriptor for a session. * * @param ssh_bind The ssh server bind to set the fd. * - * @param fd The file descriptor. + * @param fd The file descriptssh_bind B */ -LIBSSH_API void ssh_bind_set_fd(SSH_BIND *sshbind, socket_t fd); +LIBSSH_API void ssh_bind_set_fd(ssh_bind sshbind, socket_t fd); /** * @brief Allow the file descriptor to accept new sessions. * * @param ssh_bind The ssh server bind to use. */ -LIBSSH_API void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind); +LIBSSH_API void ssh_bind_fd_toaccept(ssh_bind ssh_bind); /** * @brief Accept an incoming ssh connection and initialize the session. @@ -115,14 +116,14 @@ LIBSSH_API void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind); * @see ssh_new * @return A newly allocated ssh session, NULL on error. */ -LIBSSH_API int ssh_bind_accept(SSH_BIND *ssh_bind, ssh_session session); +LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind, ssh_session session); /** * @brief Free a ssh servers bind. * * @param ssh_bind The ssh server bind to free. */ -LIBSSH_API void ssh_bind_free(SSH_BIND *ssh_bind); +LIBSSH_API void ssh_bind_free(ssh_bind ssh_bind); /** * @brief Exchange the banner and cryptographic keys. diff --git a/libssh/server.c b/libssh/server.c index 49c6cf8..986ec04 100644 --- a/libssh/server.c +++ b/libssh/server.c @@ -73,7 +73,7 @@ static char *hstrerror(int h_errno_val) { #endif /* _WIN32 */ /* TODO FIXME: must use getaddrinfo */ -static socket_t bind_socket(SSH_BIND *sshbind, const char *hostname, +static socket_t bind_socket(ssh_bind sshbind, const char *hostname, int port) { struct sockaddr_in myaddr; struct hostent *hp=NULL; @@ -121,10 +121,10 @@ static socket_t bind_socket(SSH_BIND *sshbind, const char *hostname, return s; } -SSH_BIND *ssh_bind_new(void) { - SSH_BIND *ptr; +ssh_bind ssh_bind_new(void) { + ssh_bind ptr; - ptr = malloc(sizeof(SSH_BIND)); + ptr = malloc(sizeof(struct ssh_bind_struct)); if (ptr == NULL) { return NULL; } @@ -134,7 +134,7 @@ SSH_BIND *ssh_bind_new(void) { return ptr; } -int ssh_bind_listen(SSH_BIND *sshbind) { +int ssh_bind_listen(ssh_bind sshbind) { const char *host; int fd; @@ -164,23 +164,23 @@ int ssh_bind_listen(SSH_BIND *sshbind) { return 0; } -void ssh_bind_set_blocking(SSH_BIND *sshbind, int blocking) { +void ssh_bind_set_blocking(ssh_bind sshbind, int blocking) { sshbind->blocking = blocking ? 1 : 0; } -socket_t ssh_bind_get_fd(SSH_BIND *sshbind) { +socket_t ssh_bind_get_fd(ssh_bind sshbind) { return sshbind->bindfd; } -void ssh_bind_set_fd(SSH_BIND *sshbind, socket_t fd) { +void ssh_bind_set_fd(ssh_bind sshbind, socket_t fd) { sshbind->bindfd = fd; } -void ssh_bind_fd_toaccept(SSH_BIND *sshbind) { +void ssh_bind_fd_toaccept(ssh_bind sshbind) { sshbind->toaccept = 1; } -int ssh_bind_accept(SSH_BIND *sshbind, ssh_session session) { +int ssh_bind_accept(ssh_bind sshbind, ssh_session session) { ssh_private_key dsa = NULL; ssh_private_key rsa = NULL; int fd = -1; @@ -275,7 +275,7 @@ int ssh_bind_accept(SSH_BIND *sshbind, ssh_session session) { return SSH_OK; } -void ssh_bind_free(SSH_BIND *sshbind){ +void ssh_bind_free(ssh_bind sshbind){ int i; if (sshbind == NULL) { |