libnl  1.1
socket.h
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-2006 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
19 extern "C" {
20 #endif
21 
22 extern struct nl_handle * nl_handle_alloc(void);
23 extern struct nl_handle * nl_handle_alloc_cb(struct nl_cb *);
24 extern void nl_handle_destroy(struct nl_handle *);
25 
26 extern uint32_t nl_socket_get_local_port(struct nl_handle *);
27 extern void nl_socket_set_local_port(struct nl_handle *,
28  uint32_t);
29 
30 extern int nl_socket_add_membership(struct nl_handle *,
31  int);
32 extern int nl_socket_drop_membership(struct nl_handle *,
33  int);
34 extern void nl_join_groups(struct nl_handle *, int);
35 
36 extern uint32_t nl_socket_get_peer_port(struct nl_handle *);
37 extern void nl_socket_set_peer_port(struct nl_handle *,
38  uint32_t);
39 
40 extern struct nl_cb * nl_socket_get_cb(struct nl_handle *);
41 extern void nl_socket_set_cb(struct nl_handle *,
42  struct nl_cb *);
43 extern int nl_socket_modify_cb(struct nl_handle *,
44  enum nl_cb_type,
45  enum nl_cb_kind,
47  void *);
48 
49 extern int nl_set_buffer_size(struct nl_handle *,
50  int, int);
51 extern int nl_set_passcred(struct nl_handle *, int);
52 extern int nl_socket_recv_pktinfo(struct nl_handle *, int);
53 
54 extern void nl_disable_sequence_check(struct nl_handle *);
55 extern unsigned int nl_socket_use_seq(struct nl_handle *);
56 
57 extern int nl_socket_get_fd(struct nl_handle *);
58 extern int nl_socket_set_nonblocking(struct nl_handle *);
59 extern void nl_socket_enable_msg_peek(struct nl_handle *);
60 extern void nl_socket_disable_msg_peek(struct nl_handle *);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif
void nl_socket_disable_msg_peek(struct nl_handle *)
Disable use of MSG_PEEK when reading from socket.
Definition: socket.c:460
void nl_disable_sequence_check(struct nl_handle *)
Disable sequence number checking.
Definition: socket.c:267
void nl_handle_destroy(struct nl_handle *)
Destroy netlink handle.
Definition: socket.c:228
void nl_join_groups(struct nl_handle *, int)
Join multicast groups (deprecated)
Definition: socket.c:395
unsigned int nl_socket_use_seq(struct nl_handle *)
Use next sequence number.
Definition: socket.c:282
int nl_set_passcred(struct nl_handle *, int)
Enable/disable credential passing on netlink handle.
Definition: socket.c:555
int nl_socket_recv_pktinfo(struct nl_handle *, int)
Enable/disable receival of additional packet information.
Definition: socket.c:582
int nl_socket_set_nonblocking(struct nl_handle *)
Set file descriptor of socket handle to non-blocking state.
Definition: socket.c:436
nl_cb_kind
Callback kinds.
Definition: handlers.h:75
int(* nl_recvmsg_msg_cb_t)(struct nl_msg *msg, void *arg)
nl_recvmsgs() callback for message processing customization
Definition: handlers.h:40
struct nl_handle * nl_handle_alloc(void)
Allocate new netlink socket handle.
Definition: socket.c:194
int nl_set_buffer_size(struct nl_handle *, int, int)
Set socket buffer size of netlink handle.
Definition: socket.c:520
struct nl_handle * nl_handle_alloc_cb(struct nl_cb *)
Allocate new socket handle with custom callbacks.
Definition: socket.c:216
nl_cb_type
Callback types.
Definition: handlers.h:93
int nl_socket_drop_membership(struct nl_handle *, int)
Leave a group.
Definition: socket.c:370
void nl_socket_set_local_port(struct nl_handle *, uint32_t)
Set local port of socket.
Definition: socket.c:307
int nl_socket_modify_cb(struct nl_handle *, enum nl_cb_type, enum nl_cb_kind, nl_recvmsg_msg_cb_t, void *)
Modify the callback handler associated to the socket.
Definition: socket.c:493
void nl_socket_enable_msg_peek(struct nl_handle *)
Enable use of MSG_PEEK when reading from socket.
Definition: socket.c:451
int nl_socket_add_membership(struct nl_handle *, int)
Join a group.
Definition: socket.c:343