Root/package/libnl-tiny/src/include/netlink/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 <netdb.h>
24#include <netlink/netlink-compat.h>
25#include <linux/netlink.h>
26#include <linux/genetlink.h>
27#include <netlink/version.h>
28#include <netlink/errno.h>
29#include <netlink/types.h>
30#include <netlink/handlers.h>
31#include <netlink/socket.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37extern int nl_debug;
38extern struct nl_dump_params nl_debug_dp;
39
40/* Connection Management */
41extern int nl_connect(struct nl_sock *, int);
42extern void nl_close(struct nl_sock *);
43
44/* Send */
45extern int nl_sendto(struct nl_sock *, void *, size_t);
46extern int nl_sendmsg(struct nl_sock *, struct nl_msg *,
47                       struct msghdr *);
48extern int nl_send(struct nl_sock *, struct nl_msg *);
49extern int nl_send_auto_complete(struct nl_sock *,
50                              struct nl_msg *);
51extern int nl_send_simple(struct nl_sock *, int, int,
52                           void *, size_t);
53
54/* Receive */
55extern int nl_recv(struct nl_sock *,
56                    struct sockaddr_nl *, unsigned char **,
57                    struct ucred **);
58extern int nl_recvmsgs(struct nl_sock *sk, struct nl_cb *cb);
59
60extern int nl_wait_for_ack(struct nl_sock *);
61
62/* Netlink Family Translations */
63extern char * nl_nlfamily2str(int, char *, size_t);
64extern int nl_str2nlfamily(const char *);
65
66/**
67 * Receive a set of message from a netlink socket using handlers in nl_sock.
68 * @arg sk Netlink socket.
69 *
70 * Calls nl_recvmsgs() with the handlers configured in the netlink socket.
71 */
72static inline int nl_recvmsgs_default(struct nl_sock *sk)
73{
74    return nl_recvmsgs(sk, sk->s_cb);
75}
76
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif
83

Archive Download this file



interactive