Open SCAP Library
|
00001 00002 /* 00003 * Copyright 2009-2010 Red Hat Inc., Durham, North Carolina. 00004 * All Rights Reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 * Authors: 00021 * Lukas Kuklinek <lkuklinek@redhat.com> 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/error.h" 00031 00032 #define oscap_assert_errno(cond, etype, desc) \ 00033 { if (!(cond)) { if ((errno)) oscap_seterr(OSCAP_EFAMILY_GLIBC, errno, desc); \ 00034 else oscap_seterr(OSCAP_EFAMILY_OSCAP, (etype), 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 oscap_errcode_t code; 00043 char *desc; 00044 const char *func; 00045 const char *file; 00046 uint32_t line; 00047 }; 00048 00052 #define oscap_seterr(family, code, desc) __oscap_seterr (__FILE__, __LINE__, __PRETTY_FUNCTION__, family, code, desc) 00053 00054 00058 void __oscap_seterr(const char *file, uint32_t line, const char *func, 00059 oscap_errfamily_t family, oscap_errcode_t code, const char *desc); 00060 00061 #endif /* _OSCAP_ERROR_H */