2004-04-16 04:56:59 +08:00
|
|
|
#ifndef _TC_UTIL_H_
|
|
|
|
#define _TC_UTIL_H_ 1
|
|
|
|
|
2004-08-14 07:54:55 +08:00
|
|
|
#define MAX_MSG 16384
|
2004-04-16 04:56:59 +08:00
|
|
|
#include <linux/pkt_sched.h>
|
|
|
|
#include <linux/pkt_cls.h>
|
2004-12-08 07:52:52 +08:00
|
|
|
#include <linux/gen_stats.h>
|
2004-04-16 04:56:59 +08:00
|
|
|
#include "tc_core.h"
|
|
|
|
|
2008-09-16 03:05:11 +08:00
|
|
|
/* This is the deprecated multiqueue interface */
|
|
|
|
#ifndef TCA_PRIO_MAX
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TCA_PRIO_UNSPEC,
|
|
|
|
TCA_PRIO_MQ,
|
|
|
|
__TCA_PRIO_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1)
|
|
|
|
#endif
|
|
|
|
|
2004-04-16 04:56:59 +08:00
|
|
|
struct qdisc_util
|
|
|
|
{
|
2004-08-14 07:54:55 +08:00
|
|
|
struct qdisc_util *next;
|
2004-09-01 01:45:21 +08:00
|
|
|
const char *id;
|
2004-04-16 04:56:59 +08:00
|
|
|
int (*parse_qopt)(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n);
|
|
|
|
int (*print_qopt)(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
|
|
|
|
int (*print_xstats)(struct qdisc_util *qu, FILE *f, struct rtattr *xstats);
|
|
|
|
|
|
|
|
int (*parse_copt)(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n);
|
|
|
|
int (*print_copt)(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
|
|
|
|
};
|
|
|
|
|
2008-04-20 22:47:48 +08:00
|
|
|
extern __u16 f_proto;
|
2004-04-16 04:56:59 +08:00
|
|
|
struct filter_util
|
|
|
|
{
|
|
|
|
struct filter_util *next;
|
|
|
|
char id[16];
|
2006-12-06 02:10:22 +08:00
|
|
|
int (*parse_fopt)(struct filter_util *qu, char *fhandle, int argc,
|
2004-09-29 02:35:49 +08:00
|
|
|
char **argv, struct nlmsghdr *n);
|
2004-04-16 04:56:59 +08:00
|
|
|
int (*print_fopt)(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle);
|
|
|
|
};
|
|
|
|
|
2004-08-14 07:54:55 +08:00
|
|
|
struct action_util
|
|
|
|
{
|
|
|
|
struct action_util *next;
|
|
|
|
char id[16];
|
2006-12-06 02:10:22 +08:00
|
|
|
int (*parse_aopt)(struct action_util *a, int *argc, char ***argv,
|
2004-09-29 02:35:49 +08:00
|
|
|
int code, struct nlmsghdr *n);
|
2004-08-14 07:54:55 +08:00
|
|
|
int (*print_aopt)(struct action_util *au, FILE *f, struct rtattr *opt);
|
|
|
|
int (*print_xstats)(struct action_util *au, FILE *f, struct rtattr *xstats);
|
|
|
|
};
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2007-06-21 06:27:22 +08:00
|
|
|
extern const char *get_tc_lib(void);
|
|
|
|
|
2004-06-03 04:22:08 +08:00
|
|
|
extern struct qdisc_util *get_qdisc_kind(const char *str);
|
|
|
|
extern struct filter_util *get_filter_kind(const char *str);
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2004-06-03 04:22:08 +08:00
|
|
|
extern int get_qdisc_handle(__u32 *h, const char *str);
|
|
|
|
extern int get_rate(unsigned *rate, const char *str);
|
2013-11-13 06:34:07 +08:00
|
|
|
extern int get_rate64(__u64 *rate, const char *str);
|
2004-06-03 04:22:08 +08:00
|
|
|
extern int get_size(unsigned *size, const char *str);
|
2004-04-16 04:56:59 +08:00
|
|
|
extern int get_size_and_cell(unsigned *size, int *cell_log, char *str);
|
2007-03-05 03:15:00 +08:00
|
|
|
extern int get_time(unsigned *time, const char *str);
|
2008-04-10 05:01:01 +08:00
|
|
|
extern int get_linklayer(unsigned *val, const char *arg);
|
|
|
|
|
2013-09-17 19:19:03 +08:00
|
|
|
extern void print_rate(char *buf, int len, __u64 rate);
|
2004-06-29 04:42:59 +08:00
|
|
|
extern void print_size(char *buf, int len, __u32 size);
|
|
|
|
extern void print_qdisc_handle(char *buf, int len, __u32 h);
|
2007-03-05 03:15:00 +08:00
|
|
|
extern void print_time(char *buf, int len, __u32 time);
|
2008-07-25 21:19:09 +08:00
|
|
|
extern void print_linklayer(char *buf, int len, unsigned linklayer);
|
2013-09-17 19:19:03 +08:00
|
|
|
extern char * sprint_rate(__u64 rate, char *buf);
|
2004-04-16 04:56:59 +08:00
|
|
|
extern char * sprint_size(__u32 size, char *buf);
|
|
|
|
extern char * sprint_qdisc_handle(__u32 h, char *buf);
|
|
|
|
extern char * sprint_tc_classid(__u32 h, char *buf);
|
2007-03-05 03:15:00 +08:00
|
|
|
extern char * sprint_time(__u32 time, char *buf);
|
2007-03-05 03:15:01 +08:00
|
|
|
extern char * sprint_ticks(__u32 ticks, char *buf);
|
2008-07-25 21:19:09 +08:00
|
|
|
extern char * sprint_linklayer(unsigned linklayer, char *buf);
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2004-12-08 07:52:52 +08:00
|
|
|
extern void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtattr **xstats);
|
|
|
|
extern void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtattr **xstats);
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2004-06-03 04:22:08 +08:00
|
|
|
extern int get_tc_classid(__u32 *h, const char *str);
|
2004-04-16 04:56:59 +08:00
|
|
|
extern int print_tc_classid(char *buf, int len, __u32 h);
|
|
|
|
extern char * sprint_tc_classid(__u32 h, char *buf);
|
|
|
|
|
|
|
|
extern int tc_print_police(FILE *f, struct rtattr *tb);
|
|
|
|
extern int parse_police(int *, char ***, int, struct nlmsghdr *);
|
|
|
|
|
2004-08-14 07:54:55 +08:00
|
|
|
extern char *action_n2a(int action, char *buf, int len);
|
|
|
|
extern int action_a2n(char *arg, int *result);
|
|
|
|
extern int act_parse_police(struct action_util *a,int *, char ***, int, struct nlmsghdr *);
|
2006-12-06 02:10:22 +08:00
|
|
|
extern int print_police(struct action_util *a, FILE *f,
|
2004-09-01 01:45:21 +08:00
|
|
|
struct rtattr *tb);
|
2006-12-06 02:10:22 +08:00
|
|
|
extern int police_print_xstats(struct action_util *a,FILE *f,
|
2004-09-01 01:45:21 +08:00
|
|
|
struct rtattr *tb);
|
|
|
|
extern int tc_print_action(FILE *f, const struct rtattr *tb);
|
|
|
|
extern int tc_print_ipt(FILE *f, const struct rtattr *tb);
|
2004-08-14 07:54:55 +08:00
|
|
|
extern int parse_action(int *, char ***, int, struct nlmsghdr *);
|
2004-09-01 01:45:21 +08:00
|
|
|
extern void print_tm(FILE *f, const struct tcf_t *tm);
|
2013-02-13 03:09:03 +08:00
|
|
|
extern int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
|
2004-04-16 04:56:59 +08:00
|
|
|
|
|
|
|
#endif
|