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

void nl_cache_foreach_filter ( struct nl_cache *  cache,
struct nl_object *  filter,
void(*)(struct nl_object *, void *)  cb,
void *  arg 
)

Call a callback on each element of the cache (filtered).

  • cache cache to iterate on
  • filter filter object
  • cb callback function
  • arg argument passed to callback function
Calls a callback function cb on each element of the cache that matches the filter. The argument arg is passed on to the callback function.

Definition at line 808 of file cache.c.

References nl_object_match_filter().

Referenced by nl_cache_foreach(), rtnl_class_foreach_child(), rtnl_class_foreach_cls(), rtnl_qdisc_foreach_child(), and rtnl_qdisc_foreach_cls().

{
      struct nl_object *obj, *tmp;
      struct nl_object_ops *ops;

      if (cache->c_ops == NULL)
            BUG();

      ops = cache->c_ops->co_obj_ops;

      nl_list_for_each_entry_safe(obj, tmp, &cache->c_items, ce_list) {
            if (filter && !nl_object_match_filter(obj, filter))
                  continue;

            cb(obj, arg);
      }
}


Generated by  Doxygen 1.6.0   Back to index