1/*
2 * netlink/socket.h		Netlink Socket
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-2008 Thomas Graf <tgraf@suug.ch>
10 */
11
12#ifndef NETLINK_SOCKET_H_
13#define NETLINK_SOCKET_H_
14
15#include <netlink/types.h>
16#include <netlink/handlers.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22extern struct nl_sock *	nl_socket_alloc(void);
23extern struct nl_sock *	nl_socket_alloc_cb(struct nl_cb *);
24extern void		nl_socket_free(struct nl_sock *);
25
26extern uint32_t		nl_socket_get_local_port(struct nl_sock *);
27extern void		nl_socket_set_local_port(struct nl_sock *, uint32_t);
28
29extern int		nl_socket_add_memberships(struct nl_sock *, int, ...);
30extern int		nl_socket_add_membership(struct nl_sock *, int);
31extern int		nl_socket_drop_memberships(struct nl_sock *, int, ...);
32extern int		nl_socket_drop_membership(struct nl_sock *,
33							  int);
34extern void		nl_join_groups(struct nl_sock *, int);
35
36
37extern uint32_t		nl_socket_get_peer_port(struct nl_sock *);
38extern void		nl_socket_set_peer_port(struct nl_sock *,
39							uint32_t);
40
41extern struct nl_cb *	nl_socket_get_cb(struct nl_sock *);
42extern void		nl_socket_set_cb(struct nl_sock *,
43						 struct nl_cb *);
44extern int		nl_socket_modify_cb(struct nl_sock *, enum nl_cb_type,
45					    enum nl_cb_kind,
46					    nl_recvmsg_msg_cb_t, void *);
47
48extern int		nl_socket_set_buffer_size(struct nl_sock *, int, int);
49extern int		nl_socket_set_passcred(struct nl_sock *, int);
50extern int		nl_socket_recv_pktinfo(struct nl_sock *, int);
51
52extern void		nl_socket_disable_seq_check(struct nl_sock *);
53extern unsigned int	nl_socket_use_seq(struct nl_sock *);
54extern void		nl_socket_disable_auto_ack(struct nl_sock *);
55extern void		nl_socket_enable_auto_ack(struct nl_sock *);
56
57extern int		nl_socket_get_fd(struct nl_sock *);
58extern int		nl_socket_set_nonblocking(struct nl_sock *);
59extern void		nl_socket_enable_msg_peek(struct nl_sock *);
60extern void		nl_socket_disable_msg_peek(struct nl_sock *);
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif
67