1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

No more SSH_BIND SSH_MESSAGE etc.

This commit is contained in:
Aris Adamantiadis
2009-10-09 22:37:23 +02:00
parent 1e0e8a5493
commit 71ab0cf6cc
2 changed files with 23 additions and 22 deletions

View File

@@ -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.

View File

@@ -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) {