libnl/include/netlink-tc.h
Thomas Graf 4c6d1c5dfb Unified TC attributes interface
So far all common tc atttributes were accessed via specific functions, i.e.
rtnl_class_set_parent(), rtnl_qdisc_set_parent(), rtnl_cls_set_parent()
which implied a lot of code duplication. Since all tc objects are derived
from struct rtnl_tc and these common attributes are already stored in there
this patch removes all type specific functions and makes rtnl_tc_* attribute
functions public.

        rtnl_qdisc_set_parent(qdisc, 10);

becomes:

        rtnl_tc_set_parent((struct rtnl_tc *) qdisc, 10);

This patch also adds the following new attributes to tc objects therefore
removing them as tc specific attributes:
 - mtu
 - mpu
 - overhead

This allows for the rate table calculations to be unified as well taking into
account the new kernel behavior to take care of overhead automatically.
2010-10-26 12:54:33 +02:00

72 lines
1.9 KiB
C

/*
* netlink-tc.h Local Traffic Control Interface
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_TC_PRIV_H_
#define NETLINK_TC_PRIV_H_
#include <netlink-local.h>
#ifdef __cplusplus
extern "C" {
#endif
#define TCA_ATTR_HANDLE 0x0001
#define TCA_ATTR_PARENT 0x0002
#define TCA_ATTR_IFINDEX 0x0004
#define TCA_ATTR_KIND 0x0008
#define TCA_ATTR_FAMILY 0x0010
#define TCA_ATTR_INFO 0x0020
#define TCA_ATTR_OPTS 0x0040
#define TCA_ATTR_STATS 0x0080
#define TCA_ATTR_XSTATS 0x0100
#define TCA_ATTR_LINK 0x0200
#define TCA_ATTR_MTU 0x0400
#define TCA_ATTR_MPU 0x0800
#define TCA_ATTR_OVERHEAD 0x1000
#define TCA_ATTR_LINKTYPE 0x2000
#define TCA_ATTR_MAX TCA_ATTR_LINKTYPE
extern int tca_parse(struct nlattr **, int, struct rtnl_tc *,
struct nla_policy *);
extern int tca_msg_parser(struct nlmsghdr *, struct rtnl_tc *);
extern void tca_free_data(struct rtnl_tc *);
extern int tca_clone(struct rtnl_tc *, struct rtnl_tc *);
extern void tca_dump_line(struct rtnl_tc *, const char *,
struct nl_dump_params *);
extern void tca_dump_details(struct rtnl_tc *, struct nl_dump_params *);
extern void tca_dump_stats(struct rtnl_tc *, struct nl_dump_params *);
extern int tca_compare(struct nl_object *, struct nl_object *, uint32_t, int);
extern void tca_set_kind(struct rtnl_tc *, const char *);
extern int tca_build_msg(struct rtnl_tc *, int, int, struct nl_msg **);
#define RTNL_TC_RTABLE_SIZE 256
extern int rtnl_tc_build_rate_table(struct rtnl_tc *tc, struct rtnl_ratespec *,
uint32_t *);
static inline void *tca_priv(struct rtnl_tc *tca)
{
return tca->tc_subdata;
}
static inline void *tca_xstats(struct rtnl_tc *tca)
{
return tca->tc_xstats->d_data;
}
#ifdef __cplusplus
}
#endif
#endif