| 1 |
/* SPDX-License-Identifier: LGPL-2.1-only */ |
| 2 |
/* |
| 3 |
* Copyright (c) 2003-2008 Thomas Graf <[email protected]> |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef NETLINK_SOCKET_H_ |
| 7 |
#define NETLINK_SOCKET_H_ |
| 8 |
|
| 9 |
#include <netlink/types.h> |
| 10 |
#include <netlink/handlers.h> |
| 11 |
|
| 12 |
#ifdef __cplusplus |
| 13 |
extern "C" { |
| 14 |
#endif |
| 15 |
|
| 16 |
extern struct nl_sock * nl_socket_alloc(void); |
| 17 |
extern struct nl_sock * nl_socket_alloc_cb(struct nl_cb *); |
| 18 |
extern void nl_socket_free(struct nl_sock *); |
| 19 |
|
| 20 |
extern uint32_t nl_socket_get_local_port(const struct nl_sock *); |
| 21 |
extern void nl_socket_set_local_port(struct nl_sock *, uint32_t); |
| 22 |
|
| 23 |
extern int nl_socket_add_memberships(struct nl_sock *, int, ...); |
| 24 |
extern int nl_socket_add_membership(struct nl_sock *, int); |
| 25 |
extern int nl_socket_drop_memberships(struct nl_sock *, int, ...); |
| 26 |
extern int nl_socket_drop_membership(struct nl_sock *, |
| 27 |
int); |
| 28 |
extern void nl_join_groups(struct nl_sock *, int); |
| 29 |
|
| 30 |
|
| 31 |
extern uint32_t nl_socket_get_peer_port(const struct nl_sock *); |
| 32 |
extern void nl_socket_set_peer_port(struct nl_sock *, |
| 33 |
uint32_t); |
| 34 |
extern uint32_t nl_socket_get_peer_groups(const struct nl_sock *sk); |
| 35 |
extern void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups); |
| 36 |
extern struct nl_cb * nl_socket_get_cb(const struct nl_sock *); |
| 37 |
extern void nl_socket_set_cb(struct nl_sock *, |
| 38 |
struct nl_cb *); |
| 39 |
extern int nl_socket_modify_cb(struct nl_sock *, enum nl_cb_type, |
| 40 |
enum nl_cb_kind, |
| 41 |
nl_recvmsg_msg_cb_t, void *); |
| 42 |
extern int nl_socket_modify_err_cb(struct nl_sock *, enum nl_cb_kind, |
| 43 |
nl_recvmsg_err_cb_t, void *); |
| 44 |
|
| 45 |
extern int nl_socket_set_buffer_size(struct nl_sock *, int, int); |
| 46 |
extern int nl_socket_set_msg_buf_size(struct nl_sock *, size_t); |
| 47 |
extern size_t nl_socket_get_msg_buf_size(struct nl_sock *); |
| 48 |
extern int nl_socket_set_passcred(struct nl_sock *, int); |
| 49 |
extern int nl_socket_recv_pktinfo(struct nl_sock *, int); |
| 50 |
|
| 51 |
extern void nl_socket_disable_seq_check(struct nl_sock *); |
| 52 |
extern unsigned int nl_socket_use_seq(struct nl_sock *); |
| 53 |
extern void nl_socket_disable_auto_ack(struct nl_sock *); |
| 54 |
extern void nl_socket_enable_auto_ack(struct nl_sock *); |
| 55 |
|
| 56 |
extern int nl_socket_get_fd(const struct nl_sock *); |
| 57 |
extern int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd); |
| 58 |
extern int nl_socket_set_nonblocking(const struct nl_sock *); |
| 59 |
extern void nl_socket_enable_msg_peek(struct nl_sock *); |
| 60 |
extern void nl_socket_disable_msg_peek(struct nl_sock *); |
| 61 |
|
| 62 |
#ifdef __cplusplus |
| 63 |
} |
| 64 |
#endif |
| 65 |
|
| 66 |
#endif |