1 /*
2  * netlink/route/qdisc-modules.h       Qdisc Module API
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_QDISC_MODULES_H_
13 #define NETLINK_QDISC_MODULES_H_
14 
15 #include <netlink/netlink.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /**
22  * Qdisc Operations
23  * @ingroup qdisc
24  */
25 struct rtnl_qdisc_ops
26 {
27 	/**
28 	 * Kind/Name of Qdisc
29 	 */
30 	char qo_kind[32];
31 
32 	/**
33 	 * Dump callbacks
34 	 */
35 	void  (*qo_dump[NL_DUMP_MAX+1])(struct rtnl_qdisc *,
36 					struct nl_dump_params *);
37 
38 	/**
39 	 * Must return the contents supposed to be in TCA_OPTIONS
40 	 */
41 	struct nl_msg *(*qo_get_opts)(struct rtnl_qdisc *);
42 
43 	int (*qo_build_msg)(struct rtnl_qdisc *, struct nl_msg *);
44 
45 	/**
46 	 * TCA_OPTIONS message parser
47 	 */
48 	int  (*qo_msg_parser)(struct rtnl_qdisc *);
49 
50 	/**
51 	 * Called before a Qdisc object gets destroyed
52 	 */
53 	void (*qo_free_data)(struct rtnl_qdisc *);
54 
55 	/**
56 	 * Called whenever a qdisc object needs to be cloned
57 	 */
58 	int  (*qo_clone)(struct rtnl_qdisc *, struct rtnl_qdisc *);
59 
60 	/**
61 	 * INTERNAL (Do not use)
62 	 */
63 	struct rtnl_qdisc_ops *qo_next;
64 };
65 
66 extern int			rtnl_qdisc_register(struct rtnl_qdisc_ops *);
67 extern int			rtnl_qdisc_unregister(struct rtnl_qdisc_ops *);
68 extern struct rtnl_qdisc_ops *	rtnl_qdisc_lookup_ops(struct rtnl_qdisc *);
69 extern struct rtnl_qdisc_ops *	__rtnl_qdisc_lookup_ops(const char *);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif
76