diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-08-23 16:33:59 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-08-23 16:33:59 +0200 |
commit | 8bae43876fff891e33d48b177778ee4cb882c45a (patch) | |
tree | 5c30ea9b6f73de5b116ad35e73f6da5bb2e6a301 /include | |
parent | e707af1cd78f730e80da7b109ee33985d0ee3419 (diff) | |
download | libssh-8bae43876fff891e33d48b177778ee4cb882c45a.tar.gz libssh-8bae43876fff891e33d48b177778ee4cb882c45a.tar.xz libssh-8bae43876fff891e33d48b177778ee4cb882c45a.zip |
experimental callback system
Diffstat (limited to 'include')
-rw-r--r-- | include/libssh/callback.h | 43 | ||||
-rw-r--r-- | include/libssh/libssh.h | 3 | ||||
-rw-r--r-- | include/libssh/priv.h | 8 | ||||
-rw-r--r-- | include/libssh/server.h | 2 |
4 files changed, 50 insertions, 6 deletions
diff --git a/include/libssh/callback.h b/include/libssh/callback.h new file mode 100644 index 00000000..759db0eb --- /dev/null +++ b/include/libssh/callback.h @@ -0,0 +1,43 @@ +/* + * This file is part of the SSH Library + * + * Copyright (c) 2009 Aris Adamantiadis <aris@0xbadc0de.be> + * + * The SSH Library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * The SSH Library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the SSH Library; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +/* callback.h + * This file includes the declarations for the libssh callback mechanism + */ + +#include "libssh.h" + +typedef int (*ssh_callback_int) (ssh_session session, void *user, int code); +typedef int (*ssh_message_callback) (ssh_session, void *user, ssh_message message); +typedef int (*ssh_channel_callback_int) (ssh_channel channel, void *user, int code); +typedef int (*ssh_channel_callback_data) (ssh_channel channel, void *user, int code, void *data, int len); + +struct ssh_callbacks_struct { + ssh_callback_int connection_progress; + void *connection_progress_user; + ssh_channel_callback_int channel_write_confirm; + void *channel_write_confirm_user; + ssh_channel_callback_data channel_read_available; + void *channel_read_available_user; +}; + +typedef struct ssh_callbacks_struct * ssh_callbacks; + diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index 62a74ffa..e5447878 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -441,7 +441,8 @@ LIBSSH_API int ssh_init(void); LIBSSH_API int ssh_finalize(void); /* messages.c */ -typedef struct ssh_message SSH_MESSAGE; +typedef struct ssh_message_struct SSH_MESSAGE; +typedef struct ssh_message_struct *ssh_message; LIBSSH_API SSH_MESSAGE *ssh_message_retrieve(SSH_SESSION *session, uint32_t packettype); LIBSSH_API SSH_MESSAGE *ssh_message_get(SSH_SESSION *session); diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 152753a3..bf348d4e 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -372,7 +372,7 @@ struct ssh_scp_struct { size_t processed; }; -struct ssh_message; +struct ssh_message_struct; struct ssh_session_struct { struct error_struct error; @@ -438,7 +438,7 @@ struct ssh_session_struct { int auth_methods; int hostkeys; /* contains type of host key wanted by client, in server impl */ struct ssh_list *ssh_message_list; /* list of delayed SSH messages */ - int (*ssh_message_callback)( struct ssh_session_struct *session,struct ssh_message *msg); + int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg); int log_verbosity; /*cached copy of the option structure */ int log_indent; /* indentation level in enter_function logs */ }; @@ -506,7 +506,7 @@ struct ssh_channel_request { char *subsystem; }; -struct ssh_message { +struct ssh_message_struct { SSH_SESSION *session; int type; struct ssh_auth_request auth_request; @@ -707,7 +707,7 @@ ssh_string try_publickey_from_file(SSH_SESSION *session, /* in keys.c */ const char *ssh_type_to_char(int type); int ssh_type_from_name(const char *name); -ssh_buffer ssh_userauth_build_digest(SSH_SESSION *session, struct ssh_message *msg, char *service); +ssh_buffer ssh_userauth_build_digest(SSH_SESSION *session, ssh_message msg, char *service); ssh_private_key privatekey_make_dss(SSH_SESSION *session, ssh_buffer buffer); ssh_private_key privatekey_make_rsa(SSH_SESSION *session, ssh_buffer buffer, diff --git a/include/libssh/server.h b/include/libssh/server.h index e71e2854..26f16b59 100644 --- a/include/libssh/server.h +++ b/include/libssh/server.h @@ -137,7 +137,7 @@ LIBSSH_API int ssh_message_service_reply_success(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_service_service(SSH_MESSAGE *msg); LIBSSH_API void ssh_set_message_callback(SSH_SESSION *session, - int(*ssh_message_callback)(ssh_session session, struct ssh_message *msg)); + int(*ssh_message_callback)(ssh_session session, ssh_message msg)); LIBSSH_API char *ssh_message_channel_request_open_originator(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_open_originator_port(SSH_MESSAGE *msg); |