-
Notifications
You must be signed in to change notification settings - Fork 202
/
pal_error.h
64 lines (57 loc) · 1.84 KB
/
pal_error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/* Copyright (C) 2014 Stony Brook University */
/*
* This file contains definitions of PAL error codes.
*/
#pragma once
#include <nodiscard.h>
#include <stddef.h>
typedef enum NODISCARD {
PAL_ERROR_SUCCESS = 0,
PAL_ERROR_NOTIMPLEMENTED,
PAL_ERROR_NOTDEFINED,
PAL_ERROR_NOTSUPPORT,
PAL_ERROR_INVAL,
PAL_ERROR_TOOLONG,
PAL_ERROR_DENIED,
PAL_ERROR_BADHANDLE,
PAL_ERROR_STREAMEXIST,
PAL_ERROR_STREAMNOTEXIST,
PAL_ERROR_STREAMISFILE,
PAL_ERROR_STREAMISDIR,
PAL_ERROR_STREAMISDEVICE,
PAL_ERROR_INTERRUPTED,
PAL_ERROR_OVERFLOW,
PAL_ERROR_BADADDR,
PAL_ERROR_NOMEM,
PAL_ERROR_INCONSIST,
PAL_ERROR_TRYAGAIN,
PAL_ERROR_NOTSERVER,
PAL_ERROR_NOTCONNECTION,
PAL_ERROR_CONNFAILED,
PAL_ERROR_ADDRNOTEXIST,
PAL_ERROR_AFNOSUPPORT,
PAL_ERROR_CONNFAILED_PIPE,
#define PAL_ERROR_NATIVE_COUNT PAL_ERROR_CONNFAILED_PIPE
#define PAL_ERROR_CRYPTO_START PAL_ERROR_CRYPTO_FEATURE_UNAVAILABLE
/* Crypto error constants and their descriptions are adapted from mbedtls. */
PAL_ERROR_CRYPTO_FEATURE_UNAVAILABLE = 1000,
PAL_ERROR_CRYPTO_INVALID_CONTEXT,
PAL_ERROR_CRYPTO_INVALID_KEY_LENGTH,
PAL_ERROR_CRYPTO_INVALID_INPUT_LENGTH,
PAL_ERROR_CRYPTO_INVALID_OUTPUT_LENGTH,
PAL_ERROR_CRYPTO_BAD_INPUT_DATA,
PAL_ERROR_CRYPTO_INVALID_PADDING,
PAL_ERROR_CRYPTO_DATA_MISALIGNED,
PAL_ERROR_CRYPTO_INVALID_FORMAT,
PAL_ERROR_CRYPTO_AUTH_FAILED,
PAL_ERROR_CRYPTO_IO_ERROR,
PAL_ERROR_CRYPTO_KEY_GEN_FAILED,
PAL_ERROR_CRYPTO_INVALID_KEY,
PAL_ERROR_CRYPTO_VERIFY_FAILED,
PAL_ERROR_CRYPTO_RNG_FAILED,
PAL_ERROR_CRYPTO_INVALID_DH_STATE,
#define PAL_ERROR_CRYPTO_END PAL_ERROR_CRYPTO_INVALID_DH_STATE
} pal_error_t;
/* err - value of error code, either positive or negative */
const char* pal_strerror(int err);