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