
In order for the interface to become more thread safe, the error handling was revised to no longer depend on a static errno and error string buffer. This patch converts all error paths to return a libnl specific error code which can be translated to a error message using nl_geterror(int error). The functions nl_error() and nl_get_errno() are therefore obsolete. This change required various sets of function prototypes to be changed in order to return an error code, the most prominent are: struct nl_cache *foo_alloc_cache(...); changed to: int foo_alloc_cache(..., struct nl_cache **); struct nl_msg *foo_build_request(...); changed to: int foo_build_request(..., struct nl_msg **); struct foo *foo_parse(...); changed to: int foo_parse(..., struct foo **); This pretty much only leaves trivial allocation functions to still return a pointer object which can still return NULL to signal out of memory. This change is a serious API and ABI breaker, sorry!
70 lines
2.1 KiB
C
70 lines
2.1 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-2008 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 0x001
|
|
#define TCA_ATTR_PARENT 0x002
|
|
#define TCA_ATTR_IFINDEX 0x004
|
|
#define TCA_ATTR_KIND 0x008
|
|
#define TCA_ATTR_FAMILY 0x010
|
|
#define TCA_ATTR_INFO 0x020
|
|
#define TCA_ATTR_OPTS 0x040
|
|
#define TCA_ATTR_STATS 0x080
|
|
#define TCA_ATTR_XSTATS 0x100
|
|
#define TCA_ATTR_MAX TCA_ATTR_XSTATS
|
|
|
|
extern int tca_parse(struct nlattr **, int, struct rtnl_tca *,
|
|
struct nla_policy *);
|
|
extern int tca_msg_parser(struct nlmsghdr *, struct rtnl_tca *);
|
|
extern void tca_free_data(struct rtnl_tca *);
|
|
extern int tca_clone(struct rtnl_tca *, struct rtnl_tca *);
|
|
extern int tca_dump_brief(struct rtnl_tca *, const char *,
|
|
struct nl_dump_params *, int);
|
|
extern int tca_dump_full(struct rtnl_tca *, struct nl_dump_params *, int);
|
|
extern int tca_dump_stats(struct rtnl_tca *,
|
|
struct nl_dump_params *, int);
|
|
extern int tca_compare(struct nl_object *, struct nl_object *, uint32_t, int);
|
|
|
|
extern void tca_set_ifindex(struct rtnl_tca *, int);
|
|
extern int tca_get_ifindex(struct rtnl_tca *);
|
|
extern void tca_set_handle(struct rtnl_tca *, uint32_t);
|
|
extern uint32_t tca_get_handle(struct rtnl_tca *);
|
|
extern void tca_set_parent(struct rtnl_tca *, uint32_t);
|
|
extern uint32_t tca_get_parent(struct rtnl_tca *);
|
|
extern void tca_set_kind(struct rtnl_tca *, const char *);
|
|
extern char *tca_get_kind(struct rtnl_tca *);
|
|
extern uint64_t tca_get_stat(struct rtnl_tca *, int );
|
|
|
|
extern int tca_build_msg(struct rtnl_tca *, int, int, struct nl_msg **);
|
|
|
|
static inline void *tca_priv(struct rtnl_tca *tca)
|
|
{
|
|
return tca->tc_subdata;
|
|
}
|
|
|
|
static inline void *tca_xstats(struct rtnl_tca *tca)
|
|
{
|
|
return tca->tc_xstats->d_data;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|