openHiTLS API openHiTLS 0.1.0-Alpha1
hitls_alpn.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_ALPN_H
16#define HITLS_ALPN_H
17
18#include <stdint.h>
19#include "hitls_type.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define HITLS_ALPN_ERR_OK 0 /* Correct execution. */
26#define HITLS_ALPN_ERR_ALERT_WARNING 1 /* Execution error, sent warning alert. */
27#define HITLS_ALPN_ERR_ALERT_FATAL 2 /* Execution error, sent fatal alert. */
28#define HITLS_ALPN_ERR_NOACK 3 /* Execution exception, ignore processing. */
29
46typedef int32_t (*HITLS_AlpnSelectCb)(HITLS_Ctx *ctx, uint8_t **selectedProto, uint8_t *selectedProtoSize,
47 uint8_t *clientAlpnList, uint32_t clientAlpnListSize, void *userData);
48
60int32_t HITLS_CFG_SetAlpnProtos(HITLS_Config *config, const uint8_t *alpnProtos, uint32_t alpnProtosLen);
61
74int32_t HITLS_CFG_SetAlpnProtosSelectCb(HITLS_Config *config, HITLS_AlpnSelectCb callback, void *userData);
75
87int32_t HITLS_SetAlpnProtos(HITLS_Ctx *ctx, const uint8_t *protos, uint32_t protosLen);
88
99int32_t HITLS_GetSelectedAlpnProto(HITLS_Ctx *ctx, uint8_t **proto, uint32_t *protoLen);
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif // HITLS_ALPN_H
int32_t HITLS_GetSelectedAlpnProto(HITLS_Ctx *ctx, uint8_t **proto, uint32_t *protoLen)
Obtaining the ALPN Negotiation Result
int32_t HITLS_SetAlpnProtos(HITLS_Ctx *ctx, const uint8_t *protos, uint32_t protosLen)
Sets the client ALPN list, which is used to negotiate the application layer protocol with the server ...
int32_t(* HITLS_AlpnSelectCb)(HITLS_Ctx *ctx, uint8_t **selectedProto, uint8_t *selectedProtoSize, uint8_t *clientAlpnList, uint32_t clientAlpnListSize, void *userData)
Callback prototype for selecting the ALPN protocol on the server, which is used to select the applica...
Definition hitls_alpn.h:46
int32_t HITLS_CFG_SetAlpnProtos(HITLS_Config *config, const uint8_t *alpnProtos, uint32_t alpnProtosLen)
Sets the ALPN list on the client, which is used to negotiate the application layer protocol with the ...
int32_t HITLS_CFG_SetAlpnProtosSelectCb(HITLS_Config *config, HITLS_AlpnSelectCb callback, void *userData)
Sets the ALPN selection callback on the server.
struct TlsCtx HITLS_Ctx
HITLS context
Definition hitls_type.h:28
struct TlsConfig HITLS_Config
config context
Definition hitls_type.h:34