netplika/tc.h

44 lines
1.4 KiB
C
Raw Normal View History

2015-07-19 16:18:40 +02:00
/** Trafic Controller (TC) related functions
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2017, Steffen Vogel
2015-07-19 16:18:40 +02:00
* @license GPLv3
*********************************************************************************/
#ifndef _TC_H_
#define _TC_H_
#include <netlink/route/tc.h>
#include <netlink/route/qdisc.h>
#include <netlink/route/classifier.h>
2015-07-12 21:10:34 +02:00
2015-07-23 00:14:38 +02:00
struct tc_statistics {
2015-07-19 16:18:40 +02:00
uint64_t packets; // Number of packets seen.
uint64_t bytes; // Total bytes seen.
uint64_t rate_bps; // Current bits/s (rate estimator)
uint64_t rate_pps; // Current packet/s (rate estimator)
uint64_t qlen; // Current queue length.
uint64_t backlog; // Current backlog length.
uint64_t drops; // Total number of packets dropped.
uint64_t requeues; // Total number of requeues.
2017-12-14 01:01:15 +01:00
uint64_t overlimits; // Total number of overlimits.
2015-07-23 00:14:38 +02:00
};
2015-07-19 16:18:40 +02:00
2015-07-12 21:10:34 +02:00
struct rtnl_link * tc_get_link(struct nl_sock *sock, const char *dev);
2015-07-19 16:18:40 +02:00
int tc_prio(struct nl_sock *sock, struct rtnl_link *link, struct rtnl_tc **tc);
2015-07-22 17:11:45 +02:00
int tc_netem(struct nl_sock *sock, struct rtnl_link *link, struct rtnl_tc **tc);
2015-07-19 16:18:40 +02:00
int tc_classifier(struct nl_sock *sock, struct rtnl_link *link, struct rtnl_tc **tc, int mark, int mask);
2015-07-12 21:10:34 +02:00
2015-07-19 16:18:40 +02:00
int tc_reset(struct nl_sock *sock, struct rtnl_link *link);
2015-07-12 21:10:34 +02:00
2015-07-19 16:18:40 +02:00
int tc_get_stats(struct nl_sock *sock, struct rtnl_tc *tc, struct tc_stats *stats);
2015-07-12 21:10:34 +02:00
2017-12-14 01:01:15 +01:00
void tc_print_stats(struct tc_statistics *stats);
2015-07-12 21:10:34 +02:00
2015-07-22 17:11:45 +02:00
int tc_print_netem(struct rtnl_tc *tc);
2015-07-23 00:14:38 +02:00
#endif