2 * netlink/route/link/info-api.h Link Info API
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
9 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
12 #ifndef NETLINK_LINK_INFO_API_H_
13 #define NETLINK_LINK_INFO_API_H_
15 #include <netlink/netlink.h>
24 * Link info operations
26 struct rtnl_link_info_ops
28 /** Name of operations, must match name on kernel side */
31 /** Reference count (internal, do not use) */
34 /** Called to assign an info type to a link.
35 * Has to allocate enough resources to hold attributes. Can
36 * use link->l_info to store a pointer. */
37 int (*io_alloc)(struct rtnl_link *);
39 /** Called to parse the link info attribute.
40 * Must parse the attribute and assign all values to the link.
42 int (*io_parse)(struct rtnl_link *,
46 /** Called when the link object is dumped.
47 * Must dump the info type specific attributes. */
48 void (*io_dump[NL_DUMP_MAX+1])(struct rtnl_link *,
49 struct nl_dump_params *);
51 /** Called when a link object is cloned.
52 * Must clone all info type specific attributes. */
53 int (*io_clone)(struct rtnl_link *, struct rtnl_link *);
55 /** Called when construction a link netlink message.
56 * Must append all info type specific attributes to the message. */
57 int (*io_put_attrs)(struct nl_msg *, struct rtnl_link *);
59 /** Called to release all resources previously allocated
60 * in either io_alloc() or io_parse(). */
61 void (*io_free)(struct rtnl_link *);
63 struct rtnl_link_info_ops * io_next;
66 extern struct rtnl_link_info_ops *rtnl_link_info_ops_lookup(const char *);
68 extern int rtnl_link_register_info(struct rtnl_link_info_ops *);
69 extern int rtnl_link_unregister_info(struct rtnl_link_info_ops *);