Add.
[gnutls.git] / lib / gnutls_errors.h
blob46724708b08dba9b362505e889a78849146513de
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation
4 * Author: Nikos Mavroyanopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 * USA
25 #include <defines.h>
27 #define GNUTLS_E_INT_RET_0 -1251
28 #define GNUTLS_E_INT_HANDSHAKE_AGAIN -1252
30 #ifdef __FILE__
31 # ifdef __LINE__
32 # define gnutls_assert() _gnutls_debug_log( "ASSERT: %s:%d\n", __FILE__,__LINE__);
33 # else
34 # define gnutls_assert()
35 # endif
36 #else /* __FILE__ not defined */
37 # define gnutls_assert()
38 #endif
40 int _gnutls_asn2err (int asn_err);
41 void _gnutls_log (int, const char *fmt, ...);
43 extern int _gnutls_log_level;
45 #ifdef C99_MACROS
46 #define LEVEL(l, ...) if (_gnutls_log_level >= l || _gnutls_log_level > 9) \
47 _gnutls_log( l, __VA_ARGS__)
49 #define LEVEL_EQ(l, ...) if (_gnutls_log_level == l || _gnutls_log_level > 9) \
50 _gnutls_log( l, __VA_ARGS__)
52 # define _gnutls_debug_log(...) LEVEL(2, __VA_ARGS__)
53 # define _gnutls_handshake_log(...) LEVEL(3, __VA_ARGS__)
54 # define _gnutls_io_log(...) LEVEL_EQ(5, __VA_ARGS__)
55 # define _gnutls_buffers_log(...) LEVEL_EQ(6, __VA_ARGS__)
56 # define _gnutls_hard_log(...) LEVEL(9, __VA_ARGS__)
57 # define _gnutls_record_log(...) LEVEL(4, __VA_ARGS__)
58 # define _gnutls_read_log(...) LEVEL_EQ(7, __VA_ARGS__)
59 # define _gnutls_write_log(...) LEVEL_EQ(7, __VA_ARGS__)
60 # define _gnutls_x509_log(...) LEVEL(1, __VA_ARGS__)
61 #else
62 # define _gnutls_debug_log _gnutls_null_log
63 # define _gnutls_handshake_log _gnutls_null_log
64 # define _gnutls_io_log _gnutls_null_log
65 # define _gnutls_buffers_log _gnutls_null_log
66 # define _gnutls_hard_log _gnutls_null_log
67 # define _gnutls_record_log _gnutls_null_log
68 # define _gnutls_read_log _gnutls_null_log
69 # define _gnutls_write_log _gnutls_null_log
70 # define _gnutls_x509_log _gnutls_null_log
72 void _gnutls_null_log (void *, ...);
74 #endif /* C99_MACROS */