00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NETLINK_TC_API_H_
00013 #define NETLINK_TC_API_H_
00014
00015 #include <netlink/netlink.h>
00016 #include <netlink/msg.h>
00017 #include <netlink/route/tc.h>
00018
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022
00023 enum rtnl_tc_type {
00024 RTNL_TC_TYPE_QDISC,
00025 RTNL_TC_TYPE_CLASS,
00026 RTNL_TC_TYPE_CLS,
00027 __RTNL_TC_TYPE_MAX,
00028 };
00029
00030 #define RTNL_TC_TYPE_MAX (__RTNL_TC_TYPE_MAX - 1)
00031
00032
00033
00034
00035
00036
00037
00038
00039 struct rtnl_tc_ops
00040 {
00041
00042
00043
00044 char *to_kind;
00045
00046
00047
00048
00049 enum rtnl_tc_type to_type;
00050
00051
00052
00053
00054
00055 size_t to_size;
00056
00057
00058
00059
00060 void (*to_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, void *,
00061 struct nl_dump_params *);
00062
00063
00064
00065 int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *);
00066
00067
00068
00069
00070
00071
00072 int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *);
00073
00074
00075
00076
00077 int (*to_msg_parser)(struct rtnl_tc *, void *);
00078
00079
00080
00081
00082 void (*to_free_data)(struct rtnl_tc *, void *);
00083
00084
00085
00086
00087 int (*to_clone)(void *, void *);
00088
00089
00090
00091
00092 struct nl_list_head to_list;
00093 };
00094
00095 struct rtnl_tc_type_ops
00096 {
00097 enum rtnl_tc_type tt_type;
00098
00099 char *tt_dump_prefix;
00100
00101
00102
00103
00104 void (*tt_dump[NL_DUMP_MAX+1])(struct rtnl_tc *,
00105 struct nl_dump_params *);
00106 };
00107
00108 extern int rtnl_tc_msg_parse(struct nlmsghdr *,
00109 struct rtnl_tc *);
00110 extern int rtnl_tc_msg_build(struct rtnl_tc *, int,
00111 int, struct nl_msg **);
00112
00113 extern void rtnl_tc_free_data(struct nl_object *);
00114 extern int rtnl_tc_clone(struct nl_object *,
00115 struct nl_object *);
00116 extern void rtnl_tc_dump_line(struct nl_object *,
00117 struct nl_dump_params *);
00118 extern void rtnl_tc_dump_details(struct nl_object *,
00119 struct nl_dump_params *);
00120 extern void rtnl_tc_dump_stats(struct nl_object *,
00121 struct nl_dump_params *);
00122 extern int rtnl_tc_compare(struct nl_object *,
00123 struct nl_object *,
00124 uint32_t, int);
00125
00126 extern void * rtnl_tc_data(struct rtnl_tc *);
00127
00128 extern struct rtnl_tc_ops * rtnl_tc_lookup_ops(enum rtnl_tc_type,
00129 const char *);
00130 extern struct rtnl_tc_ops * rtnl_tc_get_ops(struct rtnl_tc *);
00131 extern int rtnl_tc_register(struct rtnl_tc_ops *);
00132 extern void rtnl_tc_unregister(struct rtnl_tc_ops *);
00133
00134 extern void rtnl_tc_type_register(struct rtnl_tc_type_ops *);
00135 extern void rtnl_tc_type_unregister(struct rtnl_tc_type_ops *);
00136
00137 #ifdef __cplusplus
00138 }
00139 #endif
00140
00141 #endif