diff options
Diffstat (limited to 'mmss/iface.c')
-rw-r--r-- | mmss/iface.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mmss/iface.c b/mmss/iface.c index b175fa7..47a2877 100644 --- a/mmss/iface.c +++ b/mmss/iface.c @@ -33,6 +33,10 @@ gmrf_addr_t gmrf_iface_get_addr(gmrf_t *gmrf, gmrf_iface_t *iface) { return iface->address; } +const char* gmrf_iface_get_name(gmrf_t *gmrf, gmrf_iface_t *iface) { + return iface->name; +} + size_t gmrf_iface_get_mtu(gmrf_t *gmrf, gmrf_iface_t *iface) { return iface->net->mtu; } @@ -74,3 +78,21 @@ void mmss_dispatch(mmss_packet_t *packet) { &packet->source->address, packet->data, packet->len); free(packet); } + +void mmss_add_iface(gmrf_t *node, mmss_network_t *net, const char *name, const gmrf_addr_t *address) { + gmrf_iface_t *iface = calloc(1, sizeof(gmrf_iface_t)); + + iface->name = strdup(name); + iface->address = *address; + + iface->node = node; + iface->net = net; + + iface->node_next = node->interfaces; + node->interfaces = iface; + + iface->network_next = net->interfaces; + net->interfaces = iface; + + node->proto->add_iface(node, node->ctx, iface); +} |