mongoose/src/tls.h

23 lines
866 B
C
Raw Normal View History

2020-12-05 19:26:32 +08:00
#pragma once
2020-12-05 19:26:32 +08:00
#include "net.h"
#include "tls_mbed.h"
#include "tls_openssl.h"
2020-12-05 19:26:32 +08:00
struct mg_tls_opts {
2021-01-30 21:03:11 +08:00
const char *ca; // CA certificate file. For both listeners and clients
const char *crl; // Certificate Revocation List. For clients
2021-01-30 21:03:11 +08:00
const char *cert; // Certificate
const char *certkey; // Certificate key
const char *ciphers; // Cipher list
struct mg_str srvname; // If not empty, enables server name verification
struct mg_fs *fs; // FS API for reading certificate files
2020-12-05 19:26:32 +08:00
};
void mg_tls_init(struct mg_connection *, const struct mg_tls_opts *);
void mg_tls_free(struct mg_connection *);
long mg_tls_send(struct mg_connection *, const void *buf, size_t len);
long mg_tls_recv(struct mg_connection *, void *buf, size_t len);
2022-04-12 16:38:25 +08:00
size_t mg_tls_pending(struct mg_connection *);
void mg_tls_handshake(struct mg_connection *);