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

struct nl_cache* rtnl_cls_alloc_cache ( struct nl_handle *  handle,
int  ifindex,
uint32_t  parent 
) [read]

Build a classifier cache including all classifiers attached to the specified class/qdisc on eht specified interface.

  • handle netlink handle
  • ifindex interface index of the link the classes are attached to.
  • parent parent qdisc/class
Allocates a new cache, initializes it properly and updates it to include all classes attached to the specified interface.

Note:
The caller is responsible for destroying and freeing the cache after using it. (nl_cache_destroy_and_free())
Returns:
The cache or NULL if an error has occured.

Definition at line 474 of file classifier.c.

References nl_cache_alloc_from_ops(), nl_cache_destroy_and_free(), and nl_cache_update().

{
      struct nl_cache * cache;
      
      cache = nl_cache_alloc_from_ops(&rtnl_cls_ops);
      if (cache == NULL)
            return NULL;

      cache->c_iarg1 = ifindex;
      cache->c_iarg2 = parent;
      
      if (nl_cache_update(handle, cache) < 0) {
            nl_cache_destroy_and_free(cache);
            return NULL;
      }

      return cache;
}


Generated by  Doxygen 1.6.0   Back to index