libnl: /data/src/libnl/include/netlink/netlink.h Source File

libnl 3.12.0

netlink.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
4 */
5
6#ifndef NETLINK_NETLINK_H_
7#define NETLINK_NETLINK_H_
8
9#include <stdio.h>
10#include <stdint.h>
11#include <string.h>
12#include <stdlib.h>
13#include <poll.h>
14#include <sys/socket.h>
15#include <sys/types.h>
16#include <sys/time.h>
17#include <netdb.h>
18#include <netlink/netlink-compat.h>
19#include <linux/netlink.h>
20#include <linux/rtnetlink.h>
21#include <linux/genetlink.h>
22#include <linux/netfilter/nfnetlink.h>
23#include <netinet/tcp.h>
24#include <netlink/version.h>
25#include <netlink/errno.h>
26#include <netlink/types.h>
27#include <netlink/handlers.h>
28#include <netlink/socket.h>
29#include <netlink/object.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35struct nlmsghdr;
36struct ucred;
37struct nl_cache_ops;
38struct nl_parser_param;
39struct nl_object;
40struct nl_sock;
41
42extern int nl_debug;
43extern struct nl_dump_params nl_debug_dp;
44
45/* Connection Management */
46extern int nl_connect(struct nl_sock *, int);
47extern void nl_close(struct nl_sock *);
48
49/* Send */
50extern int nl_sendto(struct nl_sock *, void *, size_t);
51extern int nl_sendmsg(struct nl_sock *, struct nl_msg *,
52 struct msghdr *);
53extern int nl_send(struct nl_sock *, struct nl_msg *);
54extern int nl_send_iovec(struct nl_sock *, struct nl_msg *,
55 struct iovec *, unsigned);
56extern void nl_complete_msg(struct nl_sock *,
57 struct nl_msg *);
58extern void nl_auto_complete(struct nl_sock *,
59 struct nl_msg *);
60extern int nl_send_auto(struct nl_sock *, struct nl_msg *);
61extern int nl_send_auto_complete(struct nl_sock *,
62 struct nl_msg *);
63extern int nl_send_sync(struct nl_sock *, struct nl_msg *);
64extern int nl_send_simple(struct nl_sock *, int, int,
65 void *, size_t);
66
67/* Receive */
68extern int nl_recv(struct nl_sock *,
69 struct sockaddr_nl *, unsigned char **,
70 struct ucred **);
71
72extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *);
73extern int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *);
74
75extern int nl_recvmsgs_default(struct nl_sock *);
76
77extern int nl_wait_for_ack(struct nl_sock *);
78
79extern int nl_pickup(struct nl_sock *,
80 int (*)(struct nl_cache_ops *,
81 struct sockaddr_nl *,
82 struct nlmsghdr *,
83 struct nl_parser_param *),
84 struct nl_object **);
85extern int nl_pickup_keep_syserr(struct nl_sock *,
86 int (*)(struct nl_cache_ops *,
87 struct sockaddr_nl *,
88 struct nlmsghdr *,
89 struct nl_parser_param *),
90 struct nl_object **,
91 int *);
92
93/* Netlink Family Translations */
94extern char * nl_nlfamily2str(int, char *, size_t);
95extern int nl_str2nlfamily(const char *);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif
nl_send_iovec
int nl_send_iovec(struct nl_sock *, struct nl_msg *, struct iovec *, unsigned)
Transmit Netlink message (taking IO vector)
Definition nl.c:372
nl_send
int nl_send(struct nl_sock *, struct nl_msg *)
Transmit Netlink message.
Definition nl.c:446
nl_recv
int nl_recv(struct nl_sock *, struct sockaddr_nl *, unsigned char **, struct ucred **)
Receive data from netlink socket.
Definition nl.c:657
nl_recvmsgs_default
int nl_recvmsgs_default(struct nl_sock *)
Receive a set of message from a netlink socket using handlers in nl_sock.
Definition nl.c:1096
nl_send_auto
int nl_send_auto(struct nl_sock *, struct nl_msg *)
Finalize and transmit Netlink message.
Definition nl.c:515
nl_complete_msg
void nl_complete_msg(struct nl_sock *, struct nl_msg *)
Finalize Netlink message.
Definition nl.c:480
nl_send_sync
int nl_send_sync(struct nl_sock *, struct nl_msg *)
Finalize and transmit Netlink message and wait for ACK or error message.
Definition nl.c:547
nl_auto_complete
void nl_auto_complete(struct nl_sock *, struct nl_msg *)
Definition nl.c:1242
nl_connect
int nl_connect(struct nl_sock *, int)
Create file descriptor and bind socket.
Definition nl.c:102
nl_recvmsgs_report
int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *)
Receive a set of messages from a netlink socket and report parsed messages.
Definition nl.c:1055
nl_pickup_keep_syserr
int nl_pickup_keep_syserr(struct nl_sock *, int(*)(struct nl_cache_ops *, struct sockaddr_nl *, struct nlmsghdr *, struct nl_parser_param *), struct nl_object **, int *)
Pickup netlink answer, parse is and return object with preserving system error.
Definition nl.c:1198
nl_send_auto_complete
int nl_send_auto_complete(struct nl_sock *, struct nl_msg *)
Definition nl.c:1250
nl_recvmsgs
int nl_recvmsgs(struct nl_sock *, struct nl_cb *)
Receive a set of messages from a netlink socket.
Definition nl.c:1080
nl_pickup
int nl_pickup(struct nl_sock *, int(*)(struct nl_cache_ops *, struct sockaddr_nl *, struct nlmsghdr *, struct nl_parser_param *), struct nl_object **)
Pickup netlink answer, parse is and return object.
Definition nl.c:1181
nl_close
void nl_close(struct nl_sock *)
Close Netlink socket.
Definition nl.c:229
nl_sendmsg
int nl_sendmsg(struct nl_sock *, struct nl_msg *, struct msghdr *)
Transmit Netlink message using sendmsg()
Definition nl.c:326
nl_sendto
int nl_sendto(struct nl_sock *, void *, size_t)
Transmit raw data over Netlink socket.
Definition nl.c:269
nl_wait_for_ack
int nl_wait_for_ack(struct nl_sock *)
Wait for ACK.
Definition nl.c:1115
nl_send_simple
int nl_send_simple(struct nl_sock *, int, int, void *, size_t)
Construct and transmit a Netlink message.
Definition nl.c:579
nl_debug
int nl_debug
Global variable indicating the desired level of debugging output.
Definition utils.c:52
nl_cb
Definition nl-core.h:10
nl_dump_params
Dumping parameters.
Definition types.h:32