mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net: ipv6 support, merge unix+ip;[pack:x] attribute (#9904)
This commit is contained in:
@@ -37,7 +37,7 @@ pub struct SSL_METHOD {
|
||||
|
||||
fn C.BIO_new_ssl_connect(ctx &C.SSL_CTX) &C.BIO
|
||||
|
||||
fn C.BIO_set_conn_hostname(b &C.BIO, name charptr) int
|
||||
fn C.BIO_set_conn_hostname(b &C.BIO, name &char) int
|
||||
|
||||
// there are actually 2 macros for BIO_get_ssl
|
||||
// fn C.BIO_get_ssl(bp &C.BIO, ssl charptr, c int)
|
||||
@@ -48,7 +48,7 @@ fn C.BIO_do_connect(b &C.BIO) int
|
||||
|
||||
fn C.BIO_do_handshake(b &C.BIO) int
|
||||
|
||||
fn C.BIO_puts(b &C.BIO, buf charptr)
|
||||
fn C.BIO_puts(b &C.BIO, buf &char)
|
||||
|
||||
fn C.BIO_read(b &C.BIO, buf voidptr, len int) int
|
||||
|
||||
@@ -60,7 +60,7 @@ fn C.SSL_CTX_set_options(ctx &C.SSL_CTX, options int)
|
||||
|
||||
fn C.SSL_CTX_set_verify_depth(s &C.SSL_CTX, depth int)
|
||||
|
||||
fn C.SSL_CTX_load_verify_locations(ctx &C.SSL_CTX, ca_file charptr, ca_path charptr) int
|
||||
fn C.SSL_CTX_load_verify_locations(ctx &C.SSL_CTX, ca_file &char, ca_path &char) int
|
||||
|
||||
fn C.SSL_CTX_free(ctx &C.SSL_CTX)
|
||||
|
||||
@@ -70,7 +70,7 @@ fn C.SSL_set_fd(ssl &C.SSL, fd int) int
|
||||
|
||||
fn C.SSL_connect(&C.SSL) int
|
||||
|
||||
fn C.SSL_set_cipher_list(ctx &SSL, str charptr) int
|
||||
fn C.SSL_set_cipher_list(ctx &SSL, str &char) int
|
||||
|
||||
fn C.SSL_get_peer_certificate(ssl &SSL) &C.X509
|
||||
|
||||
@@ -80,7 +80,7 @@ fn C.SSL_get_error(ssl &C.SSL, ret int) int
|
||||
|
||||
fn C.SSL_get_verify_result(ssl &SSL) int
|
||||
|
||||
fn C.SSL_set_tlsext_host_name(s &SSL, name charptr) int
|
||||
fn C.SSL_set_tlsext_host_name(s &SSL, name &char) int
|
||||
|
||||
fn C.SSL_shutdown(&C.SSL) int
|
||||
|
||||
|
||||
@@ -4,24 +4,29 @@ module openssl
|
||||
pub fn ssl_error(ret int, ssl voidptr) ?SSLError {
|
||||
res := C.SSL_get_error(ssl, ret)
|
||||
match SSLError(res) {
|
||||
.ssl_error_syscall { return error_with_code('unrecoverable syscall ($res)', res) }
|
||||
.ssl_error_ssl { return error_with_code('unrecoverable ssl protocol error ($res)',
|
||||
res) }
|
||||
else { return SSLError(res) }
|
||||
.ssl_error_syscall {
|
||||
return error_with_code('unrecoverable syscall ($res)', res)
|
||||
}
|
||||
.ssl_error_ssl {
|
||||
return error_with_code('unrecoverable ssl protocol error ($res)', res)
|
||||
}
|
||||
else {
|
||||
return SSLError(res)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum SSLError {
|
||||
ssl_error_none = 0 //SSL_ERROR_NONE
|
||||
ssl_error_ssl = 1 //SSL_ERROR_SSL
|
||||
ssl_error_want_read = 2 //SSL_ERROR_WANT_READ
|
||||
ssl_error_want_write = 3 //SSL_ERROR_WANT_WRITE
|
||||
ssl_error_want_x509_lookup = 4 //SSL_ERROR_WANT_X509_LOOKUP
|
||||
ssl_error_syscall = 5 //SSL_ERROR_SYSCALL
|
||||
ssl_error_zero_return = 6 //SSL_ERROR_ZERO_RETURN
|
||||
ssl_error_want_connect = 7 //SSL_ERROR_WANT_CONNECT
|
||||
ssl_error_want_accept = 8 //SSL_ERROR_WANT_ACCEPT
|
||||
ssl_error_want_async = 9 //SSL_ERROR_WANT_ASYNC
|
||||
ssl_error_want_async_job = 10 //SSL_ERROR_WANT_ASYNC_JOB
|
||||
ssl_error_want_early = 11 //SSL_ERROR_WANT_EARLY
|
||||
ssl_error_none = 0 // SSL_ERROR_NONE
|
||||
ssl_error_ssl = 1 // SSL_ERROR_SSL
|
||||
ssl_error_want_read = 2 // SSL_ERROR_WANT_READ
|
||||
ssl_error_want_write = 3 // SSL_ERROR_WANT_WRITE
|
||||
ssl_error_want_x509_lookup = 4 // SSL_ERROR_WANT_X509_LOOKUP
|
||||
ssl_error_syscall = 5 // SSL_ERROR_SYSCALL
|
||||
ssl_error_zero_return = 6 // SSL_ERROR_ZERO_RETURN
|
||||
ssl_error_want_connect = 7 // SSL_ERROR_WANT_CONNECT
|
||||
ssl_error_want_accept = 8 // SSL_ERROR_WANT_ACCEPT
|
||||
ssl_error_want_async = 9 // SSL_ERROR_WANT_ASYNC
|
||||
ssl_error_want_async_job = 10 // SSL_ERROR_WANT_ASYNC_JOB
|
||||
ssl_error_want_early = 11 // SSL_ERROR_WANT_EARLY
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user