libnl 1.1.4
tc.h
1/*
2 * netlink/route/tc.h Traffic Control
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
7 * of the License.
8 *
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
10 */
11
12#ifndef NETLINK_TC_H_
13#define NETLINK_TC_H_
14
15#include <netlink/netlink.h>
16#include <netlink/cache.h>
17#include <netlink/data.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/**
24 * TC statistics identifiers
25 * @ingroup tc
26 */
28 RTNL_TC_PACKETS, /**< Packets seen */
29 RTNL_TC_BYTES, /**< Bytes seen */
30 RTNL_TC_RATE_BPS, /**< Current bits/s (rate estimator) */
31 RTNL_TC_RATE_PPS, /**< Current packet/s (rate estimator) */
32 RTNL_TC_QLEN, /**< Queue length */
33 RTNL_TC_BACKLOG, /**< Backlog length */
34 RTNL_TC_DROPS, /**< Packets dropped */
35 RTNL_TC_REQUEUES, /**< Number of requeues */
36 RTNL_TC_OVERLIMITS, /**< Number of overlimits */
37 __RTNL_TC_STATS_MAX,
38};
39
40#define RTNL_TC_STATS_MAX (__RTNL_TC_STATS_MAX - 1)
41
42extern int rtnl_tc_calc_txtime(int, int);
43extern int rtnl_tc_calc_bufsize(int, int);
44extern int rtnl_tc_calc_cell_log(int);
45
46/**
47 * Number of entries in a transmission time lookup table
48 * @ingroup tc
49 */
50#define RTNL_TC_RTABLE_SIZE 256
51
52extern int rtnl_tc_build_rate_table(uint32_t *, uint8_t, uint8_t, int, int);
53
54
55/* TC Handle Translations */
56extern char * rtnl_tc_handle2str(uint32_t, char *, size_t);
57extern int rtnl_tc_str2handle(const char *, uint32_t *);
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif
int rtnl_tc_calc_cell_log(int)
Calculate the binary logarithm for a specific cell size.
Definition: tc.c:420
int rtnl_tc_calc_bufsize(int, int)
Calculate buffer size able to transmit in a specific time and rate.
Definition: tc.c:406
rtnl_tc_stats_id
TC statistics identifiers.
Definition: tc.h:27
int rtnl_tc_str2handle(const char *, uint32_t *)
Convert a charactering strint to a traffic control handle.
Definition: tc.c:528
char * rtnl_tc_handle2str(uint32_t, char *, size_t)
Convert a traffic control handle to a character string (Reentrant).
Definition: tc.c:493
int rtnl_tc_build_rate_table(uint32_t *, uint8_t, uint8_t, int, int)
Compute a transmission time lookup table.
Definition: tc.c:454
int rtnl_tc_calc_txtime(int, int)
Calculate time required to transmit buffer at a specific rate.
Definition: tc.c:383
@ RTNL_TC_PACKETS
Packets seen.
Definition: tc.h:28
@ RTNL_TC_BYTES
Bytes seen.
Definition: tc.h:29
@ RTNL_TC_QLEN
Queue length.
Definition: tc.h:32
@ RTNL_TC_OVERLIMITS
Number of overlimits.
Definition: tc.h:36
@ RTNL_TC_DROPS
Packets dropped.
Definition: tc.h:34
@ RTNL_TC_RATE_PPS
Current packet/s (rate estimator)
Definition: tc.h:31
@ RTNL_TC_REQUEUES
Number of requeues.
Definition: tc.h:35
@ RTNL_TC_BACKLOG
Backlog length.
Definition: tc.h:33
@ RTNL_TC_RATE_BPS
Current bits/s (rate estimator)
Definition: tc.h:30