diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-21 13:33:50 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-21 13:33:50 +0300 |
commit | 351c5188013fff041c7217aed64478cfc7643480 (patch) | |
tree | c918b5093ac45394439f3dff30da37b809173603 /include/aes/error.h | |
parent | cmake: install libraries & their headers (diff) | |
download | aes-tools-351c5188013fff041c7217aed64478cfc7643480.tar.gz aes-tools-351c5188013fff041c7217aed64478cfc7643480.zip |
restructure the project
Diffstat (limited to 'include/aes/error.h')
-rw-r--r-- | include/aes/error.h | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/include/aes/error.h b/include/aes/error.h deleted file mode 100644 index e094f8a..0000000 --- a/include/aes/error.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com> -// This file is part of the "AES tools" project. -// For details, see https://github.com/egor-tensin/aes-tools. -// Distributed under the MIT License. - -#pragma once - -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef enum -{ - AES_SUCCESS, - AES_NULL_ARGUMENT_ERROR, - AES_PARSE_ERROR, - AES_INVALID_PKCS7_PADDING_ERROR, - AES_NOT_IMPLEMENTED_ERROR, - AES_MISSING_PADDING_ERROR, - AES_MEMORY_ALLOCATION_ERROR, -} -AES_StatusCode; - -static __inline int aes_is_error(AES_StatusCode ec) -{ - return ec != AES_SUCCESS; -} - -const char* aes_strerror(AES_StatusCode ec); - -#define AES_MAX_CALL_STACK_LENGTH 32 - -typedef struct -{ - AES_StatusCode ec; ///< Error code - - union - { - struct { char param_name[32]; } null_arg; - struct - { - char src[128]; - char what[32]; - } - parse_error; - struct { char what[128]; } not_implemented; - } - params; - - void* call_stack[AES_MAX_CALL_STACK_LENGTH]; - size_t call_stack_len; -} -AES_ErrorDetails; - -static __inline AES_StatusCode aes_get_error_code( - const AES_ErrorDetails* err_details) -{ - return err_details->ec; -} - -size_t aes_format_error( - const AES_ErrorDetails* err_details, - char* dest, - size_t dest_size); - -AES_StatusCode aes_success( - AES_ErrorDetails* err_details); - -AES_StatusCode aes_error_null_argument( - AES_ErrorDetails* err_details, - const char* param_name); - -AES_StatusCode aes_error_parse( - AES_ErrorDetails* err_details, - const char* src, - const char* what); - -AES_StatusCode aes_error_invalid_pkcs7_padding( - AES_ErrorDetails* err_details); - -AES_StatusCode aes_error_not_implemented( - AES_ErrorDetails* err_details, - const char* what); - -AES_StatusCode aes_error_missing_padding( - AES_ErrorDetails* err_details); - -AES_StatusCode aes_error_memory_allocation( - AES_ErrorDetails* err_details); - -#ifdef __cplusplus -} -#endif |