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