Flowgrind
Advanced TCP traffic generator
fg_error.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2014 Alexander Zimmermann <alexander.zimmermann@netapp.com>
8  *
9  * This file is part of Flowgrind.
10  *
11  * Flowgrind is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * Flowgrind is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with Flowgrind. If not, see <http://www.gnu.org/licenses/>.
23  *
24  */
25 
26 #ifndef _FG_ERROR_H_
27 #define _FG_ERROR_H_
28 
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif /* HAVE_CONFIG_H */
32 
33 #include <errno.h>
34 
36 #define crit(...) (error(ERR_CRIT, errno, __VA_ARGS__))
37 
38 #define critc(code, ...) (error(ERR_CRIT, code, __VA_ARGS__))
39 
40 #define critx(...) (error(ERR_CRIT, 0, __VA_ARGS__))
41 
43 #define err(...) (error(ERR_ERROR, errno, __VA_ARGS__))
44 
45 #define errc(code, ...) (error(ERR_ERROR, code, __VA_ARGS__))
46 
47 #define errx(...) (error(ERR_ERROR, 0, __VA_ARGS__))
48 
50 #define warn(...) (error(ERR_WARNING, errno, __VA_ARGS__))
51 
52 #define warnc(code, ...) (error(ERR_WARNING, code, __VA_ARGS__))
53 
54 #define warnx(...) (error(ERR_WARNING, 0, __VA_ARGS__))
55 
64 };
65 
80 void error(enum error_levels level, int errnum, const char *fmt, ...)
81  __attribute__((format(printf, 3, 4)));
82 
83 #endif /* _FG_ERROR_H_ */
ERR_CRIT
@ ERR_CRIT
Critical conditions.
Definition: fg_error.h:63
error
void error(enum error_levels level, int errnum, const char *fmt,...) __attribute__((format(printf
General error-reporting function.
ERR_WARNING
@ ERR_WARNING
Warning conditions.
Definition: fg_error.h:59
ERR_ERROR
@ ERR_ERROR
Error conditions.
Definition: fg_error.h:61
error_levels
error_levels
Error level, in order of increasing importance.
Definition: fg_error.h:57
config.h