1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/*
* Copyright (C) 2000 Nikos Mavroyanopoulos
*
* This file is part of GNUTLS.
*
* GNUTLS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GNUTLS 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "gnutls_int.h"
#include "gnutls_errors_int.h"
#ifdef DEBUG
# ifdef __FILE__
# ifdef __LINE__
# define gnutls_assert() fprintf(stderr, "GNUTLS_ASSERT: %s:%d\n", __FILE__,__LINE__);
# else
# define gnutls_assert()
# endif
# else /* __FILE__ defined */
# define gnutls_assert()
# endif
#else /* no debug */
# define gnutls_assert()
#endif
int _gnutls_asn2err( int asn_err);
const char* gnutls_strerror(int error);
void gnutls_perror(int error);
int gnutls_error_is_fatal( int error);
#ifdef DEBUG
void _gnutls_log( const char *fmt, ...);
# ifdef HANDSHAKE_DEBUG
# define _gnutls_handshake_log _gnutls_log
# else
# define _gnutls_handshake_log( ...)
# endif
# ifdef IO_DEBUG
# define _gnutls_io_log _gnutls_log
# else
# define _gnutls_io_log( ...)
# endif
# ifdef BUFFERS_DEBUG
# define _gnutls_buffers_log _gnutls_log
# else
# define _gnutls_buffers_log( ...)
# endif
# ifdef HARD_DEBUG
# define _gnutls_hard_log _gnutls_log
# else
# define _gnutls_hard_log( ...)
# endif
# ifdef RECORD_DEBUG
# define _gnutls_record_log _gnutls_log
# else
# define _gnutls_record_log( ...)
# endif
# ifdef READ_DEBUG
# define _gnutls_read_log _gnutls_log
# else
# define _gnutls_read_log( ...)
# endif
# ifdef WRITE_DEBUG
# define _gnutls_write_log _gnutls_log
# else
# define _gnutls_write_log( ...)
# endif
# ifdef X509_DEBUG
# define _gnutls_x509_log _gnutls_log
# else
# define _gnutls_x509_log( ...)
# endif
#else
/* FIXME: These macros only work with C99 compliant compilers
*/
# ifdef C99_MACROS
# define _gnutls_log(...)
# define _gnutls_handshake_log( ...)
# define _gnutls_io_log( ...)
# define _gnutls_buffers_log( ...)
# define _gnutls_hard_log( ...)
# define _gnutls_record_log( ...)
# define _gnutls_read_log( ...)
# define _gnutls_write_log( ...)
# define _gnutls_x509_log( ...)
# else
# define _gnutls_log _gnutls_null_log
# define _gnutls_handshake_log _gnutls_null_log
# define _gnutls_io_log _gnutls_null_log
# define _gnutls_buffers_log _gnutls_null_log
# define _gnutls_hard_log _gnutls_null_log
# define _gnutls_record_log _gnutls_null_log
# define _gnutls_read_log _gnutls_null_log
# define _gnutls_write_log _gnutls_null_log
# define _gnutls_x509_log _gnutls_null_log
void _gnutls_null_log( void*, ...);
# endif /* C99_MACROS */
#endif /* DEBUG */
|