Debian Codegraph @

libsemanage/src/debug.h

raw symbols SCIP
1 /* Author: Joshua Brindle <[email protected]>
2 * Jason Tang <[email protected]>
3 * Ivan Gyurdiev <[email protected]>
4 *
5 * Copyright (C) 2005 Tresys Technology, LLC
6 * Copyright (C) 2005 Red Hat Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but 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.
17 *
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 St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef _SEMANAGE_INTERNAL_DEBUG_H_
24 #define _SEMANAGE_INTERNAL_DEBUG_H_
25
26 #include <stdio.h>
27 #include <semanage/debug.h>
28 #include <sepol/debug.h>
29 #include "handle.h"
30 #include "dso.h"
31
32 #define STATUS_SUCCESS 0
33 #define STATUS_ERR -1
34 #define STATUS_NODATA 1
35
36 #define msg_write(handle_arg, level_arg, \
37 channel_arg, func_arg, ...) do { \
38 \
39 if ((handle_arg)->msg_callback) { \
40 (handle_arg)->msg_fname = func_arg; \
41 (handle_arg)->msg_channel = channel_arg; \
42 (handle_arg)->msg_level = level_arg; \
43 \
44 (handle_arg)->msg_callback( \
45 (handle_arg)->msg_callback_arg, \
46 handle_arg, __VA_ARGS__); \
47 } \
48 } while(0)
49
50 #define ERR(handle, ...) \
51 msg_write(handle, SEMANAGE_MSG_ERR, "libsemanage", \
52 __FUNCTION__, __VA_ARGS__)
53
54 #define INFO(handle, ...) \
55 msg_write(handle, SEMANAGE_MSG_INFO, "libsemanage", \
56 __FUNCTION__, __VA_ARGS__)
57
58 #define WARN(handle, ...) \
59 msg_write(handle, SEMANAGE_MSG_WARN, "libsemanage", \
60 __FUNCTION__, __VA_ARGS__)
61
62 #ifdef __GNUC__
63 __attribute__ ((format(printf, 3, 4)))
64 #endif
65 extern void hidden semanage_msg_default_handler(void *varg,
66 semanage_handle_t * handle,
67 const char *fmt, ...);
68
69 #ifdef __GNUC__
70 __attribute__ ((format(printf, 3, 4)))
71 #endif
72 extern void hidden semanage_msg_relay_handler(void *varg,
73 sepol_handle_t * handle,
74 const char *fmt, ...);
75
76 hidden_proto(semanage_msg_get_channel)
77 hidden_proto(semanage_msg_get_fname)
78 hidden_proto(semanage_msg_get_level)
79 #endif