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

int rtnl_class_alloc_cache ( struct nl_sock *  sk,
int  ifindex,
struct nl_cache **  result 
)

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

  • sk Netlink socket.
  • 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.

Returns:
The cache or NULL if an error has occured.

Definition at line 232 of file class.c.

References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().

{
      struct nl_cache * cache;
      int err;
      
      cache = nl_cache_alloc(&rtnl_class_ops);
      if (!cache)
            return -NLE_NOMEM;

      cache->c_iarg1 = ifindex;
      
      if (sk && (err = nl_cache_refill(sk, cache)) < 0) {
            nl_cache_free(cache);
            return err;
      }

      *result = cache;
      return 0;
}


Generated by  Doxygen 1.6.0   Back to index