Function imageflow::imageflow_job_send_json
[−]
[src]
#[no_mangle]pub unsafe extern fn imageflow_job_send_json(context: *mut Context,
job: *mut Job,
method: *const c_char,
json_buffer: *const uint8_t,
json_buffer_size: size_t)
-> *const JsonResponse
Sends a JSON message to the imageflow_job
The recipient is provided method
, which determines which code path will be used to
process the provided JSON data and compose a response.
method
andjson_buffer
are only borrowed for the duration of the function call. You are responsible for their cleanup (if necessary - static strings are handy for things likemethod
).method
should be a UTF-8 null-terminated string.json_buffer
should be a UTF-8 encoded buffer (not null terminated) of length json_buffer_size.
The function will return NULL if a JSON response could not be allocated (or if some other
bug occurred). If a null pointer is returned, consult the standard error methods of context
for more detail.
The response can be cleaned up with imageflow_json_response_destroy
Behavior is undefined if context
is a null or invalid ptr; segfault likely.