diff options
author | Thomas Graf <tgraf@suug.ch> | 2011-04-11 10:34:01 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2011-04-11 10:34:01 (GMT) |
commit | 48d543cfdf49aef75b9898ebea379f2303d3935d (patch) | |
tree | ea0a9aa79176d18d5d94a4e28c7a5d55e6bafefe /include | |
parent | 41fb241b7bb88d10300145778e401ab34e3bf46b (diff) | |
download | libnl-48d543cfdf49aef75b9898ebea379f2303d3935d.zip libnl-48d543cfdf49aef75b9898ebea379f2303d3935d.tar.gz libnl-48d543cfdf49aef75b9898ebea379f2303d3935d.tar.bz2 |
API to issue direct GET requests to the kernel
Provide nl_pickup() to pick up an answer from a netlink request and parse
it using the supplied parser.
Add rtnl_link_get_kernel() which sends an RTM_GETLINK to the kernel to
fetch a single link directly from the kernel. This can be faster than
dumping the whole table, especially if lots of links are configured.
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink/netlink.h | 8 | ||||
-rw-r--r-- | include/netlink/route/link.h | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/netlink/netlink.h b/include/netlink/netlink.h index a13c48f..0768708 100644 --- a/include/netlink/netlink.h +++ b/include/netlink/netlink.h @@ -31,6 +31,8 @@ #include <netlink/types.h> #include <netlink/handlers.h> #include <netlink/socket.h> +#include <netlink/object.h> +#include <netlink/cache-api.h> #ifdef __cplusplus extern "C" { @@ -74,6 +76,12 @@ extern int nl_recvmsgs_default(struct nl_sock *); extern int nl_wait_for_ack(struct nl_sock *); +extern int nl_pickup(struct nl_sock *, + int (*parser)(struct nl_cache_ops *, + struct sockaddr_nl *, + struct nlmsghdr *, + struct nl_parser_param *), + struct nl_object **); /* Netlink Family Translations */ extern char * nl_nlfamily2str(int, char *, size_t); extern int nl_str2nlfamily(const char *); diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h index b9951d6..3790c09 100644 --- a/include/netlink/route/link.h +++ b/include/netlink/route/link.h @@ -105,6 +105,10 @@ extern int rtnl_link_change(struct nl_sock *, struct rtnl_link *, extern int rtnl_link_build_delete_request(const struct rtnl_link *, struct nl_msg **); extern int rtnl_link_delete(struct nl_sock *, const struct rtnl_link *); +extern int rtnl_link_build_get_request(int, const char *, + struct nl_msg **); +extern int rtnl_link_get_kernel(struct nl_sock *, int, const char *, + struct rtnl_link **); /* Name <-> Index Translations */ extern char * rtnl_link_i2name(struct nl_cache *, int, char *, size_t); |