1 /*
2  * netlink-tc.h		Local Traffic Control Interface
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_TC_PRIV_H_
13 #define NETLINK_TC_PRIV_H_
14 
15 #include <netlink-local.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #define TCA_ATTR_HANDLE    0x001
22 #define TCA_ATTR_PARENT    0x002
23 #define TCA_ATTR_IFINDEX   0x004
24 #define TCA_ATTR_KIND      0x008
25 #define TCA_ATTR_FAMILY    0x010
26 #define TCA_ATTR_INFO      0x020
27 #define TCA_ATTR_OPTS      0x040
28 #define TCA_ATTR_STATS     0x080
29 #define TCA_ATTR_XSTATS    0x100
30 #define TCA_ATTR_MAX	  TCA_ATTR_XSTATS
31 
32 extern int tca_parse(struct nlattr **, int, struct rtnl_tca *,
33 		     struct nla_policy *);
34 extern int  tca_msg_parser(struct nlmsghdr *, struct rtnl_tca *);
35 extern void tca_free_data(struct rtnl_tca *);
36 extern int  tca_clone(struct rtnl_tca *, struct rtnl_tca *);
37 extern void tca_dump_line(struct rtnl_tca *, const char *,
38 			  struct nl_dump_params *);
39 extern void tca_dump_details(struct rtnl_tca *, struct nl_dump_params *);
40 extern void tca_dump_stats(struct rtnl_tca *, struct nl_dump_params *);
41 extern int  tca_compare(struct nl_object *, struct nl_object *, uint32_t, int);
42 
43 extern void tca_set_ifindex(struct rtnl_tca *, int);
44 extern int  tca_get_ifindex(struct rtnl_tca *);
45 extern void tca_set_handle(struct rtnl_tca *, uint32_t);
46 extern uint32_t tca_get_handle(struct rtnl_tca *);
47 extern void tca_set_parent(struct rtnl_tca *, uint32_t);
48 extern uint32_t tca_get_parent(struct rtnl_tca *);
49 extern void tca_set_kind(struct rtnl_tca *, const char *);
50 extern char *tca_get_kind(struct rtnl_tca *);
51 extern uint64_t tca_get_stat(struct rtnl_tca *, int );
52 
53 extern int tca_build_msg(struct rtnl_tca *, int, int, struct nl_msg **);
54 
tca_priv(struct rtnl_tca * tca)55 static inline void *tca_priv(struct rtnl_tca *tca)
56 {
57 	return tca->tc_subdata;
58 }
59 
tca_xstats(struct rtnl_tca * tca)60 static inline void *tca_xstats(struct rtnl_tca *tca)
61 {
62 	return tca->tc_xstats->d_data;
63 }
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif
70