From 1cfe3cf24db29bd9274c2e59587cc0960e9db47c Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 16 Oct 2011 17:50:55 +0200 Subject: intial import of libnetfilter_acct --- include/Makefile.am | 1 + include/libnetfilter_acct/libnetfilter_acct.h | 19 +++++++++++++++ include/linux/netfilter/Makefile.am | 1 + include/linux/netfilter/nfnetlink_acct.h | 35 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 include/Makefile.am create mode 100644 include/libnetfilter_acct/libnetfilter_acct.h create mode 100644 include/linux/netfilter/Makefile.am create mode 100644 include/linux/netfilter/nfnetlink_acct.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..9760a52 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = libnetfilter_acct linux diff --git a/include/libnetfilter_acct/libnetfilter_acct.h b/include/libnetfilter_acct/libnetfilter_acct.h new file mode 100644 index 0000000..5a162b3 --- /dev/null +++ b/include/libnetfilter_acct/libnetfilter_acct.h @@ -0,0 +1,19 @@ +#ifndef _LIBNETFILTER_ACCT_H_ +#define _LIBNETFILTER_ACCT_H_ + +#include +#include + +struct nfacct { + char name[NFACCT_NAME_MAX]; + uint64_t pkts; + uint64_t bytes; +}; + +struct nlmsghdr *nfacct_add(char *buf, struct nfacct *nfacct); +struct nlmsghdr *nfacct_list(char *buf); +int nfacct_list_cb(const struct nlmsghdr *nlh, void *data); +struct nlmsghdr *nfacct_flush(char *buf); +struct nlmsghdr *nfacct_delete(char *buf, const char *filter_name); + +#endif diff --git a/include/linux/netfilter/Makefile.am b/include/linux/netfilter/Makefile.am new file mode 100644 index 0000000..05c1924 --- /dev/null +++ b/include/linux/netfilter/Makefile.am @@ -0,0 +1 @@ +noinst_HEADERS = nfnetlink_acct.h diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h new file mode 100644 index 0000000..99c68eb --- /dev/null +++ b/include/linux/netfilter/nfnetlink_acct.h @@ -0,0 +1,35 @@ +#ifndef _NFNL_ACCT_H_ +#define _NFNL_ACCT_H_ +#include + +/* FIXME: tweak to get it working with external headers. */ +#define NFNL_SUBSYS_ACCT NFNL_SUBSYS_OSF + +#define NFACCT_NAME_MAX 64 + +enum nfnl_acct_msg_types { + NFNL_MSG_ACCT_NEW, + NFNL_MSG_ACCT_GET, + NFNL_MSG_ACCT_DEL, + NFNL_MSG_ACCT_MAX +}; + +enum nfnl_acct_type { + NFACCT_UNSPEC, + NFACCT_NAME, + NFACCT_PKTS, + NFACCT_BYTES, + __NFACCT_MAX +}; +#define NFACCT_MAX (__NFACCT_MAX - 1) + +#ifdef __KERNEL__ + +struct nf_acct; + +extern struct nf_acct *nfnl_acct_find_get(char *filter_name); +extern void nfnl_acct_put(struct nf_acct *acct); + +#endif /* __KERNEL__ */ + +#endif /* _NFNL_ACCT_H */ -- cgit v1.2.3