libnl 1.1.4
netlink.h
1/*
2 * netlink/netlink.h Netlink Interface
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
7 * of the License.
8 *
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
10 */
11
12#ifndef NETLINK_NETLINK_H_
13#define NETLINK_NETLINK_H_
14
15#include <stdio.h>
16#include <stdint.h>
17#include <string.h>
18#include <stdlib.h>
19#include <sys/poll.h>
20#include <sys/socket.h>
21#include <sys/types.h>
22#include <sys/time.h>
23#include <netlink/netlink-compat.h>
24#include <linux/netlink.h>
25#include <linux/rtnetlink.h>
26#include <linux/genetlink.h>
27#include <linux/netfilter/nfnetlink.h>
28#include <netlink/types.h>
29#include <netlink/handlers.h>
30#include <netlink/socket.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36extern int nl_debug;
37extern struct nl_dump_params nl_debug_dp;
38
39/* Connection Management */
40extern int nl_connect(struct nl_handle *, int);
41extern void nl_close(struct nl_handle *);
42
43/* Send */
44extern int nl_sendto(struct nl_handle *, void *, size_t);
45extern int nl_sendmsg(struct nl_handle *, struct nl_msg *,
46 struct msghdr *);
47extern int nl_send(struct nl_handle *, struct nl_msg *);
48extern int nl_send_auto_complete(struct nl_handle *,
49 struct nl_msg *);
50extern int nl_send_simple(struct nl_handle *, int, int,
51 void *, size_t);
52
53/* Receive */
54extern int nl_recv(struct nl_handle *,
55 struct sockaddr_nl *, unsigned char **,
56 struct ucred **);
57
58extern int nl_recvmsgs(struct nl_handle *, struct nl_cb *);
59
60#define nl_recvmsgs_def(handle) nl_recvmsgs_default(handle)
61extern int nl_recvmsgs_default(struct nl_handle *);
62
63extern int nl_wait_for_ack(struct nl_handle *);
64
65/* Netlink Family Translations */
66extern char * nl_nlfamily2str(int, char *, size_t);
67extern int nl_str2nlfamily(const char *);
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif
int nl_send_auto_complete(struct nl_handle *, struct nl_msg *)
Send netlink message and check & extend header values as needed.
Definition: nl.c:373
int nl_recv(struct nl_handle *, struct sockaddr_nl *, unsigned char **, struct ucred **)
Receive data from netlink socket.
Definition: nl.c:460
int nl_recvmsgs(struct nl_handle *, struct nl_cb *)
Receive a set of messages from a netlink socket.
Definition: nl.c:768
void nl_close(struct nl_handle *)
Close/Disconnect netlink socket.
Definition: nl.c:247
int nl_sendto(struct nl_handle *, void *, size_t)
Send raw data over netlink socket.
Definition: nl.c:271
int nl_send(struct nl_handle *, struct nl_msg *)
Send netlink message.
Definition: nl.c:325
int nl_connect(struct nl_handle *, int)
Create and connect netlink socket.
Definition: nl.c:191
int nl_send_simple(struct nl_handle *, int, int, void *, size_t)
Send simple netlink message using nl_send_auto_complete()
Definition: nl.c:410
int nl_wait_for_ack(struct nl_handle *)
Wait for ACK.
Definition: nl.c:801
int nl_recvmsgs_default(struct nl_handle *)
Receive a set of message from a netlink socket using handlers in nl_handle.
Definition: nl.c:782
int nl_sendmsg(struct nl_handle *, struct nl_msg *, struct msghdr *)
Send netlink message with control over sendmsg() message header.
Definition: nl.c:290
int nl_debug
Debug level.
Definition: utils.c:25
Dumping parameters.
Definition: types.h:37
Netlink socket address.
Definition: netlink-kernel.h:9