nghttp3_conn_writev_stream

Synopsis

#include <nghttp3/nghttp3.h>

nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn, int64_t *pstream_id, int *pfin, nghttp3_vec *vec, size_t veccnt)

nghttp3_conn_writev_stream() stores stream data to send to vec of length veccnt, and returns the number of nghttp3_vec object in which it stored data. It stores stream ID to *pstream_id. An application has to call nghttp3_conn_add_write_offset() to inform conn of the actual number of bytes that underlying QUIC stack accepted. *pfin will be nonzero if this is the last data to send. If there is no stream to write data or send fin, this function returns 0, and -1 is assigned to *pstream_id. This function may return 0, and *pstream_id is not -1, and *pfin is nonzero. It means 0 length data to *pstream_id, and it is the last data to the stream. They must be passed to QUIC stack, and they are accepted, the application has to call nghttp3_conn_add_write_offset() with 0 byte.

This function returns the number of bytes consumed, or one of the following negative error codes:

NGHTTP3_ERR_NOMEM

Out of memory.

NGHTTP3_ERR_CALLBACK_FAILURE

User callback failed.

It may return the other error codes. The negative error code means that conn encountered a connection error, and the connection must be closed. Calling nghttp3 API other than nghttp3_conn_del() causes undefined behavior.