summaryrefslogtreecommitdiffstats
path: root/src/util/msg_logger.h
blob: e135e7e380dbbe2c4da88b960465b0799b921abb (plain)
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
#ifndef _MSG_LOGGER_H_INCLUDED_
#define _MSG_LOGGER_H_INCLUDED_

/*++
/* NAME
/*	msg_logger 3h
/* SUMMARY
/*	direct diagnostics to logger service
/* SYNOPSIS
/*	#include <msg_logger.h>
/* DESCRIPTION
/* .nf

 /*
  * System library.
  */
#include <stdarg.h>

 /*
  * Utility library.
  */
#include <check_arg.h>

 /*
  * External interface.
  */
typedef void (*MSG_LOGGER_FALLBACK_FN) (const char *);

extern void msg_logger_init(const char *, const char *, const char *,
			            MSG_LOGGER_FALLBACK_FN);
extern void msg_logger_control(int,...);

/* Internal-only API: type-unchecked arguments. */
#define MSG_LOGGER_CTL_END		0
#define MSG_LOGGER_CTL_FALLBACK_ONLY	1
#define MSG_LOGGER_CTL_FALLBACK_FN	2
#define MSG_LOGGER_CTL_DISABLE		3

/* Safer API: type-checked arguments, external use. */
#define CA_MSG_LOGGER_CTL_END		MSG_LOGGER_CTL_END
#define CA_MSG_LOGGER_CTL_FALLBACK_ONLY	MSG_LOGGER_CTL_FALLBACK_ONLY
#define CA_MSG_LOGGER_CTL_FALLBACK_FN(v) \
	MSG_LOGGER_CTL_FALLBACK_FN, CHECK_VAL(MSG_LOGGER_CTL, \
		MSG_LOGGER_FALLBACK_FN, (v))
#define CA_MSG_LOGGER_CTL_DISABLE	MSG_LOGGER_CTL_DISABLE

CHECK_VAL_HELPER_DCL(MSG_LOGGER_CTL, MSG_LOGGER_FALLBACK_FN);

/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	Google, Inc.
/*	111 8th Avenue
/*	New York, NY 10011, USA
/*--*/

#endif