summaryrefslogtreecommitdiffstats
path: root/include/ulogd
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-02-02 21:30:11 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-02-02 21:30:11 +0000
commit07574b85dacc4e7dd19c3c04aad96ac7f57dd7e8 (patch)
treefbaf8195ba02eeb7e5096b557bb4ca1ef8d7bee0 /include/ulogd
parent8ed6ebbf949a6d304e92a999913159ae89757979 (diff)
Holger Heitzenberger <heitzenberger@astaro.com>:
add common.h
Diffstat (limited to 'include/ulogd')
-rw-r--r--include/ulogd/Makefile.am2
-rw-r--r--include/ulogd/common.h48
2 files changed, 49 insertions, 1 deletions
diff --git a/include/ulogd/Makefile.am b/include/ulogd/Makefile.am
index 2a3a03d..e935cbd 100644
--- a/include/ulogd/Makefile.am
+++ b/include/ulogd/Makefile.am
@@ -1,2 +1,2 @@
-noinst_HEADERS = conffile.h db.h ipfix_protocol.h linuxlist.h ulogd.h printpkt.h printflow.h
+noinst_HEADERS = conffile.h db.h ipfix_protocol.h linuxlist.h ulogd.h printpkt.h printflow.h common.h
diff --git a/include/ulogd/common.h b/include/ulogd/common.h
new file mode 100644
index 0000000..2f39506
--- /dev/null
+++ b/include/ulogd/common.h
@@ -0,0 +1,48 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Holger Eitzenberger <holger@eitzenberger.org> Astaro AG 2008
+ */
+#ifndef COMMON_H
+#define COMMON_H
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#define min(x, y) ({ \
+ typeof(x) _x = (x); typeof(y) _y = (y); \
+ _x < _y ? _x : _y; })
+#define max(x, y) ({ \
+ typeof(x) _x = (x); typeof(y) _y = (y); \
+ _x > _y ? _x : _y; })
+
+#define SEC * 1
+#define MIN * 60 SEC
+#define HOUR * 60 MIN
+#define DAY * 24 HOUR
+
+#define __unused __attribute__((unused))
+#define __fmt_printf(i, first) __attribute__((format (printtf,(i),(f))))
+
+#ifdef DEBUG
+#define pr_debug(fmt, ...) ulogd_log(ULOGD_DEBUG, fmt, ## __VA_ARGS__)
+#else
+#define pr_debug(fmt, ...)
+#endif /* DEBUG */
+
+#endif /* COMMON_H */