• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * netlink/route/class-modules.h       Class 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_CLASS_MODULES_H_
13 #define NETLINK_CLASS_MODULES_H_
14 
15 #include <netlink/netlink.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /**
22  * Class operations
23  * @ingroup class_api
24  */
25 struct rtnl_class_ops
26 {
27 	/**
28 	 * Kind/Name of class
29 	 */
30 	char co_kind[32];
31 
32 	/**
33 	 * Dump callbacks
34 	 */
35 	void (*co_dump[NL_DUMP_MAX+1])(struct rtnl_class *,
36 				       struct nl_dump_params *);
37 
38 	/**
39 	 * Must return the contents supposed to be in TCA_OPTIONS
40 	 */
41 	struct nl_msg *(*co_get_opts)(struct rtnl_class *);
42 
43 	/**
44 	 * TCA_OPTIONS message parser
45 	 */
46 	int  (*co_msg_parser)(struct rtnl_class *);
47 
48 	/**
49 	 * Called before a class object gets destroyed
50 	 */
51 	void (*co_free_data)(struct rtnl_class *);
52 
53 	/**
54 	 * Called whenever a class object needs to be cloned
55 	 */
56 	int (*co_clone)(struct rtnl_class *, struct rtnl_class *);
57 
58 	/**
59 	 * INTERNAL (Do not use)
60 	 */
61 	struct rtnl_class_ops *co_next;
62 };
63 
64 extern int			rtnl_class_register(struct rtnl_class_ops *);
65 extern int			rtnl_class_unregister(struct rtnl_class_ops *);
66 extern struct rtnl_class_ops *	rtnl_class_lookup_ops(struct rtnl_class *);
67 extern struct rtnl_class_ops *	__rtnl_class_lookup_ops(const char *);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
74