libnl 1.1
|
00001 /* 00002 * netlink/genl/mngt.h Generic Netlink Management 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_GENL_MNGT_H_ 00013 #define NETLINK_GENL_MNGT_H_ 00014 00015 #include <netlink/netlink.h> 00016 #include <netlink/attr.h> 00017 #include <netlink/list.h> 00018 00019 #ifdef __cplusplus 00020 extern "C" { 00021 #endif 00022 00023 struct nl_cache_ops; 00024 00025 /** 00026 * @ingroup genl_mngt 00027 * Generic Netlink Command 00028 */ 00029 struct genl_cmd 00030 { 00031 /** Unique command identifier */ 00032 int c_id; 00033 00034 /** Name/description of command */ 00035 char * c_name; 00036 00037 /** 00038 * Maximum attribute identifier, must be provided if 00039 * a message parser is available. 00040 */ 00041 int c_maxattr; 00042 00043 int (*c_msg_parser)(struct nl_cache_ops *, 00044 struct genl_cmd *, 00045 struct genl_info *, void *); 00046 00047 /** 00048 * Attribute validation policy (optional) 00049 */ 00050 struct nla_policy * c_attr_policy; 00051 }; 00052 00053 /** 00054 * @ingroup genl_mngt 00055 * Generic Netlink Operations 00056 */ 00057 struct genl_ops 00058 { 00059 int o_family; 00060 int o_id; 00061 char * o_name; 00062 struct nl_cache_ops * o_cache_ops; 00063 struct genl_cmd * o_cmds; 00064 int o_ncmds; 00065 00066 /* linked list of all genl cache operations */ 00067 struct nl_list_head o_list; 00068 }; 00069 00070 00071 extern int genl_register(struct nl_cache_ops *); 00072 extern void genl_unregister(struct nl_cache_ops *); 00073 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif