|
nmsg
1.0.0
|
Structure for passing information about a close event between the nmsg_io processing loop and the original caller. More...
Data Fields | |
| union { | |
| nmsg_input_t * input | |
| pointer to input stream | |
| nmsg_output_t * output | |
| pointer to output stream | |
| }; | |
| union { | |
| nmsg_input_type input_type | |
| type of 'input' field | |
| nmsg_output_type output_type | |
| type of 'output' field | |
| }; | |
| nmsg_io_t | io |
| this nmsg_io loop | |
| nmsg_io_io_type | io_type |
| whether 'input' or 'output' | |
| nmsg_io_close_type | close_type |
| why the stream was closed | |
| void * | user |
| caller-provided user pointer | |
Structure for passing information about a close event between the nmsg_io processing loop and the original caller.
In order to receive these close events, the caller must specify a callback function with nmsg_io_set_close_fp().
nmsg_io_close_type_eof is sent for both inputs and outputs. The callback function is responsible for closing the input or output.
nmsg_io_close_type_count is sent for outputs if nmsg_io_set_count() has been called and a non-NULL user parameter was passed to nmsg_io_add_input() or nmsg_io_add_output().
nmsg_io_close_type_interval is sent for inputs if nmsg_io_set_interval() has been called and a non-NULL user parameter was passed to nmsg_io_add_input() or nmsg_io_add_output().
The 'user' field of this struct is associated with the input or output object and is determined by the caller's 'user' parameter to the nmsg_io_add_input() or nmsg_io_add_output() functions.
If an output reaches a count or interval limit, the callback function is responsible for closing and optionally re-opening the output. The callee may also ignore this close event.
nmsg_io supports the reopening of outputs after a certain number of payloads have been processed or a certain time interval has elapsed. The caller must call nmsg_io_add_input() or nmsg_io_add_output() with a non-NULL user parameter, set the close event callback function with nmsg_io_set_close_fp(), and set a stop condition with nmsg_io_set_count() or nmsg_io_set_interval(). When the close event function is then called with nmsg_io_close_type_count or nmsg_io_close_type_interval, it should reopen the output and pass it back to nmsg_io via the 'output' pointer in the close event structure.