wimax-tools 1.4.4
Data Fields

wimaxll_cb_ctx Struct Reference

General structure for storing callback context. More...

#include <internal.h>

Data Fields

struct wimaxll_handlewmx
ssize_t result
unsigned msg_done:1

Detailed Description

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
 }
Parameters:
wmxWiMAX handle this context refers to (for usage by the callback).
resultResult 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.

Field Documentation