00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <netlink/cli/utils.h>
00019 #include <netlink/cli/class.h>
00020
00021 struct rtnl_class *nl_cli_class_alloc(void)
00022 {
00023 struct rtnl_class *class;
00024
00025 if (!(class = rtnl_class_alloc()))
00026 nl_cli_fatal(ENOMEM, "Unable to allocate class object");
00027
00028 return class;
00029 }
00030
00031 struct nl_cache *nl_cli_class_alloc_cache(struct nl_sock *sock, int ifindex)
00032 {
00033 struct nl_cache *cache;
00034 int err;
00035
00036 if ((err = rtnl_class_alloc_cache(sock, ifindex, &cache)) < 0)
00037 nl_cli_fatal(err, "Unable to allocate class cache: %s",
00038 nl_geterror(err));
00039
00040 nl_cache_mngt_provide(cache);
00041
00042 return cache;
00043 }
00044
00045