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