1/* 2 * netlink/route/class.h Classes 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-2008 Thomas Graf <tgraf@suug.ch> 10 */ 11 12#ifndef NETLINK_CLASS_H_ 13#define NETLINK_CLASS_H_ 14 15#include <netlink/netlink.h> 16#include <netlink/route/tc.h> 17#include <netlink/route/qdisc.h> 18 19#ifdef __cplusplus 20extern "C" { 21#endif 22 23struct rtnl_class; 24 25extern struct nl_object_ops class_obj_ops; 26 27extern struct rtnl_class * rtnl_class_alloc(void); 28extern void rtnl_class_put(struct rtnl_class *); 29extern int rtnl_class_alloc_cache(struct nl_sock *, int, 30 struct nl_cache **); 31extern struct rtnl_class *rtnl_class_get(struct nl_cache *, int, uint32_t); 32 33/* leaf qdisc access */ 34extern struct rtnl_qdisc * rtnl_class_leaf_qdisc(struct rtnl_class *, 35 struct nl_cache *); 36 37extern int rtnl_class_build_add_request(struct rtnl_class *, int, 38 struct nl_msg **); 39extern int rtnl_class_add(struct nl_sock *, struct rtnl_class *, 40 int); 41 42extern int rtnl_class_build_delete_request(struct rtnl_class *, 43 struct nl_msg **); 44extern int rtnl_class_delete(struct nl_sock *, struct rtnl_class *); 45 46extern void rtnl_class_set_ifindex(struct rtnl_class *, int); 47extern int rtnl_class_get_ifindex(struct rtnl_class *); 48extern void rtnl_class_set_handle(struct rtnl_class *, uint32_t); 49extern uint32_t rtnl_class_get_handle(struct rtnl_class *); 50extern void rtnl_class_set_parent(struct rtnl_class *, uint32_t); 51extern uint32_t rtnl_class_get_parent(struct rtnl_class *); 52extern void rtnl_class_set_kind(struct rtnl_class *, const char *); 53extern char * rtnl_class_get_kind(struct rtnl_class *); 54extern uint64_t rtnl_class_get_stat(struct rtnl_class *, 55 enum rtnl_tc_stats_id); 56 57/* iterators */ 58extern void rtnl_class_foreach_child(struct rtnl_class *, 59 struct nl_cache *, 60 void (*cb)(struct nl_object *, 61 void *), 62 void *); 63extern void rtnl_class_foreach_cls(struct rtnl_class *, 64 struct nl_cache *, 65 void (*cb)(struct nl_object *, 66 void *), 67 void *); 68 69#ifdef __cplusplus 70} 71#endif 72 73#endif 74