Lines Matching refs:cb

14  * @defgroup cb Callbacks/Customization
20 * struct nl_cb *cb = nl_cb_alloc(NL_CB_VERBOSE);
23 * nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, my_func, NULL);
28 * nl_cb_err(cb, NL_CB_VERBOSE, NULL, file);
208 struct nl_cb *cb;
213 cb = calloc(1, sizeof(*cb));
214 if (!cb)
217 cb->cb_refcnt = 1;
220 nl_cb_set(cb, i, kind, NULL, NULL);
222 nl_cb_err(cb, kind, NULL, NULL);
224 return cb;
235 struct nl_cb *cb;
237 cb = nl_cb_alloc(NL_CB_DEFAULT);
238 if (!cb)
241 memcpy(cb, orig, sizeof(*orig));
242 cb->cb_refcnt = 1;
244 return cb;
247 struct nl_cb *nl_cb_get(struct nl_cb *cb)
249 cb->cb_refcnt++;
251 return cb;
254 void nl_cb_put(struct nl_cb *cb)
256 if (!cb)
259 cb->cb_refcnt--;
261 if (cb->cb_refcnt < 0)
264 if (cb->cb_refcnt <= 0)
265 free(cb);
277 * @arg cb callback set
285 int nl_cb_set(struct nl_cb *cb, enum nl_cb_type type, enum nl_cb_kind kind,
295 cb->cb_set[type] = func;
296 cb->cb_args[type] = arg;
298 cb->cb_set[type] = cb_def[type][kind];
299 cb->cb_args[type] = arg;
307 * @arg cb callback set
314 int nl_cb_set_all(struct nl_cb *cb, enum nl_cb_kind kind,
320 err = nl_cb_set(cb, i, kind, func, arg);
330 * @arg cb callback set
335 int nl_cb_err(struct nl_cb *cb, enum nl_cb_kind kind,
342 cb->cb_err = func;
343 cb->cb_err_arg = arg;
345 cb->cb_err = cb_err_def[kind];
346 cb->cb_err_arg = arg;
361 * @arg cb callback set
364 void nl_cb_overwrite_recvmsgs(struct nl_cb *cb,
367 cb->cb_recvmsgs_ow = func;
372 * @arg cb callback set
375 void nl_cb_overwrite_recv(struct nl_cb *cb,
379 cb->cb_recv_ow = func;
384 * @arg cb callback set
387 void nl_cb_overwrite_send(struct nl_cb *cb,
390 cb->cb_send_ow = func;