openHiTLS API openHiTLS 0.1.0-Alpha1
hitls_debug.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
15#ifndef HITLS_DEBUG_H
16#define HITLS_DEBUG_H
17
18#include <stdint.h>
19#include "hitls_type.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define INDICATE_VALUE_SUCCESS 1u
26
27#define INDICATE_EVENT_LOOP 0x01 // 0000 0000 0000 0001, Handshake state transition
28#define INDICATE_EVENT_EXIT 0x02 // 0000 0000 0000 0010, Handshake status exit
29#define INDICATE_EVENT_READ 0x04 // 0000 0000 0000 0100, Read event
30#define INDICATE_EVENT_WRITE 0x08 // 0000 0000 0000 1000, Write event
31#define INDICATE_EVENT_HANDSHAKE_START 0x10 // 0000 0000 0001 0000, Handshake Start
32#define INDICATE_EVENT_HANDSHAKE_DONE 0x20 // 0000 0000 0010 0000, Handshake completed
33#define INDICATE_EVENT_STATE_CONNECT 0x1000 // 0001 0000 0000 0000, Local client
34#define INDICATE_EVENT_STATE_ACCEPT 0x2000 // 0010 0000 0000 0000, Local server
35#define INDICATE_EVENT_ALERT 0x4000 // 0100 0000 0000 0000, Warning Time
36
37#define INDICATE_EVENT_READ_ALERT (INDICATE_EVENT_ALERT | INDICATE_EVENT_READ)
38#define INDICATE_EVENT_WRITE_ALERT (INDICATE_EVENT_ALERT | INDICATE_EVENT_WRITE)
39#define INDICATE_EVENT_STATE_ACCEPT_LOOP (INDICATE_EVENT_STATE_ACCEPT | INDICATE_EVENT_LOOP)
40#define INDICATE_EVENT_STATE_ACCEPT_EXIT (INDICATE_EVENT_STATE_ACCEPT | INDICATE_EVENT_EXIT)
41#define INDICATE_EVENT_STATE_CONNECT_LOOP (INDICATE_EVENT_STATE_CONNECT | INDICATE_EVENT_LOOP)
42#define INDICATE_EVENT_STATE_CONNECT_EXIT (INDICATE_EVENT_STATE_CONNECT | INDICATE_EVENT_EXIT)
43
54typedef void (*HITLS_InfoCb)(const HITLS_Ctx *ctx, int32_t eventType, int32_t value);
55
65int32_t HITLS_SetInfoCb(HITLS_Ctx *ctx, HITLS_InfoCb callback);
66
76
87
97
112typedef void (*HITLS_MsgCb) (int32_t writePoint, int32_t tlsVersion, int32_t contentType, const void *msg,
113 uint32_t msgLen, HITLS_Ctx *ctx, void *arg);
114
124int32_t HITLS_SetMsgCb(HITLS_Ctx *ctx, HITLS_MsgCb callback);
125
135int32_t HITLS_CFG_SetMsgCb(HITLS_Config *config, HITLS_MsgCb callback);
136
146int32_t HITLS_CFG_SetMsgCbArg(HITLS_Config *config, void *arg);
147
148#ifdef __cplusplus
149}
150#endif
151
152#endif // HITLS_DEBUG_H
153
void(* HITLS_InfoCb)(const HITLS_Ctx *ctx, int32_t eventType, int32_t value)
Information prompt callback prototype
Definition hitls_debug.h:54
int32_t HITLS_CFG_SetInfoCb(HITLS_Config *config, HITLS_InfoCb callback)
Set the callback function for prompting information.
HITLS_InfoCb HITLS_CFG_GetInfoCb(const HITLS_Config *config)
Callback function for obtaining information prompts
int32_t HITLS_SetMsgCb(HITLS_Ctx *ctx, HITLS_MsgCb callback)
Set the protocol message callback function, cb can be NULL.
int32_t HITLS_CFG_SetMsgCb(HITLS_Config *config, HITLS_MsgCb callback)
Set the protocol message callback function, cb can be NULL.
HITLS_InfoCb HITLS_GetInfoCb(const HITLS_Ctx *ctx)
Callback for obtaining information
int32_t HITLS_CFG_SetMsgCbArg(HITLS_Config *config, void *arg)
Set the related parameters arg required by the protocol message callback function.
void(* HITLS_MsgCb)(int32_t writePoint, int32_t tlsVersion, int32_t contentType, const void *msg, uint32_t msgLen, HITLS_Ctx *ctx, void *arg)
Callback prototype of a protocol message
Definition hitls_debug.h:112
int32_t HITLS_SetInfoCb(HITLS_Ctx *ctx, HITLS_InfoCb callback)
Set the callback for prompt information.
struct TlsCtx HITLS_Ctx
HITLS context
Definition hitls_type.h:28
struct TlsConfig HITLS_Config
config context
Definition hitls_type.h:34