summaryrefslogtreecommitdiffstats
path: root/mmss/event.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'mmss/event.hpp')
-rw-r--r--mmss/event.hpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/mmss/event.hpp b/mmss/event.hpp
index e531c7c..c346781 100644
--- a/mmss/event.hpp
+++ b/mmss/event.hpp
@@ -28,12 +28,13 @@
#include "types.hpp"
+#include <cstring>
#include <memory>
namespace MMSS {
-class event_t {
+class event_t : public nocopy_t {
public:
virtual ~event_t() {}
@@ -41,24 +42,31 @@ public:
};
class packet_t : public event_t {
-public:
- uint64_t sent;
-
+private:
gmrf_addr_t source_addr;
std::weak_ptr<iface_t> dest;
size_t len;
std::unique_ptr<uint8_t[]> data;
+public:
+ packet_t(const gmrf_addr_t *source_addr0, const std::shared_ptr<iface_t> &dest0, const void *data0, size_t len0)
+ : source_addr(*source_addr0), dest(dest0), len(len0), data(new uint8_t[len0]) {
+ std::memcpy(data.get(), data0, len0);
+ }
+
virtual void handle(context_t *mmss);
};
class scheduled_t : public event_t {
-public:
+private:
std::weak_ptr<node_t> node;
gmrf_scheduled_func f;
void *arg;
+public:
+ scheduled_t(const std::shared_ptr<node_t> &node0, gmrf_scheduled_func f0, void *arg0) : node(node0), f(f0), arg(arg0) {}
+
virtual void handle(context_t *mmss);
};