API参考
载入中...
搜索中...
未找到
bsl_err.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
20
26
27#ifndef BSL_ERR_H
28#define BSL_ERR_H
29
30#include <stdint.h>
31#include <stdbool.h>
32#include "bsl_errno.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
44#define BSL_ERR_NEW_MODULE 0x80
45
46typedef enum {
47 BSL_ERR_LIB_CRYPTO = 1,
48 BSL_ERR_LIB_TLS = 2,
49 BSL_ERR_LIB_BSL = 3,
50 BSL_ERR_LIB_PKI = 4,
51 BSL_ERR_LIB_AUTH = 5,
52} BSL_ERR_LIB;
53
54#define BSL_ERR_GET_LIB(err) ((err) >> 24)
55
67int32_t BSL_ERR_Init(void);
68
77void BSL_ERR_DeInit(void);
78
89void BSL_ERR_RemoveErrorStack(bool isRemoveAll);
90
104
119
133int32_t BSL_ERR_PeekError(void);
134
150int32_t BSL_ERR_GetLastErrorFileLine(const char **file, uint32_t *lineNo);
151
165int32_t BSL_ERR_PeekLastErrorFileLine(const char **file, uint32_t *lineNo);
166
179int32_t BSL_ERR_GetError(void);
180
196int32_t BSL_ERR_GetErrorFileLine(const char **file, uint32_t *lineNo);
197
211int32_t BSL_ERR_PeekErrorFileLine(const char **file, uint32_t *lineNo);
212
223
228typedef struct {
229 int32_t error;
230 const char *string;
232
247int32_t BSL_ERR_AddErrStringBatch(const BSL_ERR_Desc *descList, uint32_t num);
248
260
271const char *BSL_ERR_GetString(int32_t error);
272
284int32_t BSL_ERR_GetErrAll(const char **file, uint32_t *lineNo, const char **desc);
285
298int32_t BSL_ERR_SetMark(void);
299
313int32_t BSL_ERR_PopToMark(void);
314
327
340typedef void (*BSL_ERR_OutputFunc)(uint64_t threadId, const char *file, uint32_t lineNo, int32_t errCode, bool mark);
341
349
359
360#ifdef __cplusplus
361}
362#endif
363
364#endif // BSL_ERR_H
void BSL_ERR_RemoveErrorStack(bool isRemoveAll)
Delete the error stack
void BSL_ERR_RemoveErrStringBatch(void)
Delete the error description
void BSL_ERR_DeInit(void)
Error code module deinitialization.
int32_t BSL_ERR_GetErrAll(const char **file, uint32_t *lineNo, const char **desc)
Obtain the error description string based on the error code.
int32_t BSL_ERR_GetErrorFileLine(const char **file, uint32_t *lineNo)
Obtain the error code, file name, and line number of the earliest push message in the error stack.
void BSL_ERR_OutputErrorStack(void)
Print all error information in the current error stack.
int32_t BSL_ERR_Init(void)
Initialize Error code module.
int32_t BSL_ERR_GetLastErrorFileLine(const char **file, uint32_t *lineNo)
Obtains the error code, file name, and line number of the last push message in the error stack.
int32_t BSL_ERR_PeekError(void)
Obtain the earliest push error code in the error stack.
int32_t BSL_ERR_SetMark(void)
Set the pop-up flag at the level of the current error stack.
void(* BSL_ERR_OutputFunc)(uint64_t threadId, const char *file, uint32_t lineNo, int32_t errCode, bool mark)
Err output callback function type.
定义 bsl_err.h:340
void BSL_ERR_ClearError(void)
Clear the error stack.
int32_t BSL_ERR_GetError(void)
Obtain the earliest push error code in the error stack.
int32_t BSL_ERR_PeekLastError(void)
Obtains the error code of the last push in the error stack.
int32_t BSL_ERR_PeekErrorFileLine(const char **file, uint32_t *lineNo)
Obtain the error code, file name, and line number of the earliest push message in the error stack.
void BSL_ERR_RegErrStackLog(const BSL_ERR_OutputFunc func)
Register a err output callback function with dual protection
int32_t BSL_ERR_AddErrStringBatch(const BSL_ERR_Desc *descList, uint32_t num)
Add an error description string to an error code.
const char * BSL_ERR_GetString(int32_t error)
Obtain the error description string based on the error code.
int32_t BSL_ERR_PopToMark(void)
Pop to the marked error stack level and clear the mark
int32_t BSL_ERR_ClearLastMark(void)
Clear the latest flag in the error stack.
int32_t BSL_ERR_PeekLastErrorFileLine(const char **file, uint32_t *lineNo)
Obtain the error code, file name, and line number of the last push message in the error stack.
int32_t BSL_ERR_GetLastError(void)
Obtains the error code of the last push in the error stack.
Add error description.
定义 bsl_err.h:228
int32_t error
定义 bsl_err.h:229
const char * string
定义 bsl_err.h:230