Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

struct nl_cb* nl_cb_alloc ( enum nl_cb_kind  kind  )  [read]

Allocate a new callback handle

  • kind callback kind to be used for initialization
    Returns:
    Newly allocated callback handle or NULL

Definition at line 205 of file handlers.c.

References nl_cb_err(), and nl_cb_set().

Referenced by nl_cb_clone(), and nl_socket_alloc().

{
      int i;
      struct nl_cb *cb;

      if (kind < 0 || kind > NL_CB_KIND_MAX)
            return NULL;

      cb = calloc(1, sizeof(*cb));
      if (!cb)
            return NULL;

      cb->cb_refcnt = 1;

      for (i = 0; i <= NL_CB_TYPE_MAX; i++)
            nl_cb_set(cb, i, kind, NULL, NULL);

      nl_cb_err(cb, kind, NULL, NULL);

      return cb;
}


Generated by  Doxygen 1.6.0   Back to index