From b1bc283e9a37333c3989e263421761e4611ccbfe Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 10 Oct 2009 10:46:59 +0200 Subject: Rename callback header file. --- include/libssh/CMakeLists.txt | 2 +- include/libssh/callback.h | 91 ------------------------------------------- include/libssh/callbacks.h | 91 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 include/libssh/callback.h create mode 100644 include/libssh/callbacks.h diff --git a/include/libssh/CMakeLists.txt b/include/libssh/CMakeLists.txt index 11b6d19..359b6d2 100644 --- a/include/libssh/CMakeLists.txt +++ b/include/libssh/CMakeLists.txt @@ -1,7 +1,7 @@ project(libssh-headers C) set(libssh_HDRS - callback.h + callbacks.h libssh.h crypto.h ssh2.h diff --git a/include/libssh/callback.h b/include/libssh/callback.h deleted file mode 100644 index 25f071a..0000000 --- a/include/libssh/callback.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is part of the SSH Library - * - * Copyright (c) 2009 Aris Adamantiadis - * - * 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 public declarations for the libssh callback mechanism - */ - -#ifndef _SSH_CALLBACK_H -#define _SSH_CALLBACK_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief SSH authentication callback. - * - * @param prompt Prompt to be displayed. - * @param buf Buffer to save the password. You should null-terminate it. - * @param len Length of the buffer. - * @param echo Enable or disable the echo of what you type. - * @param verify Should the password be verified? - * @param userdata Userdata to be passed to the callback function. Useful - * for GUI applications. - * - * @return 0 on success, < 0 on error. - */ -typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len, - int echo, int verify, void *userdata); -typedef void (*ssh_log_callback) (ssh_session session, int priority, - const char *message, void *userdata); -/** this callback will be called with status going from 0.0 to 1.0 during - * connection */ -typedef void (*ssh_status_callback) (ssh_session session, float status, - void *userdata); - -struct ssh_callbacks_struct { - /** 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 {\ - p->size=sizeof(*p); \ -} while(0); - -LIBSSH_API int ssh_set_callbacks(ssh_session session, ssh_callbacks cb); - -#ifdef __cplusplus -} -#endif - -#endif /*_SSH_CALLBACK_H */ diff --git a/include/libssh/callbacks.h b/include/libssh/callbacks.h new file mode 100644 index 0000000..25f071a --- /dev/null +++ b/include/libssh/callbacks.h @@ -0,0 +1,91 @@ +/* + * This file is part of the SSH Library + * + * Copyright (c) 2009 Aris Adamantiadis + * + * 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 public declarations for the libssh callback mechanism + */ + +#ifndef _SSH_CALLBACK_H +#define _SSH_CALLBACK_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief SSH authentication callback. + * + * @param prompt Prompt to be displayed. + * @param buf Buffer to save the password. You should null-terminate it. + * @param len Length of the buffer. + * @param echo Enable or disable the echo of what you type. + * @param verify Should the password be verified? + * @param userdata Userdata to be passed to the callback function. Useful + * for GUI applications. + * + * @return 0 on success, < 0 on error. + */ +typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len, + int echo, int verify, void *userdata); +typedef void (*ssh_log_callback) (ssh_session session, int priority, + const char *message, void *userdata); +/** this callback will be called with status going from 0.0 to 1.0 during + * connection */ +typedef void (*ssh_status_callback) (ssh_session session, float status, + void *userdata); + +struct ssh_callbacks_struct { + /** 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 {\ + p->size=sizeof(*p); \ +} while(0); + +LIBSSH_API int ssh_set_callbacks(ssh_session session, ssh_callbacks cb); + +#ifdef __cplusplus +} +#endif + +#endif /*_SSH_CALLBACK_H */ -- cgit