00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NETLINK_LINK_API_H_
00013 #define NETLINK_LINK_API_H_
00014
00015 #include <netlink/netlink.h>
00016
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020
00021
00022
00023
00024
00025
00026 struct rtnl_link_info_ops
00027 {
00028
00029 char * io_name;
00030
00031
00032 int io_refcnt;
00033
00034
00035
00036
00037 int (*io_alloc)(struct rtnl_link *);
00038
00039
00040
00041
00042 int (*io_parse)(struct rtnl_link *,
00043 struct nlattr *,
00044 struct nlattr *);
00045
00046
00047
00048 void (*io_dump[NL_DUMP_MAX+1])(struct rtnl_link *,
00049 struct nl_dump_params *);
00050
00051
00052
00053 int (*io_clone)(struct rtnl_link *, struct rtnl_link *);
00054
00055
00056
00057 int (*io_put_attrs)(struct nl_msg *, struct rtnl_link *);
00058
00059
00060
00061 void (*io_free)(struct rtnl_link *);
00062
00063 struct nl_list_head io_list;
00064 };
00065
00066 extern struct rtnl_link_info_ops *rtnl_link_info_ops_lookup(const char *);
00067 extern void rtnl_link_info_ops_put(struct rtnl_link_info_ops *);
00068 extern int rtnl_link_register_info(struct rtnl_link_info_ops *);
00069 extern int rtnl_link_unregister_info(struct rtnl_link_info_ops *);
00070
00071
00072
00073
00074
00075
00076
00077 struct rtnl_link_af_ops
00078 {
00079
00080 const unsigned int ao_family;
00081
00082
00083 int ao_refcnt;
00084
00085
00086
00087
00088
00089 const struct nla_policy *ao_protinfo_policy;
00090
00091
00092
00093
00094 void * (*ao_alloc)(struct rtnl_link *);
00095
00096
00097
00098 void * (*ao_clone)(struct rtnl_link *, void *);
00099
00100
00101 void (*ao_free)(struct rtnl_link *, void *);
00102
00103
00104
00105 int (*ao_parse_protinfo)(struct rtnl_link *,
00106 struct nlattr *, void *);
00107
00108
00109
00110 int (*ao_parse_af)(struct rtnl_link *,
00111 struct nlattr *, void *);
00112
00113
00114
00115 int (*ao_fill_af)(struct rtnl_link *,
00116 struct nl_msg *msg, void *);
00117
00118
00119 void (*ao_dump[NL_DUMP_MAX+1])(struct rtnl_link *,
00120 struct nl_dump_params *,
00121 void *);
00122 };
00123
00124 extern struct rtnl_link_af_ops *rtnl_link_af_ops_lookup(unsigned int);
00125 extern void rtnl_link_af_ops_put(struct rtnl_link_af_ops *);
00126 extern void * rtnl_link_af_alloc(struct rtnl_link *,
00127 const struct rtnl_link_af_ops *);
00128 extern void * rtnl_link_af_data(const struct rtnl_link *,
00129 const struct rtnl_link_af_ops *);
00130 extern int rtnl_link_af_register(struct rtnl_link_af_ops *);
00131 extern int rtnl_link_af_unregister(struct rtnl_link_af_ops *);
00132
00133
00134 #endif