|
Packit Service |
4684c1 |
/* GnuTLS --- Guile bindings for GnuTLS.
|
|
Packit Service |
4684c1 |
Copyright (C) 2007-2012, 2019 Free Software Foundation, Inc.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
GnuTLS is free software; you can redistribute it and/or
|
|
Packit Service |
4684c1 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
4684c1 |
License as published by the Free Software Foundation; either
|
|
Packit Service |
4684c1 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
GnuTLS is distributed in the hope that it will be useful,
|
|
Packit Service |
4684c1 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4684c1 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
4684c1 |
Lesser General Public License for more details.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
4684c1 |
License along with GnuTLS; if not, write to the Free Software
|
|
Packit Service |
4684c1 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* Written by Ludovic Courtès <ludo@chbouib.org>. */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#ifdef HAVE_CONFIG_H
|
|
Packit Service |
4684c1 |
#include <config.h>
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include <libguile.h>
|
|
Packit Service |
4684c1 |
#include <gnutls/gnutls.h>
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include "errors.h"
|
|
Packit Service |
4684c1 |
#include "enums.h"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
SCM_SYMBOL (gnutls_error_key, "gnutls-error");
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
void
|
|
Packit Service |
4684c1 |
scm_gnutls_error_with_args (int c_err, const char *c_func, SCM args)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
SCM err, func;
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* Note: If error code C_ERR is unknown, then ERR will be `#f'. */
|
|
Packit Service |
4684c1 |
err = scm_from_gnutls_error (c_err);
|
|
Packit Service |
4684c1 |
func = scm_from_locale_symbol (c_func);
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
(void) scm_throw (gnutls_error_key, scm_cons2 (err, func, args));
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* XXX: This is actually never reached, but since the Guile headers don't
|
|
Packit Service |
4684c1 |
declare `scm_throw ()' as `noreturn', we must add this to avoid GCC's
|
|
Packit Service |
4684c1 |
complaints. */
|
|
Packit Service |
4684c1 |
abort ();
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
void
|
|
Packit Service |
4684c1 |
scm_gnutls_error (int c_err, const char *c_func)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
scm_gnutls_error_with_args (c_err, c_func, SCM_EOL);
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
SCM_DEFINE (scm_gnutls_fatal_error_p, "fatal-error?", 1, 0, 0,
|
|
Packit Service |
4684c1 |
(SCM err),
|
|
Packit Service |
4684c1 |
"Return true if @var{error} is fatal.")
|
|
Packit Service |
4684c1 |
#define FUNC_NAME s_scm_gnutls_fatal_error_p
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
int c_err = scm_to_gnutls_error (err, 1, FUNC_NAME);
|
|
Packit Service |
4684c1 |
return scm_from_bool (gnutls_error_is_fatal (c_err));
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
#undef FUNC_NAME
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
void
|
|
Packit Service |
4684c1 |
scm_init_gnutls_error (void)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
#include "errors.x"
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* arch-tag: 48f07ecf-65c4-480c-b043-a51eab592d6b
|
|
Packit Service |
4684c1 |
*/
|