]> git.proxmox.com Git - mirror_iproute2.git/blob - ip/ip_common.h
iplink: add support for afstats subcommand
[mirror_iproute2.git] / ip / ip_common.h
1 int get_operstate(const char *name);
2 int print_linkinfo(const struct sockaddr_nl *who,
3 struct nlmsghdr *n, void *arg);
4 int print_linkinfo_brief(const struct sockaddr_nl *who,
5 struct nlmsghdr *n, void *arg);
6 int print_addrinfo(const struct sockaddr_nl *who,
7 struct nlmsghdr *n, void *arg);
8 int print_addrlabel(const struct sockaddr_nl *who,
9 struct nlmsghdr *n, void *arg);
10 int print_neigh(const struct sockaddr_nl *who,
11 struct nlmsghdr *n, void *arg);
12 int ipaddr_list_link(int argc, char **argv);
13 void ipaddr_get_vf_rate(int, int *, int *, int);
14 void iplink_usage(void) __attribute__((noreturn));
15
16 void iproute_reset_filter(int ifindex);
17 void ipmroute_reset_filter(int ifindex);
18 void ipaddr_reset_filter(int oneline, int ifindex);
19 void ipneigh_reset_filter(int ifindex);
20 void ipnetconf_reset_filter(int ifindex);
21
22 int print_route(const struct sockaddr_nl *who,
23 struct nlmsghdr *n, void *arg);
24 int print_mroute(const struct sockaddr_nl *who,
25 struct nlmsghdr *n, void *arg);
26 int print_prefix(const struct sockaddr_nl *who,
27 struct nlmsghdr *n, void *arg);
28 int print_rule(const struct sockaddr_nl *who,
29 struct nlmsghdr *n, void *arg);
30 int print_netconf(const struct sockaddr_nl *who,
31 struct rtnl_ctrl_data *ctrl,
32 struct nlmsghdr *n, void *arg);
33 void netns_map_init(void);
34 void netns_nsid_socket_init(void);
35 int print_nsid(const struct sockaddr_nl *who,
36 struct nlmsghdr *n, void *arg);
37 int do_ipaddr(int argc, char **argv);
38 int do_ipaddrlabel(int argc, char **argv);
39 int do_iproute(int argc, char **argv);
40 int do_iprule(int argc, char **argv);
41 int do_ipneigh(int argc, char **argv);
42 int do_ipntable(int argc, char **argv);
43 int do_iptunnel(int argc, char **argv);
44 int do_ip6tunnel(int argc, char **argv);
45 int do_iptuntap(int argc, char **argv);
46 int do_iplink(int argc, char **argv);
47 int do_ipmacsec(int argc, char **argv);
48 int do_ipmonitor(int argc, char **argv);
49 int do_multiaddr(int argc, char **argv);
50 int do_multiroute(int argc, char **argv);
51 int do_multirule(int argc, char **argv);
52 int do_netns(int argc, char **argv);
53 int do_xfrm(int argc, char **argv);
54 int do_ipl2tp(int argc, char **argv);
55 int do_ipfou(int argc, char **argv);
56 extern int do_ipila(int argc, char **argv);
57 int do_tcp_metrics(int argc, char **argv);
58 int do_ipnetconf(int argc, char **argv);
59 int do_iptoken(int argc, char **argv);
60 int do_ipvrf(int argc, char **argv);
61 void vrf_reset(void);
62 int netns_identify_pid(const char *pidstr, char *name, int len);
63
64 int iplink_get(unsigned int flags, char *name, __u32 filt_mask);
65 int iplink_ifla_xstats(int argc, char **argv);
66
67 static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
68 {
69 __u32 table = r->rtm_table;
70
71 if (tb[RTA_TABLE])
72 table = rta_getattr_u32(tb[RTA_TABLE]);
73 return table;
74 }
75
76 extern struct rtnl_handle rth;
77
78 #include <stdbool.h>
79
80 struct link_util {
81 struct link_util *next;
82 const char *id;
83 int maxattr;
84 int (*parse_opt)(struct link_util *, int, char **,
85 struct nlmsghdr *);
86 void (*print_opt)(struct link_util *, FILE *,
87 struct rtattr *[]);
88 void (*print_xstats)(struct link_util *, FILE *,
89 struct rtattr *);
90 void (*print_help)(struct link_util *, int, char **,
91 FILE *);
92 int (*parse_ifla_xstats)(struct link_util *,
93 int, char **);
94 int (*print_ifla_xstats)(const struct sockaddr_nl *,
95 struct nlmsghdr *, void *);
96 };
97
98 struct link_util *get_link_kind(const char *kind);
99
100 void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
101 int bridge_parse_xstats(struct link_util *lu, int argc, char **argv);
102 int bridge_print_xstats(const struct sockaddr_nl *who,
103 struct nlmsghdr *n, void *arg);
104
105 __u32 ipvrf_get_table(const char *name);
106 int name_is_vrf(const char *name);
107
108 #ifndef INFINITY_LIFE_TIME
109 #define INFINITY_LIFE_TIME 0xFFFFFFFFU
110 #endif
111
112 #ifndef LABEL_MAX_MASK
113 #define LABEL_MAX_MASK 0xFFFFFU
114 #endif
115
116 void print_num(FILE *fp, unsigned int width, uint64_t count);