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