netlink.h

00001 /*
00002  * netlink/netlink.h            Netlink Interface
00003  *
00004  *      This library is free software; you can redistribute it and/or
00005  *      modify it under the terms of the GNU Lesser General Public
00006  *      License as published by the Free Software Foundation version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
00010  */
00011 
00012 #ifndef NETLINK_NETLINK_H_
00013 #define NETLINK_NETLINK_H_
00014 
00015 #include <stdio.h>
00016 #include <stdint.h>
00017 #include <string.h>
00018 #include <stdlib.h>
00019 #include <sys/poll.h>
00020 #include <sys/socket.h>
00021 #include <sys/types.h>
00022 #include <sys/time.h>
00023 #include <netdb.h>
00024 #include <netlink/netlink-compat.h>
00025 #include <linux/netlink.h>
00026 #include <linux/rtnetlink.h>
00027 #include <linux/genetlink.h>
00028 #include <linux/netfilter/nfnetlink.h>
00029 #include <netlink/version.h>
00030 #include <netlink/errno.h>
00031 #include <netlink/types.h>
00032 #include <netlink/handlers.h>
00033 #include <netlink/socket.h>
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 struct ucred;
00040 
00041 extern int nl_debug;
00042 extern struct nl_dump_params nl_debug_dp;
00043 
00044 /* Connection Management */
00045 extern int                      nl_connect(struct nl_sock *, int);
00046 extern void                     nl_close(struct nl_sock *);
00047 
00048 /* Send */
00049 extern int                      nl_sendto(struct nl_sock *, void *, size_t);
00050 extern int                      nl_sendmsg(struct nl_sock *, struct nl_msg *,
00051                                            struct msghdr *);
00052 extern int                      nl_send(struct nl_sock *, struct nl_msg *);
00053 extern int                      nl_send_iovec(struct nl_sock *, struct nl_msg *,
00054                                               struct iovec *, unsigned);
00055 extern void                     nl_complete_msg(struct nl_sock *,
00056                                                 struct nl_msg *);
00057 extern void                     nl_auto_complete(struct nl_sock *,
00058                                                  struct nl_msg *);
00059 extern int                      nl_send_auto(struct nl_sock *, struct nl_msg *);
00060 extern int                      nl_send_auto_complete(struct nl_sock *,
00061                                                       struct nl_msg *);
00062 extern int                      nl_send_simple(struct nl_sock *, int, int,
00063                                                void *, size_t);
00064 
00065 /* Receive */
00066 extern int                      nl_recv(struct nl_sock *,
00067                                         struct sockaddr_nl *, unsigned char **,
00068                                         struct ucred **);
00069 
00070 extern int                      nl_recvmsgs(struct nl_sock *, struct nl_cb *);
00071 
00072 extern int                      nl_recvmsgs_default(struct nl_sock *);
00073 
00074 extern int                      nl_wait_for_ack(struct nl_sock *);
00075 
00076 /* Netlink Family Translations */
00077 extern char *                   nl_nlfamily2str(int, char *, size_t);
00078 extern int                      nl_str2nlfamily(const char *);
00079 
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083 
00084 #endif