2020-11-13 06:24:41 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __MNL_UTILS_H__
|
|
|
|
#define __MNL_UTILS_H__ 1
|
|
|
|
|
2021-02-11 02:34:43 +08:00
|
|
|
struct mnlu_gen_socket {
|
|
|
|
struct mnl_socket *nl;
|
|
|
|
char *buf;
|
|
|
|
uint32_t family;
|
2022-08-27 02:17:41 +08:00
|
|
|
uint32_t maxattr;
|
2021-02-11 02:34:43 +08:00
|
|
|
unsigned int seq;
|
|
|
|
uint8_t version;
|
|
|
|
};
|
|
|
|
|
|
|
|
int mnlu_gen_socket_open(struct mnlu_gen_socket *nlg, const char *family_name,
|
|
|
|
uint8_t version);
|
|
|
|
void mnlu_gen_socket_close(struct mnlu_gen_socket *nlg);
|
2021-03-01 18:56:52 +08:00
|
|
|
struct nlmsghdr *
|
|
|
|
_mnlu_gen_socket_cmd_prepare(struct mnlu_gen_socket *nlg,
|
|
|
|
uint8_t cmd, uint16_t flags,
|
|
|
|
uint32_t id, uint8_t version);
|
2021-02-11 02:34:43 +08:00
|
|
|
struct nlmsghdr *mnlu_gen_socket_cmd_prepare(struct mnlu_gen_socket *nlg,
|
|
|
|
uint8_t cmd, uint16_t flags);
|
|
|
|
int mnlu_gen_socket_sndrcv(struct mnlu_gen_socket *nlg, const struct nlmsghdr *nlh,
|
|
|
|
mnl_cb_t data_cb, void *data);
|
|
|
|
|
2020-11-13 06:24:41 +08:00
|
|
|
struct mnl_socket *mnlu_socket_open(int bus);
|
2020-11-13 06:24:42 +08:00
|
|
|
struct nlmsghdr *mnlu_msg_prepare(void *buf, uint32_t nlmsg_type, uint16_t flags,
|
|
|
|
void *extra_header, size_t extra_header_size);
|
2020-11-13 06:24:43 +08:00
|
|
|
int mnlu_socket_recv_run(struct mnl_socket *nl, unsigned int seq, void *buf, size_t buf_size,
|
|
|
|
mnl_cb_t cb, void *data);
|
2021-03-01 18:56:52 +08:00
|
|
|
int mnlu_gen_socket_recv_run(struct mnlu_gen_socket *nlg, mnl_cb_t cb,
|
|
|
|
void *data);
|
2020-11-13 06:24:41 +08:00
|
|
|
|
|
|
|
#endif /* __MNL_UTILS_H__ */
|