Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 1 | /* Author: Joshua Brindle <jbrindle@tresys.com> |
| 2 | * Jason Tang <jtang@tresys.com> |
| 3 | * Ivan Gyurdiev <ivg2@cornell.edu> |
| 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_DEBUG_H_ |
| 24 | #define _SEMANAGE_DEBUG_H_ |
| 25 | |
| 26 | #include <semanage/handle.h> |
| 27 | |
| 28 | #define SEMANAGE_MSG_ERR 1 |
| 29 | #define SEMANAGE_MSG_WARN 2 |
| 30 | #define SEMANAGE_MSG_INFO 3 |
| 31 | |
| 32 | extern int semanage_msg_get_level(semanage_handle_t * handle); |
| 33 | |
| 34 | extern const char *semanage_msg_get_channel(semanage_handle_t * handle); |
| 35 | |
| 36 | extern const char *semanage_msg_get_fname(semanage_handle_t * handle); |
| 37 | |
| 38 | /* Set the messaging callback. |
| 39 | * By the default, the callback will print |
| 40 | * the message on standard output, in a |
| 41 | * particular format. Passing NULL here |
| 42 | * indicates that messaging should be suppressed */ |
| 43 | extern void semanage_msg_set_callback(semanage_handle_t * handle, |
| 44 | #ifdef __GNUC__ |
| 45 | __attribute__ ((format(printf, 3, 4))) |
| 46 | #endif |
| 47 | void (*msg_callback) (void *varg, |
| 48 | semanage_handle_t * |
| 49 | handle, |
| 50 | const char *fmt, |
| 51 | ...), |
| 52 | void *msg_callback_arg); |
| 53 | |
| 54 | #endif |