00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NETLINK_TC_H_
00013 #define NETLINK_TC_H_
00014
00015 #include <netlink/netlink.h>
00016 #include <netlink/cache.h>
00017 #include <netlink/data.h>
00018 #include <netlink/route/link.h>
00019 #include <linux/pkt_sched.h>
00020 #include <linux/pkt_cls.h>
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026
00027
00028
00029
00030 #define TC_HANDLE(maj, min) (TC_H_MAJ((maj) << 16) | TC_H_MIN(min))
00031
00032
00033
00034
00035
00036 struct rtnl_tc;
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #define TC_CAST(ptr) ((struct rtnl_tc *) (ptr))
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 enum rtnl_tc_stat {
00057 RTNL_TC_PACKETS,
00058 RTNL_TC_BYTES,
00059 RTNL_TC_RATE_BPS,
00060 RTNL_TC_RATE_PPS,
00061 RTNL_TC_QLEN,
00062 RTNL_TC_BACKLOG,
00063 RTNL_TC_DROPS,
00064 RTNL_TC_REQUEUES,
00065 RTNL_TC_OVERLIMITS,
00066 __RTNL_TC_STATS_MAX,
00067 };
00068
00069 #define RTNL_TC_STATS_MAX (__RTNL_TC_STATS_MAX - 1)
00070
00071 extern void rtnl_tc_set_ifindex(struct rtnl_tc *, int);
00072 extern int rtnl_tc_get_ifindex(struct rtnl_tc *);
00073 extern void rtnl_tc_set_link(struct rtnl_tc *, struct rtnl_link *);
00074 extern struct rtnl_link *rtnl_tc_get_link(struct rtnl_tc *);
00075 extern void rtnl_tc_set_mtu(struct rtnl_tc *, uint32_t);
00076 extern uint32_t rtnl_tc_get_mtu(struct rtnl_tc *);
00077 extern void rtnl_tc_set_mpu(struct rtnl_tc *, uint32_t);
00078 extern uint32_t rtnl_tc_get_mpu(struct rtnl_tc *);
00079 extern void rtnl_tc_set_overhead(struct rtnl_tc *, uint32_t);
00080 extern uint32_t rtnl_tc_get_overhead(struct rtnl_tc *);
00081 extern void rtnl_tc_set_linktype(struct rtnl_tc *, uint32_t);
00082 extern uint32_t rtnl_tc_get_linktype(struct rtnl_tc *);
00083 extern void rtnl_tc_set_handle(struct rtnl_tc *, uint32_t);
00084 extern uint32_t rtnl_tc_get_handle(struct rtnl_tc *);
00085 extern void rtnl_tc_set_parent(struct rtnl_tc *, uint32_t);
00086 extern uint32_t rtnl_tc_get_parent(struct rtnl_tc *);
00087 extern int rtnl_tc_set_kind(struct rtnl_tc *, const char *);
00088 extern char * rtnl_tc_get_kind(struct rtnl_tc *);
00089 extern uint64_t rtnl_tc_get_stat(struct rtnl_tc *, enum rtnl_tc_stat);
00090
00091 extern int rtnl_tc_calc_txtime(int, int);
00092 extern int rtnl_tc_calc_bufsize(int, int);
00093 extern int rtnl_tc_calc_cell_log(int);
00094
00095 extern int rtnl_tc_read_classid_file(void);
00096 extern char * rtnl_tc_handle2str(uint32_t, char *, size_t);
00097 extern int rtnl_tc_str2handle(const char *, uint32_t *);
00098 extern int rtnl_classid_generate(const char *, uint32_t *,
00099 uint32_t);
00100
00101 #ifdef __cplusplus
00102 }
00103 #endif
00104
00105 #endif