summaryrefslogtreecommitdiff
path: root/tools/util.h
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2014-04-15 19:32:01 -0400
committerPaul Moore <pmoore@redhat.com>2014-04-16 16:01:32 -0400
commitb850d62fefca24446f1cb5558d7154cee0985431 (patch)
tree96c3c3c5cb193064cfb2511b4c7062dd946671eb /tools/util.h
parent8fd7b920e27a7e6e7681848d31f0495fac42f382 (diff)
downloadlibseccomp-b850d62fefca24446f1cb5558d7154cee0985431.tar.gz
tools: fix problems with non-native byte ordering
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'tools/util.h')
-rw-r--r--tools/util.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/util.h b/tools/util.h
new file mode 100644
index 0000000..72c4cce
--- /dev/null
+++ b/tools/util.h
@@ -0,0 +1,37 @@
+/**
+ * Tool utility functions
+ *
+ * Copyright (c) 2014 Red Hat <pmoore@redhat.com>
+ * Author: Paul Moore <pmoore@redhat.com>
+ */
+
+/*
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of version 2.1 of the GNU Lesser General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This library 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 Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses>.
+ */
+
+#ifndef _UTIL_H
+#define _UTIL_H
+
+#include <inttypes.h>
+
+extern uint32_t arch;
+
+void exit_usage(const char *program);
+
+uint16_t ttoh16(uint32_t arch, uint16_t val);
+uint32_t ttoh32(uint32_t arch, uint32_t val);
+
+uint32_t htot32(uint32_t arch, uint32_t val);
+uint64_t htot64(uint32_t arch, uint64_t val);
+
+#endif