diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libssh/priv.h | 6 | ||||
-rw-r--r-- | include/libssh/server.h | 31 |
2 files changed, 36 insertions, 1 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h index a35aa090..4d00a0cb 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -147,7 +147,10 @@ struct ssh_bind_struct { struct error_struct error; ssh_callbacks callbacks; /* Callbacks to user functions */ + struct ssh_bind_callbacks_struct *bind_callbacks; + void *bind_callbacks_userdata; + struct ssh_poll_handle_struct *poll; /* options */ char *wanted_methods[10]; char *banner; @@ -162,6 +165,9 @@ struct ssh_bind_struct { int toaccept; }; +struct ssh_poll_handle_struct *ssh_bind_get_poll(struct ssh_bind_struct + *sshbind); + SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback); SSH_PACKET_CALLBACK(ssh_packet_ignore_callback); diff --git a/include/libssh/server.h b/include/libssh/server.h index 048abcdc..12f64803 100644 --- a/include/libssh/server.h +++ b/include/libssh/server.h @@ -48,9 +48,35 @@ enum ssh_bind_options_e { SSH_BIND_OPTIONS_LOG_VERBOSITY_STR }; -//typedef struct ssh_bind_struct SSH_BIND; + + typedef struct ssh_bind_struct* ssh_bind; +/* callback functions */ + +/** + * @brief Incoming connection callback. This callback is called when a ssh_bind + * has a new incoming connection. + * @param sshbind Current sshbind session handler + * @param message the actual message + * @param userdata Userdata to be passed to the callback function. + */ +typedef void (*ssh_bind_incoming_connection_callback) (ssh_bind sshbind, + void *userdata); + +/** + * These are the callbacks exported by the ssh_bind structure + * They are called by the server module when events appear on the network + */ + +struct ssh_bind_callbacks_struct { + /** DON'T SET THIS use ssh_callbacks_init() instead. */ + size_t size; + /** A new connection is available */ + ssh_bind_incoming_connection_callback incoming_connection; +}; +typedef struct ssh_bind_callbacks_struct *ssh_bind_callbacks; + /** * @brief Creates a new SSH server bind. * @@ -80,6 +106,9 @@ LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind, */ LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind_o); +LIBSSH_API int ssh_bind_set_callbacks(ssh_bind sshbind, ssh_bind_callbacks callbacks, + void *userdata); + /** * @brief Set the session to blocking/nonblocking mode. * |