A callback for rustls_connection_read_tls.
An implementation of this callback should attempt to read up to n bytes from the
network, storing them in buf
. If any bytes were stored, the implementation should
set out_n to the number of bytes stored and return 0. If there was an error,
the implementation should return a nonzero rustls_io_result, which will be
passed through to the caller. On POSIX systems, returning errno
is convenient.
On other systems, any appropriate error code works.
It’s best to make one read attempt to the network per call. Additional reads will
be triggered by subsequent calls to one of the _read_tls
methods.
userdata
is set to the value provided to rustls_connection_set_userdata
. In most
cases that should be a struct that contains, at a minimum, a file descriptor.
The buf and out_n pointers are borrowed and should not be retained across calls.
A callback for rustls_connection_write_tls or rustls_accepted_alert_write_tls.
An implementation of this callback should attempt to write the n
bytes in buf
to the network. If any bytes were written, the implementation should
set out_n to the number of bytes stored and return 0. If there was an error,
the implementation should return a nonzero rustls_io_result, which will be
passed through to the caller. On POSIX systems, returning errno
is convenient.
On other systems, any appropriate error code works.
It’s best to make one write attempt to the network per call. Additional writes will
be triggered by subsequent calls to rustls_connection_write_tls.
userdata
is set to the value provided to rustls_connection_set_userdata
. In most
cases that should be a struct that contains, at a minimum, a file descriptor.
The buf and out_n pointers are borrowed and should not be retained across calls.
A callback for rustls_connection_write_tls_vectored.
An implementation of this callback should attempt to write the bytes in
the given count
iovecs to the network. If any bytes were written,
the implementation should set out_n to the number of bytes written and return 0.
If there was an error, the implementation should return a nonzero rustls_io_result,
which will be passed through to the caller. On POSIX systems, returning errno
is convenient.
On other systems, any appropriate error code works.
It’s best to make one write attempt to the network per call. Additional write will
be triggered by subsequent calls to one of the _write_tls
methods.
userdata
is set to the value provided to rustls_*_session_set_userdata
. In most
cases that should be a struct that contains, at a minimum, a file descriptor.
The buf and out_n pointers are borrowed and should not be retained across calls.