00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #pragma once
00025 #ifndef _OSCAP_ERROR_H
00026 #define _OSCAP_ERROR_H
00027
00028 #include <errno.h>
00029 #include <libxml/xmlerror.h>
00030 #include "public/oscap_error.h"
00031
00032 #define oscap_assert_errno(cond, desc) \
00033 { if (!(cond)) { if ((errno)) oscap_seterr(OSCAP_EFAMILY_GLIBC, desc); \
00034 else oscap_seterr(OSCAP_EFAMILY_OSCAP, desc); } }
00035
00036 #define oscap_setxmlerr(error) __oscap_setxmlerr (__FILE__, __LINE__, __PRETTY_FUNCTION__, error)
00037
00038 void __oscap_setxmlerr(const char *file, uint32_t line, const char *func, xmlErrorPtr error);
00039
00040 struct oscap_err_t {
00041 oscap_errfamily_t family;
00042 char *desc;
00043 const char *func;
00044 const char *file;
00045 uint32_t line;
00046 };
00047
00051 #define oscap_seterr(family, ...) __oscap_seterr (__FILE__, __LINE__, __PRETTY_FUNCTION__, family, __VA_ARGS__)
00052
00053
00057 void __oscap_seterr(const char *file, uint32_t line, const char *func, oscap_errfamily_t family, ...);
00058
00059 #endif