various fixes; add quicly_open_stream, quicly_send QUICLY_ERROR_FREE_CONNECTION and ptls_iovec_init

This commit is contained in:
Christian Ulrich 2020-11-07 11:05:57 +01:00
parent bff7556147
commit cc0077c0b6
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
4 changed files with 44 additions and 18 deletions

View File

@ -85,7 +85,7 @@ type
version*: uint16
ptls_iovec_t* {.bycopy.} = object
base*: uint8
base*: ptr uint8
len*: csize_t
ptls_on_client_hello_parameters_t* {.bycopy.} = object
@ -276,5 +276,7 @@ type
var ptls_get_time* {.importc.}: ptls_get_time_t
proc ptls_iovec_init*(p: pointer, len: csize_t): ptls_iovec_t {.cdecl, importc.}
proc ptls_load_certificates*(ctx: ptr ptls_context_t, cert_pem_file: cstring):
cint {.cdecl, importc.}

View File

@ -9,6 +9,8 @@ from sendstate import
quicly_sendstate_t,
quicly_sendstate_is_open
const QUICLY_ERROR_FREE_CONNECTION* = 0xff03
type
quicly_stream_id_t* {.bycopy.} = int64

View File

@ -1,7 +1,14 @@
from cc import quicly_cc_t
from cid import quicly_cid_t, quicly_cid_encryptor_t, quicly_cid_plaintext_t
from loss import quicly_loss_conf_t
from nativesockets import SockAddr, Sockaddr_in, Sockaddr_in6, SockLen
from posix import IOVec
from nativesockets import
SockAddr,
Sockaddr_storage,
Sockaddr_in,
Sockaddr_in6,
SockLen
from constants import
quicly_conn_t,
@ -19,14 +26,15 @@ from ../picotls/picotls import
ptls_iovec_t
export
quicly_conn_t,
quicly_stream_t,
quicly_stream_id_t
type
quicly_address_t* {.bycopy.} = object
sa: SockAddr
sin: Sockaddr_in
sin6: Sockaddr_in6
sa*: SockAddr
sin*: Sockaddr_in
sin6*: Sockaddr_in6
Retry* {.bycopy.} = object
original_dcid*: quicly_cid_t
@ -190,40 +198,54 @@ proc quicly_free*(conn: ptr quicly_conn_t): cint {.cdecl, importc.}
proc quicly_decode_packet*(ctx: ptr quicly_context_t,
packet: ptr quicly_decoded_packet_t,
datagram: ptr uint8, datagram_size: csize_t,
off: csize_t): csize_t
off: ptr csize_t): csize_t
{.cdecl, importc.}
proc quicly_is_destination*(conn: ptr quicly_conn_t, dest_addr: ptr SockAddr,
src_addr: ptr SockAddr,
proc quicly_is_destination*(conn: ptr quicly_conn_t,
dest_addr: ptr SockAddr | ptr Sockaddr_storage,
src_addr: ptr SockAddr | ptr Sockaddr_storage,
decoded: ptr quicly_decoded_packet_t): cint
{.cdecl, importc.}
proc quicly_receive*(conn: ptr quicly_conn_t, dest_addr: ptr SockAddr,
src_addr: ptr SockAddr,
proc quicly_receive*(conn: ptr quicly_conn_t,
dest_addr: ptr SockAddr | ptr Sockaddr_storage,
src_addr: ptr SockAddr | ptr Sockaddr_storage,
packet: ptr quicly_decoded_packet_t): cint
{.cdecl, importc.}
proc quicly_send*(conn: ptr quicly_conn_t, dest: ptr quicly_address_t,
src: ptr quicly_address_t, datagrams: ptr IOVec,
num_diagrams: ptr csize_t, buf: pointer, bufsize: csize_t):
cint {.cdecl, importc.}
proc quicly_accept*(conn: ptr ptr quicly_conn_t, ctx: ptr quicly_context_t,
dest_addr: ptr SockAddr, src_addr: ptr SockAddr,
dest_addr: ptr SockAddr | ptr Sockaddr_storage,
src_addr: ptr SockAddr | ptr Sockaddr_storage,
packet: ptr quicly_decoded_packet_t,
address_token: ptr quicly_address_token_plaintext_t,
new_cid: ptr quicly_cid_plaintext_t,
handshake_properties: ptr ptls_handshake_properties_t): cint
{.cdecl, importc.}
proc quicly_connect*(conn: ptr ptr quicly_conn_t, server_name: cstring,
dest_addr: ptr SockAddr, src_addr: ptr SockAddr,
proc quicly_connect*(conn: ptr ptr quicly_conn_t, ctx: ptr quicly_context_t,
server_name: cstring,
dest_addr: ptr SockAddr | ptr Sockaddr_storage,
src_addr: ptr SockAddr | ptr Sockaddr_storage,
new_cid: ptr quicly_cid_plaintext_t,
address_token: ptr quicly_address_token_plaintext_t,
address_token: ptls_iovec_t,
handshake_properties: ptr ptls_handshake_properties_t,
resumed_transport_params: ptr quicly_transport_parameters_t):
cint {.cdecl, importc.}
proc quicly_open_stream*(conn: ptr quicly_conn_t,
stream: ptr ptr quicly_stream_t, unidirectional: cint):
cint {.cdecl, importc.}
proc quicly_amend_ptls_context*(ptls: ptr ptls_context_t)
{.cdecl, importc.}
proc quicly_get_socklen*(sa: ptr SockAddr): SockLen
proc quicly_get_socklen*(sa: ptr SockAddr | ptr Sockaddr_storage): SockLen
{.cdecl, importc.}
proc quicly_get_fist_timeout*(conn: ptr quicly_conn_t): int64
proc quicly_get_first_timeout*(conn: ptr quicly_conn_t): int64
{.cdecl, importc.}

View File

@ -52,7 +52,7 @@ proc quicly_streambuf_ingress_receive*(stream: ptr quicly_stream_t,
{.cdecl, importc.}
proc quicly_streambuf_ingress_get*(stream: ptr quicly_stream_t): ptls_iovec_t
{.cdecl, importc.}
{.cdecl, importc, header: "quicly/streambuf.h".}
proc quicly_streambuf_ingress_shift*(stream: ptr quicly_stream_t,
delta: csize_t)