CJOSE
0.6.0
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
#endif
17
26
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
27
#define GCC_END_IGNORED_WARNING _Pragma("GCC diagnostic pop")
28
29
#define GCC_BEGIN_IGNORED_WARNING_ADDRESS \
30
_Pragma("GCC diagnostic push"); \
31
_Pragma("GCC diagnostic ignored \"-Waddress\"")
32
#define GCC_END_IGNORED_WARNING_ADDRESS GCC_END_IGNORED_WARNING
33
#else
34
#define GCC_BEGIN_IGNORED_WARNING_ADDRESS
35
#define GCC_END_IGNORED_WARNING_ADDRESS
36
#endif
/* defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5) */
37
41
typedef
enum
{
43
CJOSE_ERR_NONE
= 0,
44
46
CJOSE_ERR_INVALID_ARG
,
47
49
CJOSE_ERR_INVALID_STATE
,
50
52
CJOSE_ERR_NO_MEMORY
,
53
55
CJOSE_ERR_CRYPTO
,
56
57
}
cjose_errcode
;
58
65
typedef
struct
66
{
68
cjose_errcode
code
;
69
71
const
char
*
message
;
72
75
const
char
*
function
;
76
78
const
char
*
file
;
79
81
unsigned
long
line
;
82
83
}
cjose_err
;
84
91
const
char
*
cjose_err_message
(
cjose_errcode
code);
92
101
#define CJOSE_ERROR(err, errcode) \
102
GCC_BEGIN_IGNORED_WARNING_ADDRESS \
103
if ((err) != NULL && (errcode) != CJOSE_ERR_NONE) \
104
{ \
105
(err)->code = (errcode); \
106
(err)->message = cjose_err_message((errcode)); \
107
(err)->function = __func__; \
108
(err)->file = __FILE__; \
109
(err)->line = __LINE__; \
110
} \
111
GCC_END_IGNORED_WARNING_ADDRESS
112
113
#ifdef __cplusplus
114
}
115
#endif
116
117
#endif
/* CJOSE_ERROR_H */
cjose_err::code
cjose_errcode code
Definition:
error.h:68
cjose_err_message
const char * cjose_err_message(cjose_errcode code)
CJOSE_ERR_INVALID_STATE
Definition:
error.h:49
CJOSE_ERR_CRYPTO
Definition:
error.h:55
cjose_err::file
const char * file
Definition:
error.h:78
cjose_err
Definition:
error.h:65
cjose_errcode
cjose_errcode
Definition:
error.h:41
cjose_err::message
const char * message
Definition:
error.h:71
CJOSE_ERR_NO_MEMORY
Definition:
error.h:52
CJOSE_ERR_NONE
Definition:
error.h:43
cjose_err::line
unsigned long line
Definition:
error.h:81
CJOSE_ERR_INVALID_ARG
Definition:
error.h:46
Generated on Tue Feb 13 2018 14:16:28 for CJOSE by
1.8.14