summaryrefslogtreecommitdiff
path: root/src/package.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-07-28 22:01:04 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-07-28 22:01:30 +0200
commit0898066430e0f2908565a1b4588e50de2d41a256 (patch)
tree14cdd602923c0989856faaeaf33352c24c80f440 /src/package.hh
parent6bdda0ebabcd8dc34edfc413de6d0424ccf1f6e6 (diff)
Break out Package read/write
Diffstat (limited to 'src/package.hh')
-rw-r--r--src/package.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/package.hh b/src/package.hh
new file mode 100644
index 0000000..e83271f
--- /dev/null
+++ b/src/package.hh
@@ -0,0 +1,22 @@
+// -*- mode: c++; c-basic-offset: 2; -*-
+
+#ifndef PACKAGE_HH
+#define PACKAGE_HH
+
+#include <cstdint>
+#include <string>
+
+struct Package {
+ uint32_t id;
+ struct timespec timestamp;
+ uint16_t flags;
+ std::string source_host;
+ uint16_t source_port;
+ std::string target_host;
+ uint16_t target_port;
+};
+
+size_t read_package(Package* package, uint8_t const* data, size_t max);
+size_t write_package(Package const& package, uint8_t* data, size_t max);
+
+#endif // PACKAGE_HH