-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcgo_binding.h
More file actions
54 lines (45 loc) · 1.35 KB
/
cgo_binding.h
File metadata and controls
54 lines (45 loc) · 1.35 KB
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
#ifndef sslconn_cgo_binding_h
#define sslconn_cgo_binding_h
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <errno.h>
#include <stdbool.h>
#include <openssl/ssl.h>
typedef struct {
SSL *ssl;
SSL_CTX *ctx;
bool is_server;
} SSLConn;
typedef struct {
long options;
int verify_mode;
EVP_PKEY *private_key;
X509 *cert;
char *cipher_list;
long sess_cache_size;
char *session_id_context;
bool is_server;
void *ptr;
} SSLConnConfig;
typedef struct {
long code;
char string[256];
} SSLConnError;
extern const int SSLConn_EIO;
extern const int SSLConn_EAGAIN;
extern const int SSLConn_SSL_ERROR;
extern const int SSLConn_WANT_READ;
extern const int SSLConn_WANT_WRITE;
extern const int SSLConn_ZERO_RETURN;
extern const int SSLConn_SYSCALL;
extern void SSLConn_init();
extern SSLConn *SSLConn_new(SSLConnConfig *config, SSLConnError *err);
extern int SSLConn_read(SSLConn *conn, void *buf, int num,
SSLConnError *err);
extern int SSLConn_write(SSLConn *conn, const void *buf, int num,
SSLConnError *err);
extern void SSLConn_free(SSLConn *conn);
extern int SSLConn_do_handshake(SSLConn *conn, SSLConnError *err);
extern int SSLConn_shutdown(SSLConn *conn, SSLConnError *err);
extern EVP_PKEY *SSLConn_EVP_PKEY_new(void *buf, int len, SSLConnError *err);
extern X509 *SSLConn_X509_new(void *buf, int len, SSLConnError *err);
#endif