00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NETLINK_H_
00013 #define NETLINK_H_
00014
00015 #include <stdio.h>
00016 #include <stdint.h>
00017 #include <string.h>
00018 #include <stdlib.h>
00019 #include <sys/types.h>
00020 #include <sys/socket.h>
00021 #include <netlink/types.h>
00022 #include <netlink/netlink-compat.h>
00023 #include <netlink/netlink-kernel.h>
00024 #include <netlink/rtnetlink-kernel.h>
00025 #include <netlink/handlers.h>
00026
00027 extern int nl_debug;
00028
00029 struct nl_handle;
00030
00031
00032 extern struct nl_handle * nl_handle_alloc(void);
00033 extern struct nl_handle * nl_handle_alloc_nondefault(enum nl_cb_kind);
00034 extern void nl_handle_destroy(struct nl_handle *);
00035 extern void nl_join_groups(struct nl_handle *, int);
00036 extern void nl_disable_sequence_check(struct nl_handle *);
00037
00038 extern int nl_join_group(struct nl_handle *, int);
00039 extern int nl_set_passcred(struct nl_handle *, int);
00040
00041
00042 extern pid_t nl_handle_get_pid(struct nl_handle *);
00043 extern void nl_handle_set_pid(struct nl_handle *, pid_t);
00044 extern pid_t nl_handle_get_peer_pid(struct nl_handle *);
00045 extern void nl_handle_set_peer_pid(struct nl_handle *, pid_t);
00046 extern int nl_handle_get_fd(struct nl_handle *);
00047 extern struct sockaddr_nl * nl_handle_get_local_addr(struct nl_handle *);
00048 extern struct sockaddr_nl * nl_handle_get_peer_addr(struct nl_handle *);
00049 extern struct nl_cb * nl_handle_get_cb(struct nl_handle *);
00050
00051
00052 extern int nl_connect(struct nl_handle *, int);
00053 extern void nl_close(struct nl_handle *);
00054
00055
00056 extern int nl_sendto(struct nl_handle *, void *, size_t);
00057 extern int nl_sendmsg(struct nl_handle *, struct nl_msg *,
00058 struct msghdr *);
00059 extern int nl_send(struct nl_handle *, struct nl_msg *);
00060 extern int nl_send_auto_complete(struct nl_handle *,
00061 struct nl_msg *);
00062 extern int nl_send_simple(struct nl_handle *, int, int,
00063 void *, size_t);
00064
00065
00066 extern int nl_recv(struct nl_handle *,
00067 struct sockaddr_nl *, unsigned char **,
00068 struct ucred **);
00069
00070 extern int nl_recvmsgs(struct nl_handle *, struct nl_cb *);
00071 extern int nl_recvmsgs_def(struct nl_handle *);
00072
00073 extern int nl_wait_for_ack(struct nl_handle *);
00074
00075
00076 extern char * nl_nlfamily2str(int, char *, size_t);
00077 extern int nl_str2nlfamily(const char *);
00078
00079 #endif