summaryrefslogtreecommitdiffstats
path: root/mmss
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-18 17:13:15 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-18 17:13:15 +0100
commit7d4283f8f54e9836c59d6507d0cfb0464ffb9e74 (patch)
tree7d3df167b95fab4dfcfae9996ccb14c91f0502ac /mmss
parent77199be682daa1797a4518b3958d58c133dd88f2 (diff)
downloadgmrf-7d4283f8f54e9836c59d6507d0cfb0464ffb9e74.tar
gmrf-7d4283f8f54e9836c59d6507d0cfb0464ffb9e74.zip
Add protocol module API library
Diffstat (limited to 'mmss')
-rw-r--r--mmss/mmss.c13
-rw-r--r--mmss/mmss.h2
2 files changed, 12 insertions, 3 deletions
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 {