openHiTLS API openHiTLS 0.1.0-Alpha1
bsl_err.h
浏览该文件的文档.
1/*---------------------------------------------------------------------------------------------
2 * This file is part of the openHiTLS project.
3 * Copyright © 2023 Huawei Technologies Co.,Ltd. All rights reserved.
4 * Licensed under the openHiTLS Software license agreement 1.0. See LICENSE in the project root
5 * for license information.
6 *---------------------------------------------------------------------------------------------
7 */
8
20#ifndef BSL_ERR_H
21#define BSL_ERR_H
22
23#include <stdint.h>
24#include <stdbool.h>
25#include "bsl_errno.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
37#define BSL_ERR_NEW_MODULE 0x80
38
50int32_t BSL_ERR_Init(void);
51
60void BSL_ERR_DeInit(void);
61
72void BSL_ERR_RemoveErrorStack(bool isRemoveAll);
73
87
103int32_t BSL_ERR_GetLastErrorFileLine(const char **file, uint32_t *lineNo);
104
118int32_t BSL_ERR_PeekLastErrorFileLine(const char **file, uint32_t *lineNo);
119
132int32_t BSL_ERR_GetError(void);
133
149int32_t BSL_ERR_GetErrorFileLine(const char **file, uint32_t *lineNo);
150
164int32_t BSL_ERR_PeekErrorFileLine(const char **file, uint32_t *lineNo);
165
176
181typedef struct {
182 int32_t error;
183 const char *string;
185
200int32_t BSL_ERR_AddErrStringBatch(const BSL_ERR_Desc *descList, uint32_t num);
201
213
224const char *BSL_ERR_GetString(int32_t error);
225
238int32_t BSL_ERR_SetMark(void);
239
253int32_t BSL_ERR_PopToMark(void);
254
267
268#ifdef __cplusplus
269}
270#endif
271
272#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_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.
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_SetMark(void)
Set the pop-up flag at the level of the current error stack.
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_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.
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.
int32_t error
Definition bsl_err.h:182
const char * string
Definition bsl_err.h:183
Add error description.
Definition bsl_err.h:181