libnl 1.1
include/netlink/route/class-modules.h
00001 /*
00002  * netlink/route/class-modules.h       Class Module API
00003  *
00004  *      This library is free software; you can redistribute it and/or
00005  *      modify it under the terms of the GNU Lesser General Public
00006  *      License as published by the Free Software Foundation version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
00010  */
00011 
00012 #ifndef NETLINK_CLASS_MODULES_H_
00013 #define NETLINK_CLASS_MODULES_H_
00014 
00015 #include <netlink/netlink.h>
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 /**
00022  * Class operations
00023  * @ingroup class_api
00024  */
00025 struct rtnl_class_ops
00026 {
00027         /**
00028          * Kind/Name of class
00029          */
00030         char co_kind[32];
00031 
00032         /**
00033          * Dump callbacks
00034          */
00035         int (*co_dump[NL_DUMP_MAX+1])(struct rtnl_class *,
00036                                       struct nl_dump_params *, int);
00037 
00038         /**
00039          * Must return the contents supposed to be in TCA_OPTIONS
00040          */
00041         struct nl_msg *(*co_get_opts)(struct rtnl_class *);
00042 
00043         /**
00044          * TCA_OPTIONS message parser
00045          */
00046         int  (*co_msg_parser)(struct rtnl_class *);
00047 
00048         /**
00049          * Called before a class object gets destroyed
00050          */
00051         void (*co_free_data)(struct rtnl_class *);
00052 
00053         /**
00054          * Called whenever a class object needs to be cloned
00055          */
00056         int (*co_clone)(struct rtnl_class *, struct rtnl_class *);
00057 
00058         /**
00059          * INTERNAL (Do not use)
00060          */
00061         struct rtnl_class_ops *co_next;
00062 };
00063 
00064 extern int                      rtnl_class_register(struct rtnl_class_ops *);
00065 extern int                      rtnl_class_unregister(struct rtnl_class_ops *);
00066 extern struct rtnl_class_ops *  rtnl_class_lookup_ops(struct rtnl_class *);
00067 extern struct rtnl_class_ops *  __rtnl_class_lookup_ops(const char *);
00068 
00069 #ifdef __cplusplus
00070 }
00071 #endif
00072 
00073 #endif