Ulfius
HTTP Framework for REST Applications in C
Response streaming

Functions

int ulfius_set_stream_response (struct _u_response *response, const unsigned int status, ssize_t(*stream_callback)(void *stream_user_data, uint64_t offset, char *out_buf, size_t max), void(*stream_callback_free)(void *stream_user_data), uint64_t stream_size, size_t stream_block_size, void *stream_user_data)
 

Detailed Description

Response streaming function

Function Documentation

◆ ulfius_set_stream_response()

int ulfius_set_stream_response ( struct _u_response * response,
const unsigned int status,
ssize_t(* stream_callback )(void *stream_user_data, uint64_t offset, char *out_buf, size_t max),
void(* stream_callback_free )(void *stream_user_data),
uint64_t stream_size,
size_t stream_block_size,
void * stream_user_data )

ulfius_set_stream_response Set an stream response with a status

Parameters
responsethe response to be updated
statusthe http status code to set to the response
stream_callbacka pointer to a function that will handle the response stream
stream_callback_freea pointer to a function that will free its allocated resources during stream_callback
stream_sizesize of the streamed data (U_STREAM_SIZE_UNKNOWN if unknown)
stream_block_sizepreferred size of each stream chunk, may be overwritten by the system if necessary
stream_user_dataa user-defined pointer that will be available in stream_callback and stream_callback_free
Returns
U_OK on success