Re-import of fprobe-ulog
[fprobe-ulog.git] / src / libipulog / include / libipulog / libipulog.h
1 #ifndef _LIBIPULOG_H
2 #define _LIBIPULOG_H
3
4 /* $Id: libipulog.h,v 1.1.2.1 2004/08/13 21:03:11 sla Exp $ */
5
6 #include <errno.h>
7 #include <unistd.h>
8 #include <fcntl.h>
9 #include <sys/types.h>
10 #include <sys/socket.h>
11 #include <sys/uio.h>
12 #include <asm/types.h>
13 #include <linux/netlink.h>
14 #include <net/if.h>
15 #include <linux/netfilter_ipv4/ipt_ULOG.h>
16
17 /* FIXME: glibc sucks */
18 #ifndef MSG_TRUNC 
19 #define MSG_TRUNC       0x20
20 #endif
21
22 struct ipulog_handle;
23 extern int ipulog_errno;
24
25 u_int32_t ipulog_group2gmask(u_int32_t group);
26
27 struct ipulog_handle *ipulog_create_handle(u_int32_t gmask, u_int32_t rmem);
28
29 void ipulog_destroy_handle(struct ipulog_handle *h);
30
31 ssize_t ipulog_read(struct ipulog_handle *h,
32                     unsigned char *buf, size_t len, int timeout);
33
34 ulog_packet_msg_t *ipulog_get_packet(struct ipulog_handle *h,
35                                      const unsigned char *buf,
36                                      size_t len);
37
38 char *ipulog_strerror(int errcode);
39
40 void ipulog_perror(const char *s);
41
42 enum 
43 {
44         IPULOG_ERR_NONE = 0,
45         IPULOG_ERR_IMPL,
46         IPULOG_ERR_HANDLE,
47         IPULOG_ERR_SOCKET,
48         IPULOG_ERR_BIND,
49         IPULOG_ERR_RECVBUF,
50         IPULOG_ERR_RECV,
51         IPULOG_ERR_NLEOF,
52         IPULOG_ERR_TRUNC,
53         IPULOG_ERR_INVGR,
54         IPULOG_ERR_INVNL,
55 };
56 #define IPULOG_MAXERR IPULOG_ERR_INVNL
57
58 #endif /* _LIBULOG_H */