summaryrefslogtreecommitdiffstats
path: root/mmss/iface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mmss/iface.cpp')
-rw-r--r--mmss/iface.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/mmss/iface.cpp b/mmss/iface.cpp
index 38808f1..7e43dd2 100644
--- a/mmss/iface.cpp
+++ b/mmss/iface.cpp
@@ -31,19 +31,8 @@
namespace MMSS {
-void dispatch(const std::shared_ptr<packet_t> &packet) {
- auto source = packet->source.lock();
- auto dest = packet->dest.lock();
- if (!source || !dest)
- return;
-
- node_t *node = dest->node;
-
- node->proto->handle_packet(node, node->ctx, dest.get(), &source->address, packet->data.get(), packet->len);
-}
-
void add_iface(const std::shared_ptr<node_t> &node, const std::shared_ptr<network_t> &net, const std::string &name, const gmrf_addr_t *address) {
- std::shared_ptr<iface_t> iface = iface_t::create();
+ std::shared_ptr<iface_t> iface = std::make_shared<iface_t>();
iface->name = name;
iface->address = *address;
@@ -61,14 +50,14 @@ void enqueue(context_t *mmss, const std::shared_ptr<iface_t> &source, const std:
std::shared_ptr<packet_t> packet = std::make_shared<packet_t>();
packet->sent = mmss->now();
- packet->source = source;
+ packet->source_addr = source->address;
packet->dest = dest;
packet->len = len;
packet->data.reset(new uint8_t[len]);
std::memcpy(packet->data.get(), data, len);
- mmss->packet_queue.put(std::move(packet), mmss->now()+1);
+ mmss->event_queue.put(std::move(packet), mmss->now()+1);
}
}