]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - include/libnetlink.h
libnetlink: Convert GETMDB dumps to use rtnl_mdbdump_req
[mirror_iproute2.git] / include / libnetlink.h
index 751ebf186dd41d7a008449ecb2d1ed7e662333f4..8f2b2935074a3329d27d16c1f1d3acd0a49fafd4 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __LIBNETLINK_H__
 #define __LIBNETLINK_H__ 1
 
@@ -21,9 +22,20 @@ struct rtnl_handle {
        int                     proto;
        FILE                   *dump_fp;
 #define RTNL_HANDLE_F_LISTEN_ALL_NSID          0x01
+#define RTNL_HANDLE_F_SUPPRESS_NLERR           0x02
        int                     flags;
 };
 
+struct nlmsg_list {
+       struct nlmsg_list *next;
+       struct nlmsghdr   h;
+};
+
+struct nlmsg_chain {
+       struct nlmsg_list *head;
+       struct nlmsg_list *tail;
+};
+
 extern int rcvbuf;
 
 int rtnl_open(struct rtnl_handle *rth, unsigned int subscriptions)
@@ -34,6 +46,16 @@ int rtnl_open_byproto(struct rtnl_handle *rth, unsigned int subscriptions,
        __attribute__((warn_unused_result));
 
 void rtnl_close(struct rtnl_handle *rth);
+
+int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
+       __attribute__((warn_unused_result));
+int rtnl_addrlbldump_req(struct rtnl_handle *rth, int family)
+       __attribute__((warn_unused_result));
+int rtnl_routedump_req(struct rtnl_handle *rth, int family)
+       __attribute__((warn_unused_result));
+int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
+       __attribute__((warn_unused_result));
+
 int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
        __attribute__((warn_unused_result));
 int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
@@ -65,6 +87,9 @@ typedef int (*rtnl_listen_filter_t)(const struct sockaddr_nl *,
                                    struct rtnl_ctrl_data *,
                                    struct nlmsghdr *n, void *);
 
+typedef int (*nl_ext_ack_fn_t)(const char *errmsg, uint32_t off,
+                              const struct nlmsghdr *inner_nlh);
+
 struct rtnl_dump_filter_arg {
        rtnl_filter_t filter;
        void *arg1;
@@ -79,12 +104,22 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth,
 #define rtnl_dump_filter(rth, filter, arg) \
        rtnl_dump_filter_nc(rth, filter, arg, 0)
 int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
-             struct nlmsghdr *answer, size_t len)
+             struct nlmsghdr **answer)
+       __attribute__((warn_unused_result));
+int rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iovec, size_t iovlen,
+                 struct nlmsghdr **answer)
+       __attribute__((warn_unused_result));
+int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n,
+             struct nlmsghdr **answer, nl_ext_ack_fn_t errfn)
+       __attribute__((warn_unused_result));
+int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n,
+                                  struct nlmsghdr **answer)
        __attribute__((warn_unused_result));
 int rtnl_send(struct rtnl_handle *rth, const void *buf, int)
        __attribute__((warn_unused_result));
 int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int)
        __attribute__((warn_unused_result));
+int nl_dump_ext_ack(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn);
 
 int addattr(struct nlmsghdr *n, int maxlen, int type);
 int addattr8(struct nlmsghdr *n, int maxlen, int type, __u8 data);