diff options
author | Andreas Schneider <asn@cynapses.org> | 2010-09-06 14:28:38 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-09-06 14:28:38 +0200 |
commit | f7842e3a4b9acea2126ff725f993c299aef0e6db (patch) | |
tree | 18239f819a5edbcfc7f2961c48f3f9297314ef22 /libssh/error.c | |
parent | 38421403d2dc45636e597f2a909daa6ae31976de (diff) | |
download | libssh-f7842e3a4b9acea2126ff725f993c299aef0e6db.tar.gz libssh-f7842e3a4b9acea2126ff725f993c299aef0e6db.tar.xz libssh-f7842e3a4b9acea2126ff725f993c299aef0e6db.zip |
misc: Rename libssh/ to src/
Diffstat (limited to 'libssh/error.c')
-rw-r--r-- | libssh/error.c | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/libssh/error.c b/libssh/error.c deleted file mode 100644 index f5bb1190..00000000 --- a/libssh/error.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * error.c - functions for ssh error handling - * - * This file is part of the SSH Library - * - * Copyright (c) 2003-2008 by 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. - */ - -#include <stdio.h> -#include <stdarg.h> -#include "libssh/priv.h" - -/** - * @defgroup libssh_error The SSH error functions. - * @ingroup libssh - * - * Functions for error handling. - * - * @{ - */ - -/** - * @internal - * - * @brief Registers an error with a description. - * - * @param error The place to store the error. - * - * @param code The class of error. - * - * @param descr The description, which can be a format string. - * - * @param ... The arguments for the format string. - */ -void ssh_set_error(void *error, int code, const char *descr, ...) { - struct error_struct *err = error; - va_list va; - va_start(va, descr); - vsnprintf(err->error_buffer, ERROR_BUFFERLEN, descr, va); - va_end(va); - err->error_code = code; -} - -/** - * @internal - * - * @brief Registers an out of memory error - * - * @param error The place to store the error. - * - */ -void ssh_set_error_oom(void *error) { - struct error_struct *err = error; - - strcpy(err->error_buffer, "Out of memory"); - err->error_code = SSH_FATAL; -} - -/** - * @internal - * - * @brief Registers an invalid argument error - * - * @param error The place to store the error. - * - * @param function The function the error happened in. - * - */ -void ssh_set_error_invalid(void *error, const char *function) { - ssh_set_error(error, SSH_FATAL, "Invalid argument in %s", function); -} - -/** - * @brief Retrieve the error text message from the last error. - * - * @param error The SSH session pointer. - * - * @return A static string describing the error. - */ -const char *ssh_get_error(void *error) { - struct error_struct *err = error; - - return err->error_buffer; -} - -/** - * @brief Retrieve the error code from the last error. - * - * @param error The SSH session pointer. - * - * \return SSH_NO_ERROR No error occurred\n - * SSH_REQUEST_DENIED The last request was denied but situation is - * recoverable\n - * SSH_FATAL A fatal error occurred. This could be an unexpected - * disconnection\n - * - * Other error codes are internal but can be considered same than - * SSH_FATAL. - */ -int ssh_get_error_code(void *error) { - struct error_struct *err = error; - - return err->error_code; -} - -/** @} */ - -/* vim: set ts=4 sw=4 et cindent: */ |