API参考
载入中...
搜索中...
未找到
hitls_sni.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_SNI_H
23#define HITLS_SNI_H
24
25#include <stdint.h>
26#include "hitls_type.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
38typedef enum {
39 HITLS_SNI_HOSTNAME_TYPE,
40 HITLS_SNI_BUTT = 255 /* Maximum enumerated value */
41} SNI_Type;
42
43#define HITLS_ACCEPT_SNI_ERR_OK 0 /* Accepts the request and continues handshake. */
44#define HITLS_ACCEPT_SNI_ERR_ALERT_FATAL 2 /* Do not accept the request and aborts the handshake. */
45#define HITLS_ACCEPT_SNI_ERR_NOACK 3 /* Do not accept the request but continues the handshake. */
46
55const char *HITLS_GetServerName(const HITLS_Ctx *ctx, const int type);
56
65
76int32_t HITLS_CFG_SetServerName(HITLS_Config *config, uint8_t *serverName, uint32_t serverNameStrlen);
77
88int32_t HITLS_CFG_GetServerName(HITLS_Config *config, uint8_t **serverName, uint32_t *serverNameStrlen);
89
102typedef int32_t (*HITLS_SniDealCb)(HITLS_Ctx *ctx, int *alert, void *arg);
103
114
124int32_t HITLS_CFG_SetServerNameArg(HITLS_Config *config, void *arg);
125
136
146int32_t HITLS_CFG_GetServerNameArg(HITLS_Config *config, void **arg);
147
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif
int32_t HITLS_CFG_SetServerNameCb(HITLS_Config *config, HITLS_SniDealCb callback)
Set the server_name callback function on the server, which is used for SNI negotiation,...
int32_t HITLS_CFG_GetServerNameArg(HITLS_Config *config, void **arg)
Obtain the server_name required during SNI negotiation on the server, related Parameter arg.
int32_t HITLS_CFG_SetServerNameArg(HITLS_Config *config, void *arg)
Set the server_name parameters required during SNI negotiation on the server.
int32_t HITLS_GetServernameType(const HITLS_Ctx *ctx)
Obtain the server_name type before, during, or after the handshake on the client or server.
int32_t HITLS_CFG_GetServerName(HITLS_Config *config, uint8_t **serverName, uint32_t *serverNameStrlen)
Obtain the value of server_name configured on the client.
int32_t(* HITLS_SniDealCb)(HITLS_Ctx *ctx, int *alert, void *arg)
Set the extension prototype for the server to process Client Hello server_name.
定义 hitls_sni.h:102
HITLS_Config * HITLS_SetNewConfig(HITLS_Ctx *ctx, HITLS_Config *newConfig)
Set a new configuration for an existing TLS handle. Currently this parameter is used only in SNI call...
SNI_Type
Enumerated type for Server Name Indication (SNI) types.
定义 hitls_sni.h:38
int32_t HITLS_CFG_SetServerName(HITLS_Config *config, uint8_t *serverName, uint32_t serverNameStrlen)
Set server_name.
int32_t HITLS_CFG_GetServerNameCb(HITLS_Config *config, HITLS_SniDealCb *callback)
Obtain the server_name callback settings on the server.
const char * HITLS_GetServerName(const HITLS_Ctx *ctx, const int type)
Obtain the value of server_name before, during, or after the handshake on the client or server....
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41