CJOSE
0.4.1
include
cjose
error.h
Go to the documentation of this file.
1
11
#ifndef CJOSE_ERROR_H
12
#define CJOSE_ERROR_H
13
14
#ifdef __cplusplus
15
extern
"C"
16
{
17
#endif
18
19
28
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
29
# define GCC_END_IGNORED_WARNING _Pragma("GCC diagnostic pop")
30
31
# define GCC_BEGIN_IGNORED_WARNING_ADDRESS \
32
_Pragma("GCC diagnostic push"); \
33
_Pragma("GCC diagnostic ignored \"-Waddress\"")
34
# define GCC_END_IGNORED_WARNING_ADDRESS GCC_END_IGNORED_WARNING
35
#else
36
# define GCC_BEGIN_IGNORED_WARNING_ADDRESS
37
# define GCC_END_IGNORED_WARNING_ADDRESS
38
#endif
/* defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5) */
39
40
44
typedef
enum
45
{
47
CJOSE_ERR_NONE
= 0,
48
50
CJOSE_ERR_INVALID_ARG
,
51
53
CJOSE_ERR_INVALID_STATE
,
54
56
CJOSE_ERR_NO_MEMORY
,
57
59
CJOSE_ERR_CRYPTO
,
60
61
}
cjose_errcode
;
62
63
70
typedef
struct
71
{
73
cjose_errcode
code
;
75
const
char
*
message
;
76
79
const
char
*
function
;
80
82
const
char
*
file
;
83
85
unsigned
long
line
;
86
87
}
cjose_err
;
88
89
96
const
char
*
cjose_err_message
(cjose_errcode code);
97
98
107
#define CJOSE_ERROR(err, errcode) \
108
GCC_BEGIN_IGNORED_WARNING_ADDRESS \
109
if ((err) != NULL && (errcode) != CJOSE_ERR_NONE) \
110
{ \
111
(err)->code = (errcode); \
112
(err)->message = cjose_err_message((errcode)); \
113
(err)->function = __func__; \
114
(err)->file = __FILE__; \
115
(err)->line = __LINE__; \
116
} \
117
GCC_END_IGNORED_WARNING_ADDRESS
118
119
#ifdef __cplusplus
120
}
121
#endif
122
123
#endif
/* CJOSE_ERROR_H */
cjose_err::code
cjose_errcode code
Definition:
error.h:73
cjose_err_message
const char * cjose_err_message(cjose_errcode code)
CJOSE_ERR_INVALID_STATE
Definition:
error.h:53
CJOSE_ERR_CRYPTO
Definition:
error.h:59
cjose_err::file
const char * file
Definition:
error.h:82
cjose_err
Definition:
error.h:70
cjose_errcode
cjose_errcode
Definition:
error.h:44
cjose_err::message
const char * message
Definition:
error.h:75
CJOSE_ERR_NO_MEMORY
Definition:
error.h:56
CJOSE_ERR_NONE
Definition:
error.h:47
cjose_err::line
unsigned long line
Definition:
error.h:85
CJOSE_ERR_INVALID_ARG
Definition:
error.h:50
Generated on Fri Sep 23 2016 13:14:09 for CJOSE by
1.8.12