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

struct nl_cache* rtnl_class_alloc_cache ( struct nl_handle *  handle,
int  ifindex 
) [read]

Build a class cache including all classes attached to the specified interface

  • handle netlink handle
  • ifindex interface index of the link the classes are attached to.
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 365 of file class.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_class_ops);
      if (!cache)
            return NULL;

      cache->c_iarg1 = ifindex;
      
      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