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-2013 Thomas Graf <[email protected]> 4*4dc78e53SAndroid Build Coastguard Worker */ 5*4dc78e53SAndroid Build Coastguard Worker 6*4dc78e53SAndroid Build Coastguard Worker #ifndef NETLINK_NETLINK_H_ 7*4dc78e53SAndroid Build Coastguard Worker #define NETLINK_NETLINK_H_ 8*4dc78e53SAndroid Build Coastguard Worker 9*4dc78e53SAndroid Build Coastguard Worker #include <stdio.h> 10*4dc78e53SAndroid Build Coastguard Worker #include <stdint.h> 11*4dc78e53SAndroid Build Coastguard Worker #include <string.h> 12*4dc78e53SAndroid Build Coastguard Worker #include <stdlib.h> 13*4dc78e53SAndroid Build Coastguard Worker #include <poll.h> 14*4dc78e53SAndroid Build Coastguard Worker #include <sys/socket.h> 15*4dc78e53SAndroid Build Coastguard Worker #include <sys/types.h> 16*4dc78e53SAndroid Build Coastguard Worker #include <sys/time.h> 17*4dc78e53SAndroid Build Coastguard Worker #include <netdb.h> 18*4dc78e53SAndroid Build Coastguard Worker #include <netlink/netlink-compat.h> 19*4dc78e53SAndroid Build Coastguard Worker #include <linux/netlink.h> 20*4dc78e53SAndroid Build Coastguard Worker #include <linux/rtnetlink.h> 21*4dc78e53SAndroid Build Coastguard Worker #include <linux/genetlink.h> 22*4dc78e53SAndroid Build Coastguard Worker #include <linux/netfilter/nfnetlink.h> 23*4dc78e53SAndroid Build Coastguard Worker #include <netinet/tcp.h> 24*4dc78e53SAndroid Build Coastguard Worker #include <netlink/version.h> 25*4dc78e53SAndroid Build Coastguard Worker #include <netlink/errno.h> 26*4dc78e53SAndroid Build Coastguard Worker #include <netlink/types.h> 27*4dc78e53SAndroid Build Coastguard Worker #include <netlink/handlers.h> 28*4dc78e53SAndroid Build Coastguard Worker #include <netlink/socket.h> 29*4dc78e53SAndroid Build Coastguard Worker #include <netlink/object.h> 30*4dc78e53SAndroid Build Coastguard Worker 31*4dc78e53SAndroid Build Coastguard Worker #ifdef __cplusplus 32*4dc78e53SAndroid Build Coastguard Worker extern "C" { 33*4dc78e53SAndroid Build Coastguard Worker #endif 34*4dc78e53SAndroid Build Coastguard Worker 35*4dc78e53SAndroid Build Coastguard Worker struct nlmsghdr; 36*4dc78e53SAndroid Build Coastguard Worker struct ucred; 37*4dc78e53SAndroid Build Coastguard Worker struct nl_cache_ops; 38*4dc78e53SAndroid Build Coastguard Worker struct nl_parser_param; 39*4dc78e53SAndroid Build Coastguard Worker struct nl_object; 40*4dc78e53SAndroid Build Coastguard Worker struct nl_sock; 41*4dc78e53SAndroid Build Coastguard Worker 42*4dc78e53SAndroid Build Coastguard Worker extern int nl_debug; 43*4dc78e53SAndroid Build Coastguard Worker extern struct nl_dump_params nl_debug_dp; 44*4dc78e53SAndroid Build Coastguard Worker 45*4dc78e53SAndroid Build Coastguard Worker /* Connection Management */ 46*4dc78e53SAndroid Build Coastguard Worker extern int nl_connect(struct nl_sock *, int); 47*4dc78e53SAndroid Build Coastguard Worker extern void nl_close(struct nl_sock *); 48*4dc78e53SAndroid Build Coastguard Worker 49*4dc78e53SAndroid Build Coastguard Worker /* Send */ 50*4dc78e53SAndroid Build Coastguard Worker extern int nl_sendto(struct nl_sock *, void *, size_t); 51*4dc78e53SAndroid Build Coastguard Worker extern int nl_sendmsg(struct nl_sock *, struct nl_msg *, 52*4dc78e53SAndroid Build Coastguard Worker struct msghdr *); 53*4dc78e53SAndroid Build Coastguard Worker extern int nl_send(struct nl_sock *, struct nl_msg *); 54*4dc78e53SAndroid Build Coastguard Worker extern int nl_send_iovec(struct nl_sock *, struct nl_msg *, 55*4dc78e53SAndroid Build Coastguard Worker struct iovec *, unsigned); 56*4dc78e53SAndroid Build Coastguard Worker extern void nl_complete_msg(struct nl_sock *, 57*4dc78e53SAndroid Build Coastguard Worker struct nl_msg *); 58*4dc78e53SAndroid Build Coastguard Worker extern void nl_auto_complete(struct nl_sock *, 59*4dc78e53SAndroid Build Coastguard Worker struct nl_msg *); 60*4dc78e53SAndroid Build Coastguard Worker extern int nl_send_auto(struct nl_sock *, struct nl_msg *); 61*4dc78e53SAndroid Build Coastguard Worker extern int nl_send_auto_complete(struct nl_sock *, 62*4dc78e53SAndroid Build Coastguard Worker struct nl_msg *); 63*4dc78e53SAndroid Build Coastguard Worker extern int nl_send_sync(struct nl_sock *, struct nl_msg *); 64*4dc78e53SAndroid Build Coastguard Worker extern int nl_send_simple(struct nl_sock *, int, int, 65*4dc78e53SAndroid Build Coastguard Worker void *, size_t); 66*4dc78e53SAndroid Build Coastguard Worker 67*4dc78e53SAndroid Build Coastguard Worker /* Receive */ 68*4dc78e53SAndroid Build Coastguard Worker extern int nl_recv(struct nl_sock *, 69*4dc78e53SAndroid Build Coastguard Worker struct sockaddr_nl *, unsigned char **, 70*4dc78e53SAndroid Build Coastguard Worker struct ucred **); 71*4dc78e53SAndroid Build Coastguard Worker 72*4dc78e53SAndroid Build Coastguard Worker extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *); 73*4dc78e53SAndroid Build Coastguard Worker extern int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *); 74*4dc78e53SAndroid Build Coastguard Worker 75*4dc78e53SAndroid Build Coastguard Worker extern int nl_recvmsgs_default(struct nl_sock *); 76*4dc78e53SAndroid Build Coastguard Worker 77*4dc78e53SAndroid Build Coastguard Worker extern int nl_wait_for_ack(struct nl_sock *); 78*4dc78e53SAndroid Build Coastguard Worker 79*4dc78e53SAndroid Build Coastguard Worker extern int nl_pickup(struct nl_sock *, 80*4dc78e53SAndroid Build Coastguard Worker int (*parser)(struct nl_cache_ops *, 81*4dc78e53SAndroid Build Coastguard Worker struct sockaddr_nl *, 82*4dc78e53SAndroid Build Coastguard Worker struct nlmsghdr *, 83*4dc78e53SAndroid Build Coastguard Worker struct nl_parser_param *), 84*4dc78e53SAndroid Build Coastguard Worker struct nl_object **); 85*4dc78e53SAndroid Build Coastguard Worker extern int nl_pickup_keep_syserr(struct nl_sock *sk, 86*4dc78e53SAndroid Build Coastguard Worker int (*parser)(struct nl_cache_ops *, struct sockaddr_nl *, 87*4dc78e53SAndroid Build Coastguard Worker struct nlmsghdr *, struct nl_parser_param *), 88*4dc78e53SAndroid Build Coastguard Worker struct nl_object **result, 89*4dc78e53SAndroid Build Coastguard Worker int *syserror); 90*4dc78e53SAndroid Build Coastguard Worker /* Netlink Family Translations */ 91*4dc78e53SAndroid Build Coastguard Worker extern char * nl_nlfamily2str(int, char *, size_t); 92*4dc78e53SAndroid Build Coastguard Worker extern int nl_str2nlfamily(const char *); 93*4dc78e53SAndroid Build Coastguard Worker 94*4dc78e53SAndroid Build Coastguard Worker #ifdef __cplusplus 95*4dc78e53SAndroid Build Coastguard Worker } 96*4dc78e53SAndroid Build Coastguard Worker #endif 97*4dc78e53SAndroid Build Coastguard Worker 98*4dc78e53SAndroid Build Coastguard Worker #endif 99