CJOSE
0.6.2.3
Loading...
Searching...
No Matches
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
42
{
44
CJOSE_ERR_NONE
= 0,
45
47
CJOSE_ERR_INVALID_ARG
,
48
50
CJOSE_ERR_INVALID_STATE
,
51
53
CJOSE_ERR_NO_MEMORY
,
54
56
CJOSE_ERR_CRYPTO
,
57
58
}
cjose_errcode
;
59
66
typedef
struct
67
{
69
cjose_errcode
code
;
70
72
const
char
*
message
;
73
76
const
char
*
function
;
77
79
const
char
*
file
;
80
82
unsigned
long
line
;
83
84
}
cjose_err
;
85
92
const
char
*
cjose_err_message
(
cjose_errcode
code);
93
102
#define CJOSE_ERROR(err, errcode) \
103
GCC_BEGIN_IGNORED_WARNING_ADDRESS \
104
if ((err) != NULL && (errcode) != CJOSE_ERR_NONE) \
105
{ \
106
(err)->code = (errcode); \
107
(err)->message = cjose_err_message((errcode)); \
108
(err)->function = __func__; \
109
(err)->file = __FILE__; \
110
(err)->line = __LINE__; \
111
} \
112
GCC_END_IGNORED_WARNING_ADDRESS
113
114
#ifdef __cplusplus
115
}
116
#endif
117
118
#endif
/* CJOSE_ERROR_H */
cjose_errcode
cjose_errcode
Definition
error.h:42
CJOSE_ERR_INVALID_STATE
@ CJOSE_ERR_INVALID_STATE
Definition
error.h:50
CJOSE_ERR_CRYPTO
@ CJOSE_ERR_CRYPTO
Definition
error.h:56
CJOSE_ERR_INVALID_ARG
@ CJOSE_ERR_INVALID_ARG
Definition
error.h:47
CJOSE_ERR_NONE
@ CJOSE_ERR_NONE
Definition
error.h:44
CJOSE_ERR_NO_MEMORY
@ CJOSE_ERR_NO_MEMORY
Definition
error.h:53
cjose_err_message
const char * cjose_err_message(cjose_errcode code)
cjose_err
Definition
error.h:67
cjose_err::file
const char * file
Definition
error.h:79
cjose_err::function
const char * function
Definition
error.h:76
cjose_err::code
cjose_errcode code
Definition
error.h:69
cjose_err::message
const char * message
Definition
error.h:72
cjose_err::line
unsigned long line
Definition
error.h:82
Generated on Mon Sep 23 2024 03:53:56 for CJOSE by
1.9.7