/
ddsi__ssl.h
49 lines (40 loc) · 1.39 KB
/
ddsi__ssl.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
// Copyright(c) 2006 to 2020 ZettaScale Technology and others
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
// v. 1.0 which is available at
// http://www.eclipse.org/org/documents/edl-v10.php.
//
// SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#ifndef DDSI__SSL_H
#define DDSI__SSL_H
#include "dds/features.h"
#ifdef DDS_HAS_TCP_TLS
#ifdef _WIN32
/* supposedly WinSock2 must be included before openssl headers otherwise winsock will be used */
#include <WinSock2.h>
#endif
#include <openssl/ssl.h>
#if defined (__cplusplus)
extern "C" {
#endif
struct ddsi_ssl_plugins
{
bool (*init) (struct ddsi_domaingv *gv);
void (*fini) (void);
void (*ssl_free) (SSL *ssl);
void (*bio_vfree) (BIO *bio);
ssize_t (*read) (SSL *ssl, void *buf, size_t len, dds_return_t *err);
ssize_t (*write) (SSL *ssl, const void *msg, size_t len, dds_return_t *err);
SSL * (*connect) (const struct ddsi_domaingv *gv, ddsrt_socket_t sock);
BIO * (*listen) (ddsrt_socket_t sock);
SSL * (*accept) (const struct ddsi_domaingv *gv, BIO *bio, ddsrt_socket_t *sock);
};
/** @component legacy_ssl */
void ddsi_ssl_config_plugin (struct ddsi_ssl_plugins *plugin);
#if defined (__cplusplus)
}
#endif
#endif /* DDS_HAS_TCP_TLS */
#endif /* DDSI__SSL_H */