diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-09-25 23:50:18 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-09-25 23:50:18 +0200 |
commit | 5e76118512b92d42035f5dcdd7e4469aca2da23f (patch) | |
tree | e93e5d5c802129c64d1e0f9726003a4211d8f3c9 | |
parent | e3bdc393cb6406209103cd478ee20d39e96550c6 (diff) | |
download | libssh-5e76118512b92d42035f5dcdd7e4469aca2da23f.tar.gz libssh-5e76118512b92d42035f5dcdd7e4469aca2da23f.tar.xz libssh-5e76118512b92d42035f5dcdd7e4469aca2da23f.zip |
fix ssh_callbacks_init() macro + documentation
ssh_callbacks_init should not zero' the struct because
it could be used on staticaly declared structures
-rw-r--r-- | include/libssh/callback.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/include/libssh/callback.h b/include/libssh/callback.h index c849bf8b..22dcfb4e 100644 --- a/include/libssh/callback.h +++ b/include/libssh/callback.h @@ -26,9 +26,8 @@ #ifndef _SSH_CALLBACK_H #define _SSH_CALLBACK_H -#include <string.h> - #include <libssh/libssh.h> +#include <string.h> #ifdef __cplusplus extern "C" { @@ -53,16 +52,29 @@ typedef void (*ssh_log_callback) (ssh_session session, int priority, const char *message, void *userdata); struct ssh_callbacks_struct { - size_t size; /* size of this structure */ - void *userdata; /* User-provided data */ - ssh_auth_callback auth_function; /* this functions will be called if e.g. a keyphrase is needed. */ - ssh_log_callback log_function; //log callback - void (*connect_status_function)(void *arg, float status); /* status callback function */ + /** size of this structure. internal, shoud be set with ssh_callbacks_init()*/ + size_t size; + /** User-provided data. User is free to set anything he wants here */ + void *userdata; + /** this functions will be called if e.g. a keyphrase is needed. */ + ssh_auth_callback auth_function; + /** this function will be called each time a loggable event happens. */ + ssh_log_callback log_function; + /** this function gets called during connection time to indicate the percentage + * of connection steps completed. + */ + void (*connect_status_function)(void *userdata, float status); }; typedef struct ssh_callbacks_struct * ssh_callbacks; + +/** Initializes an ssh_callbacks_struct + * A call to this macro is mandatory when you have set a new + * ssh_callback_struct structure. Its goal is to maintain the binary + * compatibility with future versions of libssh as the structure + * evolves with time. + */ #define ssh_callbacks_init(p) do {\ - memset(p,'\0',sizeof(*p)); \ p->size=sizeof(*p); \ } while(0); |