xref: /aosp_15_r20/external/selinux/libsepol/include/sepol/debug.h (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1*2d543d20SAndroid Build Coastguard Worker #ifndef _SEPOL_DEBUG_H_
2*2d543d20SAndroid Build Coastguard Worker #define _SEPOL_DEBUG_H_
3*2d543d20SAndroid Build Coastguard Worker 
4*2d543d20SAndroid Build Coastguard Worker #include <sepol/handle.h>
5*2d543d20SAndroid Build Coastguard Worker 
6*2d543d20SAndroid Build Coastguard Worker #ifdef __cplusplus
7*2d543d20SAndroid Build Coastguard Worker extern "C" {
8*2d543d20SAndroid Build Coastguard Worker #endif
9*2d543d20SAndroid Build Coastguard Worker 
10*2d543d20SAndroid Build Coastguard Worker /* Deprecated */
11*2d543d20SAndroid Build Coastguard Worker extern void sepol_debug(int on);
12*2d543d20SAndroid Build Coastguard Worker /* End deprecated */
13*2d543d20SAndroid Build Coastguard Worker 
14*2d543d20SAndroid Build Coastguard Worker #define SEPOL_MSG_ERR  1
15*2d543d20SAndroid Build Coastguard Worker #define SEPOL_MSG_WARN 2
16*2d543d20SAndroid Build Coastguard Worker #define SEPOL_MSG_INFO 3
17*2d543d20SAndroid Build Coastguard Worker 
18*2d543d20SAndroid Build Coastguard Worker extern int sepol_msg_get_level(sepol_handle_t * handle);
19*2d543d20SAndroid Build Coastguard Worker 
20*2d543d20SAndroid Build Coastguard Worker extern const char *sepol_msg_get_channel(sepol_handle_t * handle);
21*2d543d20SAndroid Build Coastguard Worker 
22*2d543d20SAndroid Build Coastguard Worker extern const char *sepol_msg_get_fname(sepol_handle_t * handle);
23*2d543d20SAndroid Build Coastguard Worker 
24*2d543d20SAndroid Build Coastguard Worker /* Set the messaging callback.
25*2d543d20SAndroid Build Coastguard Worker  * By the default, the callback will print
26*2d543d20SAndroid Build Coastguard Worker  * the message on standard output, in a
27*2d543d20SAndroid Build Coastguard Worker  * particular format. Passing NULL here
28*2d543d20SAndroid Build Coastguard Worker  * indicates that messaging should be suppressed */
29*2d543d20SAndroid Build Coastguard Worker extern void sepol_msg_set_callback(sepol_handle_t * handle,
30*2d543d20SAndroid Build Coastguard Worker #ifdef __GNUC__
31*2d543d20SAndroid Build Coastguard Worker 				   __attribute__ ((format(printf, 3, 4)))
32*2d543d20SAndroid Build Coastguard Worker #endif
33*2d543d20SAndroid Build Coastguard Worker 				   void (*msg_callback) (void *varg,
34*2d543d20SAndroid Build Coastguard Worker 							 sepol_handle_t *
35*2d543d20SAndroid Build Coastguard Worker 							 handle,
36*2d543d20SAndroid Build Coastguard Worker 							 const char *fmt, ...),
37*2d543d20SAndroid Build Coastguard Worker 				   void *msg_callback_arg);
38*2d543d20SAndroid Build Coastguard Worker 
39*2d543d20SAndroid Build Coastguard Worker #ifdef __cplusplus
40*2d543d20SAndroid Build Coastguard Worker }
41*2d543d20SAndroid Build Coastguard Worker #endif
42*2d543d20SAndroid Build Coastguard Worker 
43*2d543d20SAndroid Build Coastguard Worker #endif
44