• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: LGPL-2.1-only */
2 /*
3  * Copyright (c) 2010-2011 Thomas Graf <tgraf@suug.ch>
4  */
5 
6 /**
7  * @ingroup cli
8  * @defgroup cli_class Traffic Classes
9  * @{
10  */
11 
12 #include <netlink/cli/utils.h>
13 #include <netlink/cli/class.h>
14 
nl_cli_class_alloc(void)15 struct rtnl_class *nl_cli_class_alloc(void)
16 {
17 	struct rtnl_class *class;
18 
19 	if (!(class = rtnl_class_alloc()))
20 		nl_cli_fatal(ENOMEM, "Unable to allocate class object");
21 
22 	return class;
23 }
24 
nl_cli_class_alloc_cache(struct nl_sock * sock,int ifindex)25 struct nl_cache *nl_cli_class_alloc_cache(struct nl_sock *sock, int ifindex)
26 {
27 	struct nl_cache *cache;
28 	int err;
29 
30 	if ((err = rtnl_class_alloc_cache(sock, ifindex, &cache)) < 0)
31 		nl_cli_fatal(err, "Unable to allocate class cache: %s",
32 			     nl_geterror(err));
33 
34 	nl_cache_mngt_provide(cache);
35 
36 	return cache;
37 }
38 
39 /** @} */
40