]> git.proxmox.com Git - mirror_iproute2.git/blame - tc/tc_util.h
tc/m_tunnel_key: Add to the usage encapsulation dest UDP port
[mirror_iproute2.git] / tc / tc_util.h
CommitLineData
aba5acdf
SH
1#ifndef _TC_UTIL_H_
2#define _TC_UTIL_H_ 1
3
2373fde9 4#define MAX_MSG 16384
aba5acdf
SH
5#include <linux/pkt_sched.h>
6#include <linux/pkt_cls.h>
e5879dc6 7#include <linux/gen_stats.h>
aba5acdf
SH
8#include "tc_core.h"
9
5a67f8f9
SH
10/* This is the deprecated multiqueue interface */
11#ifndef TCA_PRIO_MAX
12enum
13{
14 TCA_PRIO_UNSPEC,
15 TCA_PRIO_MQ,
16 __TCA_PRIO_MAX
17};
18
19#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1)
20#endif
21
4bd62446 22struct qdisc_util {
2373fde9 23 struct qdisc_util *next;
6dc9f016 24 const char *id;
9ffc80b1
PS
25 int (*parse_qopt)(struct qdisc_util *qu, int argc,
26 char **argv, struct nlmsghdr *n);
27 int (*print_qopt)(struct qdisc_util *qu,
28 FILE *f, struct rtattr *opt);
29 int (*print_xstats)(struct qdisc_util *qu,
30 FILE *f, struct rtattr *xstats);
31
32 int (*parse_copt)(struct qdisc_util *qu, int argc,
33 char **argv, struct nlmsghdr *n);
34 int (*print_copt)(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
aba5acdf
SH
35};
36
eefcbc72 37extern __u16 f_proto;
4bd62446 38struct filter_util {
aba5acdf 39 struct filter_util *next;
9ffc80b1
PS
40 char id[16];
41 int (*parse_fopt)(struct filter_util *qu, char *fhandle,
42 int argc, char **argv, struct nlmsghdr *n);
43 int (*print_fopt)(struct filter_util *qu,
44 FILE *f, struct rtattr *opt, __u32 fhandle);
aba5acdf
SH
45};
46
4bd62446 47struct action_util {
9ffc80b1
PS
48 struct action_util *next;
49 char id[16];
50 int (*parse_aopt)(struct action_util *a, int *argc,
51 char ***argv, int code, struct nlmsghdr *n);
52 int (*print_aopt)(struct action_util *au, FILE *f, struct rtattr *opt);
53 int (*print_xstats)(struct action_util *au,
54 FILE *f, struct rtattr *xstats);
2373fde9 55};
aba5acdf 56
4bd62446 57struct exec_util {
9ffc80b1
PS
58 struct exec_util *next;
59 char id[16];
60 int (*parse_eopt)(struct exec_util *eu, int argc, char **argv);
4bd62446
DB
61};
62
9ffc80b1
PS
63const char *get_tc_lib(void);
64
65struct qdisc_util *get_qdisc_kind(const char *str);
66struct filter_util *get_filter_kind(const char *str);
67
68int get_qdisc_handle(__u32 *h, const char *str);
69int get_rate(unsigned int *rate, const char *str);
70int get_rate64(__u64 *rate, const char *str);
71int get_size(unsigned int *size, const char *str);
72int get_size_and_cell(unsigned int *size, int *cell_log, char *str);
73int get_time(unsigned int *time, const char *str);
74int get_linklayer(unsigned int *val, const char *arg);
75
76void print_rate(char *buf, int len, __u64 rate);
77void print_size(char *buf, int len, __u32 size);
78void print_qdisc_handle(char *buf, int len, __u32 h);
79void print_time(char *buf, int len, __u32 time);
80void print_linklayer(char *buf, int len, unsigned int linklayer);
81
82char *sprint_rate(__u64 rate, char *buf);
83char *sprint_size(__u32 size, char *buf);
84char *sprint_qdisc_handle(__u32 h, char *buf);
85char *sprint_tc_classid(__u32 h, char *buf);
86char *sprint_time(__u32 time, char *buf);
87char *sprint_ticks(__u32 ticks, char *buf);
88char *sprint_linklayer(unsigned int linklayer, char *buf);
89
90void print_tcstats_attr(FILE *fp, struct rtattr *tb[],
91 char *prefix, struct rtattr **xstats);
92void print_tcstats2_attr(FILE *fp, struct rtattr *rta,
93 char *prefix, struct rtattr **xstats);
94
95int get_tc_classid(__u32 *h, const char *str);
96int print_tc_classid(char *buf, int len, __u32 h);
97char *sprint_tc_classid(__u32 h, char *buf);
98
99int tc_print_police(FILE *f, struct rtattr *tb);
100int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
101
70932006 102const char *action_n2a(int action);
53aadc52 103int action_a2n(char *arg, int *result, bool allow_num);
9ffc80b1
PS
104int act_parse_police(struct action_util *a, int *argc_p,
105 char ***argv_p, int tca_id, struct nlmsghdr *n);
106int print_police(struct action_util *a, FILE *f, struct rtattr *tb);
107int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb);
108int tc_print_action(FILE *f, const struct rtattr *tb);
109int tc_print_ipt(FILE *f, const struct rtattr *tb);
110int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
111void print_tm(FILE *f, const struct tcf_t *tm);
112int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
113
114int cls_names_init(char *path);
115void cls_names_uninit(void);
4612d04d 116
aba5acdf 117#endif