blob: 9e2ec2e90f6a6bbdd5a4daaed00432db342a2b8b [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001#ifndef MBTK_SOCK_INTERNAL_INCLUDE
2#define MBTK_SOCK_INTERNAL_INCLUDE
3#include "mbtk_sock2.h"
4//#include <openssl/ssl.h>
5
6#define MBTK_HANDLE_MAX_NUM 5
7#define MBTK_SOCK_MAX_NUM 10
8
9typedef struct {
10 int fd;
11 entropy_context* entropy;
12 ctr_drbg_context* ctr_drbg;
13 ssl_context *ssl;
14 ssl_session *saved_session;
15 x509_crt *cacert;
16 x509_crt *clicert;
17 pk_context* pkey;
18} mbtk_sock_inter_info_s;
19
20typedef struct {
21 mbtk_init_info init_info;
22 int sock_num;
23 mbtk_sock_inter_info_s inter_infos[MBTK_SOCK_MAX_NUM];
24 mbtk_sock_info infos[MBTK_SOCK_MAX_NUM];
25} mbtk_sock_s;
26struct options
27{
28 const char *server_name; /* hostname of the server (client only) */
29 const char *server_addr; /* address of the server (client only) */
30 int server_port; /* port on which the ssl service runs */
31 int debug_level; /* level of debugging */
32 int nbio; /* should I/O be blocking? */
33 const char *request_page; /* page on server to request */
34 int request_size; /* pad request with header to requested size */
35 const char *ca_file; /* the file with the CA certificate(s) */
36 const char *ca_path; /* the path with the CA certificate(s) reside */
37 const char *crt_file; /* the file with the client certificate */
38 const char *key_file; /* the file with the client key */
39 const char *psk; /* the pre-shared key */
40 const char *psk_identity; /* the pre-shared key identity */
41 int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
42 int renegotiation; /* enable / disable renegotiation */
43 int allow_legacy; /* allow legacy renegotiation */
44 int renegotiate; /* attempt renegotiation? */
45 int renego_delay; /* delay before enforcing renegotiation */
46 int exchanges; /* number of data exchanges */
47 int min_version; /* minimum protocol version accepted */
48 int max_version; /* maximum protocol version accepted */
49 int auth_mode; /* verify mode for connection */
50 unsigned char mfl_code; /* code for maximum fragment length */
51 int trunc_hmac; /* negotiate truncated hmac or not */
52 int reconnect; /* attempt to resume session */
53 int reco_delay; /* delay in seconds before resuming session */
54 int tickets; /* enable / disable session tickets */
55 const char *alpn_string; /* ALPN supported protocols */
56} opt;
57
58#endif /* MBTK_SOCK_INTERNAL_INCLUDE */