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 --- include/gmrf/gmrf.h | 8 ++++++-- include/mmss/protocol.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/gmrf/gmrf.h b/include/gmrf/gmrf.h index 3634b29..f6cf9c4 100644 --- a/include/gmrf/gmrf.h +++ b/include/gmrf/gmrf.h @@ -59,7 +59,11 @@ size_t gmrf_iface_get_mtu(gmrf_t *gmrf, gmrf_iface_t *iface); bool gmrf_iface_send(gmrf_t *gmrf, gmrf_iface_t *iface, const void *data, size_t len, const gmrf_addr_t *dest); bool gmrf_iface_send_bc(gmrf_t *gmrf, gmrf_iface_t *iface, const void *data, size_t len); -gmrf_context_t* gmrf_init(gmrf_t *gmrf); -void gmrf_handle_packet(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len); +/* implemented by protocol */ +extern const char *gmrf_protocol_name; +extern const char *gmrf_protocol_version; + +gmrf_context_t* gmrf_protocol_init(gmrf_t *gmrf); +void gmrf_protocol_handle_packet(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len); #endif /* _GMRF_GMRF_H_ */ diff --git a/include/mmss/protocol.h b/include/mmss/protocol.h index 502a923..7d131d2 100644 --- a/include/mmss/protocol.h +++ b/include/mmss/protocol.h @@ -31,8 +31,8 @@ typedef struct mmss_protocol { - const char *name; - const char *version; + const char* (*get_name)(void); + const char* (*get_version)(void); gmrf_context_t* (*init)(gmrf_t *gmrf); void (*handle_packet)(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len); -- cgit v1.2.3