API参考
载入中...
搜索中...
未找到
hitls_debug.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
21
22#ifndef HITLS_DEBUG_H
23#define HITLS_DEBUG_H
24
25#include <stdint.h>
26#include "hitls_type.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#define INDICATE_VALUE_SUCCESS 1u
33
34#define INDICATE_EVENT_LOOP 0x01 // 0000 0000 0000 0001, Handshake state transition
35#define INDICATE_EVENT_EXIT 0x02 // 0000 0000 0000 0010, Handshake status exit
36#define INDICATE_EVENT_READ 0x04 // 0000 0000 0000 0100, Read event
37#define INDICATE_EVENT_WRITE 0x08 // 0000 0000 0000 1000, Write event
38#define INDICATE_EVENT_HANDSHAKE_START 0x10 // 0000 0000 0001 0000, Handshake Start
39#define INDICATE_EVENT_HANDSHAKE_DONE 0x20 // 0000 0000 0010 0000, Handshake completed
40#define INDICATE_EVENT_STATE_CONNECT 0x1000 // 0001 0000 0000 0000, Local client
41#define INDICATE_EVENT_STATE_ACCEPT 0x2000 // 0010 0000 0000 0000, Local server
42#define INDICATE_EVENT_ALERT 0x4000 // 0100 0000 0000 0000, Warning Time
43
44#define INDICATE_EVENT_READ_ALERT (INDICATE_EVENT_ALERT | INDICATE_EVENT_READ)
45#define INDICATE_EVENT_WRITE_ALERT (INDICATE_EVENT_ALERT | INDICATE_EVENT_WRITE)
46#define INDICATE_EVENT_STATE_ACCEPT_LOOP (INDICATE_EVENT_STATE_ACCEPT | INDICATE_EVENT_LOOP)
47#define INDICATE_EVENT_STATE_ACCEPT_EXIT (INDICATE_EVENT_STATE_ACCEPT | INDICATE_EVENT_EXIT)
48#define INDICATE_EVENT_STATE_CONNECT_LOOP (INDICATE_EVENT_STATE_CONNECT | INDICATE_EVENT_LOOP)
49#define INDICATE_EVENT_STATE_CONNECT_EXIT (INDICATE_EVENT_STATE_CONNECT | INDICATE_EVENT_EXIT)
50
60typedef void (*HITLS_InfoCb)(const HITLS_Ctx *ctx, int32_t eventType, int32_t value);
61
71int32_t HITLS_SetInfoCb(HITLS_Ctx *ctx, HITLS_InfoCb callback);
72
81HITLS_InfoCb HITLS_GetInfoCb(const HITLS_Ctx *ctx);
82
92int32_t HITLS_CFG_SetInfoCb(HITLS_Config *config, HITLS_InfoCb callback);
93
102HITLS_InfoCb HITLS_CFG_GetInfoCb(const HITLS_Config *config);
103
117typedef void (*HITLS_MsgCb) (int32_t writePoint, int32_t tlsVersion, int32_t contentType, const void *msg,
118 uint32_t msgLen, HITLS_Ctx *ctx, void *arg);
119
129int32_t HITLS_SetMsgCb(HITLS_Ctx *ctx, HITLS_MsgCb callback);
130
140int32_t HITLS_CFG_SetMsgCb(HITLS_Config *config, HITLS_MsgCb callback);
141
150int32_t HITLS_SetMsgCbArg(HITLS_Ctx *ctx, void *arg);
151
161int32_t HITLS_CFG_SetMsgCbArg(HITLS_Config *config, void *arg);
162
163#ifdef __cplusplus
164}
165#endif
166
167#endif // HITLS_DEBUG_H
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41