quicp2p/quicly/streambuf.nim

60 lines
2.3 KiB
Nim

from ../picotls/picotls import ptls_buffer_t, ptls_iovec_t
from constants import quicly_stream_t
type
quicly_streambuf_sendvec_callbacks_t* {.bycopy.} = object
flatten_vec*: proc(vec: ptr quicly_sendbuf_vec_t, dst: pointer, off: csize_t,
len: csize_t): cint {.cdecl.}
discard_vec*: proc(vec: ptr quicly_sendbuf_vec_t) {.cdecl.}
quicly_sendbuf_vec_t* {.bycopy.} = object
cb*: ptr quicly_streambuf_sendvec_callbacks_t
`len`*: csize_t
cbdata*: pointer
VecList* {.bycopy.} = object
entries*: ptr quicly_sendbuf_vec_t
size*: csize_t
capacity*: csize_t
quicly_sendbuf_t* {.bycopy.} = object
vecs*: VecList
off_in_first_vec*: csize_t
bytes_written*: uint64
quicly_streambuf_t* {.bycopy.} = object
egress*: quicly_sendbuf_t
ingress: ptls_buffer_t
proc quicly_streambuf_create*(stream: ptr quicly_stream_t, sz: csize_t): cint
{.cdecl, importc.}
proc quicly_streambuf_destroy*(stream: ptr quicly_stream_t, err: cint)
{.cdecl, importc.}
proc quicly_streambuf_egress_shutdown*(stream: ptr quicly_stream_t): cint
{.cdecl, importc.}
proc quicly_streambuf_egress_write*(stream: ptr quicly_stream_t, src: pointer,
len: csize_t): cint
{.cdecl, importc.}
proc quicly_streambuf_egress_emit*(stream: ptr quicly_stream_t, off: csize_t,
dst: pointer, len: csize_t, wrote_all: cint)
{.cdecl, importc.}
proc quicly_streambuf_egress_shift*(stream: ptr quicly_stream_t, delta: csize_t)
{.cdecl, importc.}
proc quicly_streambuf_ingress_receive*(stream: ptr quicly_stream_t,
off: csize_t, src: pointer,
len: csize_t): cint
{.cdecl, importc.}
proc quicly_streambuf_ingress_get*(stream: ptr quicly_stream_t): ptls_iovec_t
{.cdecl, importc.}
proc quicly_streambuf_ingress_shift*(stream: ptr quicly_stream_t,
delta: csize_t)
{.cdecl, importc.}