forked from cesanta/mongoose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmg_ssl_if.h
55 lines (43 loc) · 1.32 KB
/
mg_ssl_if.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/
#ifndef CS_MONGOOSE_SRC_SSL_IF_H_
#define CS_MONGOOSE_SRC_SSL_IF_H_
#if MG_ENABLE_SSL
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
struct mg_ssl_if_ctx;
struct mg_connection;
void mg_ssl_if_init();
enum mg_ssl_if_result {
MG_SSL_OK = 0,
MG_SSL_WANT_READ = -1,
MG_SSL_WANT_WRITE = -2,
MG_SSL_ERROR = -3,
};
struct mg_ssl_if_conn_params {
const char *cert;
const char *key;
const char *ca_cert;
const char *server_name;
const char *cipher_suites;
const char *psk_identity;
const char *psk_key;
};
enum mg_ssl_if_result mg_ssl_if_conn_init(
struct mg_connection *nc, const struct mg_ssl_if_conn_params *params,
const char **err_msg);
enum mg_ssl_if_result mg_ssl_if_conn_accept(struct mg_connection *nc,
struct mg_connection *lc);
void mg_ssl_if_conn_close_notify(struct mg_connection *nc);
void mg_ssl_if_conn_free(struct mg_connection *nc);
enum mg_ssl_if_result mg_ssl_if_handshake(struct mg_connection *nc);
int mg_ssl_if_read(struct mg_connection *nc, void *buf, size_t buf_size);
int mg_ssl_if_write(struct mg_connection *nc, const void *data, size_t len);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* MG_ENABLE_SSL */
#endif /* CS_MONGOOSE_SRC_SSL_IF_H_ */