diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 14:18:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 14:18:53 +0000 |
commit | a0e0018c9a7ef5ce7f6d2c3ae16aecbbd16a8f67 (patch) | |
tree | 8feaf1a1932871b139b3b30be4c09c66489918be /tipc/msg.c | |
parent | Initial commit. (diff) | |
download | iproute2-a0e0018c9a7ef5ce7f6d2c3ae16aecbbd16a8f67.tar.xz iproute2-a0e0018c9a7ef5ce7f6d2c3ae16aecbbd16a8f67.zip |
Adding upstream version 6.1.0.upstream/6.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tipc/msg.c')
-rw-r--r-- | tipc/msg.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tipc/msg.c b/tipc/msg.c new file mode 100644 index 0000000..1225691 --- /dev/null +++ b/tipc/msg.c @@ -0,0 +1,52 @@ +/* + * msg.c Messaging (netlink) helper functions. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: Richard Alpe <richard.alpe@ericsson.com> + */ + +#include <stdio.h> +#include <time.h> +#include <errno.h> + +#include <libmnl/libmnl.h> + +#include "mnl_utils.h" +#include "msg.h" + +extern struct mnlu_gen_socket tipc_nlg; + +int parse_attrs(const struct nlattr *attr, void *data) +{ + const struct nlattr **tb = data; + int type = mnl_attr_get_type(attr); + + tb[type] = attr; + + return MNL_CB_OK; +} + +int msg_doit(struct nlmsghdr *nlh, mnl_cb_t callback, void *data) +{ + nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; + return mnlu_gen_socket_sndrcv(&tipc_nlg, nlh, callback, data); +} + +int msg_dumpit(struct nlmsghdr *nlh, mnl_cb_t callback, void *data) +{ + nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; + return mnlu_gen_socket_sndrcv(&tipc_nlg, nlh, callback, data); +} + +struct nlmsghdr *msg_init(int cmd) +{ + struct nlmsghdr *nlh; + + nlh = mnlu_gen_socket_cmd_prepare(&tipc_nlg, cmd, 0); + + return nlh; +} |