~ubuntu-branches/ubuntu/jaunty/pcsc-lite/jaunty-security

« back to all changes in this revision

Viewing changes to src/debuglog.h

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Rousseau
  • Date: 2004-06-13 21:45:56 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040613214556-zio7hrzkz9wwtffx
Tags: 1.2.9-beta2-2
* debian/rules: add -lpthread to LDFLAGS so that pthread_* symbols are
  included in the library (problem only seen on mips and mipsel).
  Closes: #253629
* debian/control: make libpcsclite-dev and libpcsclite1 at Priority:
  optional so that other packages at Priority: optional can use them.
  Closes: #249374

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************************
2
 
 
3
 
        MUSCLE SmartCard Development ( http://www.linuxnet.com )
4
 
            Title  : debuglog.h
5
 
            Package: pcsc lite
6
 
            Author : David Corcoran
7
 
                     Ludovic Rousseau
8
 
            Date   : 7/27/99, updated 9 Jan, 2002
9
 
            License: Copyright (C) 1999 David Corcoran
10
 
                     <corcoran@linuxnet.com>
11
 
            Purpose: This handles debugging. 
12
 
 
13
 
********************************************************************/
14
 
 
15
 
/*
 
1
/*
 
2
 * This handles debugging.
 
3
 *
 
4
 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
 
5
 *
 
6
 * Copyright (C) 1999-2002
 
7
 *  David Corcoran <corcoran@linuxnet.com>
 
8
 *  Ludovic Rousseau <ludovic.rousseau@free.fr>
 
9
 *
 
10
 * $Id: debuglog.h,v 1.11 2004/04/21 21:40:19 rousseau Exp $
 
11
 */
 
12
 
 
13
/*
 
14
 * log message is sent to syslog, stdout or stderr depending on --debug
 
15
 * command line argument
 
16
 *
16
17
 * DebugLogA("text");
17
 
 *      send "text" to syslog if USE_SYSLOG is defined
18
 
 *      print to stderr "text" if USE_SYSLOG is NOT defined
19
 
 *
20
 
 * DebugLogB("text: %d", 1234)
21
 
 *  send "text: 1234" to syslog if USE_SYSLOG is defined
22
 
 *  print to stderr "text: 1234" is USE_SYSLOG is NOT defined
23
 
 * the format string can be anything printf() can understand
24
 
 *
25
 
 * DebugXxd(msg, buffer, size)
26
 
 *  send to syslog (if USE_SYSLOG is defined) or print to stderr
27
 
 *  "msg" + a hex dump of size bytes of buffer[]
 
18
 *  log "text"
 
19
 *
 
20
 * DebugLogB("text: %d", 1234);
 
21
 *  log "text: 1234"
 
22
 * the format string can be anything printf() can understand
 
23
 *
 
24
 * DebugLogC("text: %d %d", 1234, 5678);
 
25
 *  log "text: 1234 5678"
 
26
 * the format string can be anything printf() can understand
 
27
 *
 
28
 * DebugXxd(msg, buffer, size);
 
29
 *  log "msg" + a hex dump of size bytes of buffer[]
28
30
 *
29
31
 */
30
32
 
32
34
#define __debuglog_h__
33
35
 
34
36
#ifdef __cplusplus
35
 
extern "C" {
36
 
#endif     
 
37
extern "C"
 
38
{
 
39
#endif
37
40
 
38
41
#define DEBUGLOG_LOG_ENTRIES    1
39
42
#define DEBUGLOG_IGNORE_ENTRIES 2
40
43
 
41
 
/*void DebugLogA( LPCSTR, LPCSTR, LONG );
42
 
 
43
 
void DebugLogB( LPCSTR, LONG, LPCSTR, LONG );
44
 
 
45
 
void DebugLogC( LPCSTR, LPCSTR, LPCSTR, LONG );
46
 
 
47
 
void DebugLogD( LPCSTR, PUCHAR, LONG, LPCSTR, LONG );*/
 
44
typedef enum {
 
45
        DEBUGLOG_NO_DEBUG = 0,
 
46
        DEBUGLOG_SYSLOG_DEBUG,
 
47
        DEBUGLOG_STDERR_DEBUG,
 
48
        DEBUGLOG_STDOUT_DEBUG,
 
49
} DebugLogType;
 
50
 
 
51
#define DEBUG_CATEGORY_NOTHING  0
 
52
#define DEBUG_CATEGORY_APDU     1 
 
53
#define DEBUG_CATEGORY_SW       2 
 
54
 
 
55
/* You can't do #ifndef __FUNCTION__ */
 
56
#if !defined(__GNUC__) && !defined(__IBMC__)
 
57
#define __FUNCTION__ ""
 
58
#endif
48
59
 
49
60
#ifdef PCSC_DEBUG
50
 
#define DebugLogA(fmt) debug_msg("%s:%d " fmt, __FILE__, __LINE__)
51
 
#define DebugLogB(fmt, data) debug_msg("%s:%d " fmt, __FILE__, __LINE__, data)
52
 
#define DebugLogC(fmt, data1, data2) debug_msg("%s:%d " fmt, __FILE__, __LINE__, data1, data2)
 
61
#define DebugLogA(fmt) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
 
62
#define DebugLogB(fmt, data) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
 
63
#define DebugLogC(fmt, data1, data2) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
53
64
#define DebugXxd(msg, buffer, size) debug_xxd(msg, buffer, size)
54
65
#else
55
66
#define DebugLogA(fmt)
58
69
#define DebugXxd(msg, buffer, size)
59
70
#endif
60
71
 
61
 
void debug_msg(char *fmt, ...);
 
72
void debug_msg(const char *fmt, ...);
62
73
void debug_xxd(const char *msg, const unsigned char *buffer, const int size);
63
74
 
64
 
void DebugLogSuppress( LONG );
 
75
void DebugLogSuppress(const int);
 
76
void DebugLogSetLogType(const int);
 
77
int DebugLogSetCategory(const int);
 
78
void DebugLogCategory(const int, const char *, const int);
65
79
 
66
 
LPSTR pcsc_stringify_error ( LONG );
 
80
char *pcsc_stringify_error(long);
67
81
 
68
82
#ifdef __cplusplus
69
83
}
70
 
#endif     
 
84
#endif
71
85
 
72
 
#endif /* __debuglog_h__ */
 
86
#endif                                                  /* __debuglog_h__ */
73
87