Open SCAP Library
Loading...
Searching...
No Matches
_error.h
1
2/*
3 * Copyright 2009-2010 Red Hat Inc., Durham, North Carolina.
4 * All Rights Reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Authors:
21 * Lukas Kuklinek <lkuklinek@redhat.com>
22 */
23
24#pragma once
25#ifndef _OSCAP_ERROR_H
26#define _OSCAP_ERROR_H
27
28#include <errno.h>
29#include <libxml/xmlerror.h>
30#include "public/oscap_error.h"
31
32#define oscap_assert_errno(cond, desc) \
33 { if (!(cond)) { if ((errno)) oscap_seterr(OSCAP_EFAMILY_GLIBC, desc); \
34 else oscap_seterr(OSCAP_EFAMILY_OSCAP, desc); } }
35
36#define oscap_setxmlerr(error) __oscap_setxmlerr (__FILE__, __LINE__, __PRETTY_FUNCTION__, error)
37
38void __oscap_setxmlerr(const char *file, uint32_t line, const char *func, const xmlError *error);
39
41 oscap_errfamily_t family;
42 char *desc;
43 const char *func;
44 const char *file;
45 uint32_t line;
46 struct oscap_err_t *next;
47};
48
52#define oscap_seterr(family, ...) __oscap_seterr (__FILE__, __LINE__, __PRETTY_FUNCTION__, family, __VA_ARGS__)
53
54
58__attribute__((format (printf, 5, 6)))
59void __oscap_seterr(const char *file, uint32_t line, const char *func, oscap_errfamily_t family, const char *fmt, ...);
60
61#endif /* _OSCAP_ERROR_H */
uint16_t oscap_errfamily_t
Error family type.
Definition oscap_error.h:51
Definition _error.h:40