libnl 3.10.0
tc-api.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2011-2013 Thomas Graf <tgraf@suug.ch>
4 */
5
6#ifndef NETLINK_TC_API_H_
7#define NETLINK_TC_API_H_
8
9#include <netlink/netlink.h>
10#include <netlink/msg.h>
11#include <netlink/route/tc.h>
12
13#include "nl-route.h"
14#include "nl-priv-dynamic-route/nl-priv-dynamic-route.h"
15#include "nl-priv-dynamic-core/nl-core.h"
16#include "nl-priv-dynamic-core/cache-api.h"
17
18/*****************************************************************************/
19
20#define TCA_ATTR_HANDLE 0x0001
21#define TCA_ATTR_PARENT 0x0002
22#define TCA_ATTR_IFINDEX 0x0004
23#define TCA_ATTR_KIND 0x0008
24#define TCA_ATTR_FAMILY 0x0010
25#define TCA_ATTR_INFO 0x0020
26#define TCA_ATTR_OPTS 0x0040
27#define TCA_ATTR_STATS 0x0080
28#define TCA_ATTR_XSTATS 0x0100
29#define TCA_ATTR_LINK 0x0200
30#define TCA_ATTR_MTU 0x0400
31#define TCA_ATTR_MPU 0x0800
32#define TCA_ATTR_OVERHEAD 0x1000
33#define TCA_ATTR_LINKTYPE 0x2000
34#define TCA_ATTR_CHAIN 0x4000
35#define TCA_ATTR_MAX TCA_ATTR_CHAIN
36
37extern int tca_parse(struct nlattr **, int, struct rtnl_tc *,
38 const struct nla_policy *);
39
40#define RTNL_TC_RTABLE_SIZE 256
41
42static inline void *tca_xstats(struct rtnl_tc *tca)
43{
44 return tca->tc_xstats->d_data;
45}
46
47extern struct nl_af_group tc_groups[];
48
49/*****************************************************************************/
50
52{
53 enum rtnl_tc_type tt_type;
54
55 char *tt_dump_prefix;
56
57 /**
58 * Dump callbacks
59 */
60 void (*tt_dump[NL_DUMP_MAX+1])(struct rtnl_tc *,
61 struct nl_dump_params *);
62};
63
64void *rtnl_tc_data_peek(struct rtnl_tc *tc);
65
66/*****************************************************************************/
67
68/* WARNING: the following symbols are wrongly exported in libnl-route-3
69 * library. They are private API, but leaked. */
70extern int rtnl_tc_msg_parse(struct nlmsghdr *,
71 struct rtnl_tc *);
72extern int rtnl_tc_msg_build(struct rtnl_tc *, int,
73 int, struct nl_msg **);
74
75extern void rtnl_tc_free_data(struct nl_object *);
76extern int rtnl_tc_clone(struct nl_object *,
77 struct nl_object *);
78extern void rtnl_tc_dump_line(struct nl_object *,
79 struct nl_dump_params *);
80extern void rtnl_tc_dump_details(struct nl_object *,
81 struct nl_dump_params *);
82extern void rtnl_tc_dump_stats(struct nl_object *,
83 struct nl_dump_params *);
84extern uint64_t rtnl_tc_compare(struct nl_object *,
85 struct nl_object *,
86 uint64_t, int);
87
88extern void * rtnl_tc_data(struct rtnl_tc *);
89extern void * rtnl_tc_data_check(struct rtnl_tc *,
90 struct rtnl_tc_ops *, int *);
91
92extern int rtnl_tc_register(struct rtnl_tc_ops *);
93extern void rtnl_tc_unregister(struct rtnl_tc_ops *);
94
95extern void rtnl_tc_type_register(struct rtnl_tc_type_ops *);
96extern void rtnl_tc_type_unregister(struct rtnl_tc_type_ops *);
97
98
99extern int rtnl_tc_build_rate_table(struct rtnl_tc *tc, struct rtnl_ratespec *,
100 uint32_t *);
101
102/*****************************************************************************/
103
104#endif
void * rtnl_tc_data_check(struct rtnl_tc *, struct rtnl_tc_ops *, int *)
Check traffic control object type and return private data section.
Definition tc.c:1114
void * rtnl_tc_data_peek(struct rtnl_tc *tc)
Returns the private data of the traffic control object.
Definition tc.c:1065
int rtnl_tc_build_rate_table(struct rtnl_tc *tc, struct rtnl_ratespec *, uint32_t *)
Compute a transmission time lookup table.
Definition tc.c:750
void * rtnl_tc_data(struct rtnl_tc *)
Return pointer to private data of traffic control object.
Definition tc.c:1079
int rtnl_tc_register(struct rtnl_tc_ops *)
Register a traffic control module.
Definition tc.c:1018
void rtnl_tc_unregister(struct rtnl_tc_ops *)
Unregister a traffic control module.
Definition tc.c:1052
Dumping parameters.
Definition types.h:32
Attribute validation policy.
Definition attr.h:63
void(* tt_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, struct nl_dump_params *)
Dump callbacks.
Definition tc-api.h:60