6#ifndef NETLINK_SOCKET_H_
7#define NETLINK_SOCKET_H_
9#include <netlink/types.h>
10#include <netlink/handlers.h>
20extern uint32_t nl_socket_get_local_port(
const struct nl_sock *);
24extern int nl_socket_add_membership(
struct nl_sock *,
int);
26extern int nl_socket_drop_membership(
struct nl_sock *,
31extern uint32_t nl_socket_get_peer_port(
const struct nl_sock *);
32extern void nl_socket_set_peer_port(
struct nl_sock *,
34extern uint32_t nl_socket_get_peer_groups(
const struct nl_sock *sk);
35extern void nl_socket_set_peer_groups(
struct nl_sock *sk, uint32_t groups);
36extern struct nl_cb * nl_socket_get_cb(
const struct nl_sock *);
37extern void nl_socket_set_cb(
struct nl_sock *,
int(* nl_recvmsg_err_cb_t)(struct sockaddr_nl *nla, struct nlmsgerr *nlerr, void *arg)
nl_recvmsgs() callback for error message processing customization
nl_cb_type
Callback types.
int(* nl_recvmsg_msg_cb_t)(struct nl_msg *msg, void *arg)
nl_recvmsgs() callback for message processing customization
nl_cb_kind
Callback kinds.
int nl_socket_get_fd(const struct nl_sock *)
Return the file descriptor of the backing socket.
void nl_socket_set_local_port(struct nl_sock *, uint32_t)
Set local port of socket.
void nl_socket_disable_auto_ack(struct nl_sock *)
Disable automatic request for ACK.
size_t nl_socket_get_msg_buf_size(struct nl_sock *)
Get default message buffer size of netlink socket.
int nl_socket_recv_pktinfo(struct nl_sock *, int)
Enable/disable receival of additional packet information.
int nl_socket_modify_err_cb(struct nl_sock *, enum nl_cb_kind, nl_recvmsg_err_cb_t, void *)
Modify the error callback handler associated with the socket.
void nl_join_groups(struct nl_sock *, int)
Join multicast groups (deprecated)
int nl_socket_set_passcred(struct nl_sock *, int)
Enable/disable credential passing on netlink socket.
int nl_socket_add_memberships(struct nl_sock *, int,...)
Join groups.
void nl_socket_disable_msg_peek(struct nl_sock *)
Disable use of MSG_PEEK when reading from socket.
struct nl_sock * nl_socket_alloc(void)
Allocate new netlink socket.
int nl_socket_set_msg_buf_size(struct nl_sock *, size_t)
Set default message buffer size of netlink socket.
struct nl_sock * nl_socket_alloc_cb(struct nl_cb *)
Allocate new socket with custom callbacks.
int nl_socket_set_nonblocking(const struct nl_sock *)
Set file descriptor of socket to non-blocking state.
void nl_socket_enable_auto_ack(struct nl_sock *)
Enable automatic request for ACK (default)
void nl_socket_enable_msg_peek(struct nl_sock *)
Enable use of MSG_PEEK when reading from socket.
int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
Set the socket file descriptor externally which initializes the socket similar to nl_connect().
unsigned int nl_socket_use_seq(struct nl_sock *)
Use next sequence number.
void nl_socket_disable_seq_check(struct nl_sock *)
Disable sequence number checking.
int nl_socket_set_buffer_size(struct nl_sock *, int, int)
Set socket buffer size of netlink socket.
void nl_socket_free(struct nl_sock *)
Free a netlink socket.
int nl_socket_drop_memberships(struct nl_sock *, int,...)
Leave groups.
int nl_socket_modify_cb(struct nl_sock *, enum nl_cb_type, enum nl_cb_kind, nl_recvmsg_msg_cb_t, void *)
Modify the callback handler associated with the socket.