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