From 7d4283f8f54e9836c59d6507d0cfb0464ffb9e74 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 18 Mar 2013 17:13:15 +0100 Subject: Add protocol module API library --- mmss/mmss.c | 13 +++++++++++-- mmss/mmss.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'mmss') diff --git a/mmss/mmss.c b/mmss/mmss.c index abb4835..ae87afb 100644 --- a/mmss/mmss.c +++ b/mmss/mmss.c @@ -39,11 +39,20 @@ static void init_nodes(gmrf_t *nodes) { } -int main() { +int main(int argc, char *argv[]) { + if (argc != 2) { + fprintf(stderr, "usage: %s protocol_module\n", argv[0]); + return 1; + } + + const mmss_protocol_t *proto = mmss_load_protocol(argv[1]); + if (!proto) + return 1; + mmss_t mmss = { .now = 0 }; mmss_network_t net = { .mtu = 1500 }; - gmrf_t node1 = { .mmss = &mmss }, node2 = { .mmss = &mmss }; + gmrf_t node1 = { .mmss = &mmss, .proto = proto }, node2 = { .mmss = &mmss, .proto = proto }; gmrf_iface_t iface1 = {}, iface2 = {}; iface1.net = &net; diff --git a/mmss/mmss.h b/mmss/mmss.h index e8b8f32..55e86d5 100644 --- a/mmss/mmss.h +++ b/mmss/mmss.h @@ -64,7 +64,7 @@ struct gmrf { gmrf_context_t *ctx; gmrf_iface_t *interfaces; - mmss_protocol_t *proto; + const mmss_protocol_t *proto; }; struct gmrf_iface { -- cgit v1.2.3