• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * netlink/route/class.h       Classes
3  *
4  *	This library is free software; you can redistribute it and/or
5  *	modify it under the terms of the GNU Lesser General Public
6  *	License as published by the Free Software Foundation version 2.1
7  *	of the License.
8  *
9  * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
10  */
11 
12 #ifndef NETLINK_CLASS_H_
13 #define NETLINK_CLASS_H_
14 
15 #include <netlink/netlink.h>
16 #include <netlink/route/tc.h>
17 #include <netlink/route/qdisc.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 struct rtnl_class;
24 
25 extern struct nl_object_ops class_obj_ops;
26 
27 extern struct rtnl_class *	rtnl_class_alloc(void);
28 extern void		rtnl_class_put(struct rtnl_class *);
29 extern int		rtnl_class_alloc_cache(struct nl_sock *, int,
30 					       struct nl_cache **);
31 extern struct rtnl_class *rtnl_class_get(struct nl_cache *, int, uint32_t);
32 
33 /* leaf qdisc access */
34 extern struct rtnl_qdisc *	rtnl_class_leaf_qdisc(struct rtnl_class *,
35 						      struct nl_cache *);
36 
37 extern int		rtnl_class_build_add_request(struct rtnl_class *, int,
38 						     struct nl_msg **);
39 extern int		rtnl_class_add(struct nl_sock *, struct rtnl_class *,
40 				       int);
41 
42 extern int	rtnl_class_build_delete_request(struct rtnl_class *,
43 											struct nl_msg **);
44 extern int	rtnl_class_delete(struct nl_sock *, struct rtnl_class *);
45 
46 extern void		rtnl_class_set_ifindex(struct rtnl_class *, int);
47 extern int		rtnl_class_get_ifindex(struct rtnl_class *);
48 extern void		rtnl_class_set_handle(struct rtnl_class *, uint32_t);
49 extern uint32_t		rtnl_class_get_handle(struct rtnl_class *);
50 extern void		rtnl_class_set_parent(struct rtnl_class *, uint32_t);
51 extern uint32_t		rtnl_class_get_parent(struct rtnl_class *);
52 extern void		rtnl_class_set_kind(struct rtnl_class *, const char *);
53 extern char *		rtnl_class_get_kind(struct rtnl_class *);
54 extern uint64_t		rtnl_class_get_stat(struct rtnl_class *,
55 					    enum rtnl_tc_stats_id);
56 
57 /* iterators */
58 extern void		rtnl_class_foreach_child(struct rtnl_class *,
59 						 struct nl_cache *,
60 						 void (*cb)(struct nl_object *,
61 						 	    void *),
62 						 void *);
63 extern void		rtnl_class_foreach_cls(struct rtnl_class *,
64 					       struct nl_cache *,
65 					       void (*cb)(struct nl_object *,
66 							  void *),
67 					       void *);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
74