pam_pkcs11 0.6.8

- Main Page
- Data Structures
- Files
- Directories

- File List
- Globals

debug.h
Go to the documentation of this file.

    00001 /*
    00002  * PKCS #11 PAM Login Module
    00003  * Copyright (C) 2003 Mario Strasser <mast@gmx.net>,
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Lesser General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2.1 of the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful,
    00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Lesser General Public License for more details.
    00014  *
    00015  * $Id: debug.h 363 2009-06-12 08:05:29Z ludovic.rousseau $
    00016  */
    00017
    00024 #ifndef __DEBUG_H_
    00025 #define __DEBUG_H_
    00026
    00027 #ifdef HAVE_CONFIG_H
    00028 #include <config.h>
    00029 #endif
    00030
    00031 #ifndef DEBUG
    00032
    00033 #warning "Debugging is completely disabled!"
    00034 #define DBG
    00035 #define DBG1
    00036 #define DBG2
    00037 #define DBG3
    00038 #define DBG4
    00039 #define DBG5
    00040 #define set_debug_level(l, ...) {}
    00041 #define debug(l, ...) {}
    00042
    00043 #else
    00044
    00045 /*
    00046 #define DBG(f, ...) debug_print(1, __FILE__, __LINE__, f, ## __VA_ARGS__)
    00047 */
    00048 /* this syntax is redundant in GCC, just used to avoid warns in -pedantic */
    00049 #define DBG(f) debug_print(1, __FILE__, __LINE__, f )
    00050 #define DBG1(f,a) debug_print(1, __FILE__, __LINE__, f , a )
    00051 #define DBG2(f,a,b) debug_print(1, __FILE__, __LINE__, f , a , b )
    00052 #define DBG3(f,a,b,c) debug_print(1, __FILE__, __LINE__, f , a , b , c )
    00053 #define DBG4(f,a,b,c,d) debug_print(1, __FILE__, __LINE__, f , a , b , c , d )
    00054 #define DBG5(f,a,b,c,d,e) debug_print(1, __FILE__, __LINE__, f , a , b , c , d , e )
    00055
    00056 #define ERR(f) debug_print(-1, __FILE__, __LINE__, f )
    00057 #define ERR1(f,a) debug_print(-1, __FILE__, __LINE__, f , a )
    00058 #define ERR2(f,a,b) debug_print(-1, __FILE__, __LINE__, f , a , b )
    00059 #define ERR3(f,a,b,c) debug_print(-1, __FILE__, __LINE__, f , a , b , c )
    00060 #define ERR4(f,a,b,c,d) debug_print(-1, __FILE__, __LINE__, f , a , b , c , d )
    00061 #define ERR5(f,a,b,c,d,e) debug_print(-1, __FILE__, __LINE__, f , a , b , c , d , e )
    00062
    00063 #ifndef __DEBUG_C_
    00064 #define DEBUG_EXTERN extern
    00065 #else
    00066 #define DEBUG_EXTERN
    00067 #endif
    00068
    00073 DEBUG_EXTERN void set_debug_level(int level);
    00074
    00079 DEBUG_EXTERN int get_debug_level(void);
    00080
    00093 DEBUG_EXTERN void debug_print(int level, const char *file, int line, const char *format, ...);
    00094
    00095 #undef DEBUG_EXTERN
    00096
    00097 #endif /* DEBUG */
    00098
    00099 #endif /* __DEBUG_H_ */