summaryrefslogtreecommitdiffstats
path: root/mmss/iface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mmss/iface.cpp')
-rw-r--r--mmss/iface.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/mmss/iface.cpp b/mmss/iface.cpp
index 7e43dd2..7de4789 100644
--- a/mmss/iface.cpp
+++ b/mmss/iface.cpp
@@ -24,6 +24,8 @@
*/
+#include "iface.hpp"
+#include "node.hpp"
#include "mmss.hpp"
#include <cstring>
@@ -32,25 +34,19 @@
namespace MMSS {
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 = std::make_shared<iface_t>();
-
- iface->name = name;
- iface->address = *address;
-
- iface->node = node.get();
- iface->net = net.get();
+ std::shared_ptr<iface_t> iface = std::make_shared<iface_t>(node.get(), net.get(), name, address);
node->interfaces.push_back(iface);
net->interfaces.push_back(iface);
- node->proto->add_iface(node.get(), node->ctx, iface.get());
+ node->add_iface(iface);
}
void enqueue(context_t *mmss, const std::shared_ptr<iface_t> &source, const std::shared_ptr<iface_t> &dest, const void *data, size_t len) {
std::shared_ptr<packet_t> packet = std::make_shared<packet_t>();
packet->sent = mmss->now();
- packet->source_addr = source->address;
+ packet->source_addr = *source->get_address();
packet->dest = dest;
packet->len = len;