wimax-tools 1.4.4
|
General structure for storing callback context. More...
#include <internal.h>
Data Fields | |
struct wimaxll_handle * | wmx |
ssize_t | result |
unsigned | msg_done:1 |
General structure for storing callback context.
Callbacks set by the user receive a user-set pointer to a context structure. The user can wrap this struct in a bigger context struct and use wimaxll_container_of() during the callback to obtain its pointer.
Usage:
... struct wimaxll_handle *wmx; ... struct my_context { struct wimaxll_cb_ctx ctx; <my data> } my_ctx = { .ctx = WIMAXLL_CB_CTX_INIT(wmx), <my data initialization> }; ... wimaxll_set_cb_SOMECALLBACK(wmx, my_callback, &my_ctx.ctx); ... result = wimaxll_pipe_read(wmx); ... // When my_callback() is called my_callback(wmx, ctx, ...) { struct my_context *my_ctx = wimaxll_container_of( ctx, struct my_callback, ctx); ... // do stuff with my_ctx }
wmx | WiMAX handle this context refers to (for usage by the callback). |
result | Result of the handling of the message. For usage by the callback. Should not be set to -EINPROGRESS, as this will be interpreted by the message handler as no processing was done on the message. |
unsigned wimaxll_cb_ctx::msg_done |
Referenced by wimaxll_gnl_ack_cb(), wimaxll_gnl_error_cb(), and wimaxll_wait_for_ack().
ssize_t wimaxll_cb_ctx::result |
Referenced by main(), wimaxll_cb_ctx_init(), wimaxll_cb_maybe_set_result(), wimaxll_recv(), and wimaxll_wait_for_ack().
struct wimaxll_handle* wimaxll_cb_ctx::wmx |
Referenced by wimaxll_cb_ctx_init(), wimaxll_gnl_error_cb(), and wimaxll_wait_for_ack().