![]() |
Contiki-NG
|
Error handling module header for EDHOC. More...
#include <stdint.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | edhoc_error_context_t |
| Error context structure for debugging. More... | |
Macros | |
| #define | EDHOC_SUCCESS_CHECK(result) |
| Check if an operation was successful. | |
| #define | EDHOC_FAILED(result) |
| Check if an operation failed. | |
| #define | EDHOC_ERROR(code, msg) |
| Macro for setting error with context information. | |
| #define | EDHOC_CHECK(call) |
| Macro for checking and propagating errors. | |
Enumerations | |
| enum | edhoc_error_t { } |
| Unified error type for EDHOC operations. More... | |
Functions | |
| const char * | edhoc_error_string (edhoc_error_t error) |
| Get a human-readable error message for an error code. | |
| edhoc_error_t | edhoc_set_error_context (edhoc_error_t code, const char *file, int line, const char *function, const char *message) |
| Set error context for debugging (internal use). | |
| const edhoc_error_context_t * | edhoc_get_last_error_context (void) |
| Get the last error context (for debugging). | |
Error handling module header for EDHOC.
This header defines a unified error handling system that provides consistent error reporting across all EDHOC operations.
Definition in file edhoc-error.h.
| #define EDHOC_CHECK | ( | call | ) |
Macro for checking and propagating errors.
Usage: EDHOC_CHECK(some_function(params));
Definition at line 193 of file edhoc-error.h.
| #define EDHOC_ERROR | ( | code, | |
| msg ) |
Macro for setting error with context information.
Usage: return EDHOC_ERROR(EDHOC_ERR_MEMORY_ALLOCATION, "Failed to allocate key storage");
Definition at line 185 of file edhoc-error.h.
| #define EDHOC_FAILED | ( | result | ) |
Check if an operation failed.
| result | The result to check |
Definition at line 138 of file edhoc-error.h.
Referenced by edhoc_get_key_id_cred_x().
| #define EDHOC_SUCCESS_CHECK | ( | result | ) |
Check if an operation was successful.
| result | The result to check |
Definition at line 131 of file edhoc-error.h.
| enum edhoc_error_t |
Unified error type for EDHOC operations.
This enum defines all possible error conditions that can occur in EDHOC operations. Error codes are categorized by type and use negative values to distinguish them from success (0) and positive return values (e.g., sizes, counts).
Convention:
Definition at line 60 of file edhoc-error.h.
| const char * edhoc_error_string | ( | edhoc_error_t | error | ) |
Get a human-readable error message for an error code.
| error | The error code |
Definition at line 44 of file edhoc-error.c.
References EDHOC_ERR_ALREADY_INITIALIZED, EDHOC_ERR_BUFFER_OVERFLOW, EDHOC_ERR_BUFFER_TOO_SMALL, EDHOC_ERR_CBOR_DECODING, EDHOC_ERR_CBOR_ENCODING, EDHOC_ERR_CBOR_INVALID_TYPE, EDHOC_ERR_CBOR_MALFORMED, EDHOC_ERR_CID_INVALID, EDHOC_ERR_COAP_ERROR, EDHOC_ERR_CONTEXT_NOT_INITIALIZED, EDHOC_ERR_CORRELATION, EDHOC_ERR_CREDENTIAL_INVALID, EDHOC_ERR_CREDENTIAL_NOT_FOUND, EDHOC_ERR_CRITICAL_EAD_UNSUPPORTED, EDHOC_ERR_CRYPTO_AUTHENTICATION, EDHOC_ERR_CRYPTO_DECRYPT, EDHOC_ERR_CRYPTO_ENCRYPT, EDHOC_ERR_CRYPTO_HASH, EDHOC_ERR_CRYPTO_INVALID_KEY, EDHOC_ERR_CRYPTO_KDF, EDHOC_ERR_CRYPTO_KEYGEN, EDHOC_ERR_CRYPTO_SIGN, EDHOC_ERR_CRYPTO_VERIFY, EDHOC_ERR_DUPLICATE_KEY, EDHOC_ERR_ID_CRED_MALFORMED, EDHOC_ERR_INTERNAL_ERROR, EDHOC_ERR_INVALID_LENGTH, EDHOC_ERR_INVALID_PARAMETER, EDHOC_ERR_INVALID_STATE, EDHOC_ERR_KEY_NOT_FOUND, EDHOC_ERR_KEY_STORAGE_FULL, EDHOC_ERR_MEMORY_ALLOCATION, EDHOC_ERR_MESSAGE_TOO_LARGE, EDHOC_ERR_METHOD_NOT_SUPPORTED, EDHOC_ERR_MSG_MALFORMED, EDHOC_ERR_NETWORK_CONNECTION, EDHOC_ERR_NETWORK_TIMEOUT, EDHOC_ERR_NOT_ALLOWED_IDENTITY, EDHOC_ERR_NOT_IMPLEMENTED, EDHOC_ERR_NULL_POINTER, EDHOC_ERR_SEQUENCE_ERROR, EDHOC_ERR_STORAGE_INIT_FAILED, EDHOC_ERR_SUITE_NOT_SUPPORTED, EDHOC_ERR_UNKNOWN, and EDHOC_ERR_WRONG_CID.
Referenced by edhoc_setup_key_pair().
| const edhoc_error_context_t * edhoc_get_last_error_context | ( | void | ) |
Get the last error context (for debugging).
Definition at line 176 of file edhoc-error.c.
| edhoc_error_t edhoc_set_error_context | ( | edhoc_error_t | code, |
| const char * | file, | ||
| int | line, | ||
| const char * | function, | ||
| const char * | message ) |
Set error context for debugging (internal use).
| code | Error code |
| file | Source file name |
| line | Line number |
| function | Function name |
| message | Additional message |
Definition at line 162 of file edhoc-error.c.