blob: b015f8642704a8c4612b23b79d4995219de96548 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* nlsock.h - netlink socket
*
* Declarations of netlink socket structure and related functions.
*/
#ifndef ETHTOOL_NETLINK_NLSOCK_H__
#define ETHTOOL_NETLINK_NLSOCK_H__
#include <libmnl/libmnl.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/ethtool_netlink.h>
#include "msgbuff.h"
struct nl_context;
/**
* struct nl_socket - netlink socket abstraction
* @nlctx: netlink context
* @sk: libmnl socket handle
* @msgbuff: embedded message buffer used by default
* @port: port number for netlink header
* @seq: autoincremented sequence number for netlink header
* @nl_fam: netlink family (e.g. NETLINK_GENERIC or NETLINK_ROUTE)
*/
struct nl_socket {
struct nl_context *nlctx;
struct mnl_socket *sk;
struct nl_msg_buff msgbuff;
unsigned int port;
unsigned int seq;
int nl_fam;
};
int nlsock_init(struct nl_context *nlctx, struct nl_socket **__nlsk,
int nl_fam);
void nlsock_done(struct nl_socket *nlsk);
int nlsock_prep_get_request(struct nl_socket *nlsk, unsigned int nlcmd,
uint16_t hdr_attrtype, u32 flags);
ssize_t nlsock_sendmsg(struct nl_socket *nlsk, struct nl_msg_buff *__msgbuff);
int nlsock_send_get_request(struct nl_socket *nlsk, mnl_cb_t cb);
int nlsock_process_reply(struct nl_socket *nlsk, mnl_cb_t reply_cb, void *data);
#endif /* ETHTOOL_NETLINK_NLSOCK_H__ */
|