CJOSE  0.6.0
Classes | Macros | Enumerations | Functions
error.h File Reference

Datatypes and functions for error reporting. More...

Go to the source code of this file.

Classes

struct  cjose_err
 

Macros

#define GCC_BEGIN_IGNORED_WARNING_ADDRESS
 
#define GCC_END_IGNORED_WARNING_ADDRESS
 
#define CJOSE_ERROR(err, errcode)
 

Enumerations

enum  cjose_errcode {
  CJOSE_ERR_NONE = 0, CJOSE_ERR_INVALID_ARG, CJOSE_ERR_INVALID_STATE, CJOSE_ERR_NO_MEMORY,
  CJOSE_ERR_CRYPTO
}
 

Functions

const char * cjose_err_message (cjose_errcode code)
 

Detailed Description

Datatypes and functions for error reporting.

Copyrights

Portions created or assigned to Cisco Systems, Inc. are Copyright (c) 2014-2016 Cisco Systems, Inc. All Rights Reserved.

Macro Definition Documentation

◆ CJOSE_ERROR

#define CJOSE_ERROR (   err,
  errcode 
)
Value:
GCC_BEGIN_IGNORED_WARNING_ADDRESS \
if ((err) != NULL && (errcode) != CJOSE_ERR_NONE) \
{ \
(err)->code = (errcode); \
(err)->message = cjose_err_message((errcode)); \
(err)->function = __func__; \
(err)->file = __FILE__; \
(err)->line = __LINE__; \
} \
GCC_END_IGNORED_WARNING_ADDRESS
const char * cjose_err_message(cjose_errcode code)
Definition: error.h:43

Macro to initialize an error context.

Parameters
errThe pointer to the error context, or NULL if none
errcodeThe error code

◆ GCC_BEGIN_IGNORED_WARNING_ADDRESS

#define GCC_BEGIN_IGNORED_WARNING_ADDRESS

Temporarily disable compiler warnings, if possible (>=gcc-4.6).

In some cases (particularly within macros), certain compiler warnings are unavoidable. In order to allow these warnings to be treated as errors in most cases, these macros will disable particular warnings only during specific points in the compilation.

Enumeration Type Documentation

◆ cjose_errcode

Enumeration of defined error codes.

Enumerator
CJOSE_ERR_NONE 

No error

CJOSE_ERR_INVALID_ARG 

argument was invalid (beyond invariants)

CJOSE_ERR_INVALID_STATE 

context is not in a valid state

CJOSE_ERR_NO_MEMORY 

out of memory

CJOSE_ERR_CRYPTO 

an error returned from the crypto libraries

Function Documentation

◆ cjose_err_message()

const char* cjose_err_message ( cjose_errcode  code)

Retrieves the error message for the given error code.

Parameters
codeThe error code to lookup
Return values
constchar * The message for {code}