From cdf537c71c29c05fd3d77637a3731de80019d2be Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 18 Mar 2013 03:06:20 +0100 Subject: Implement protocol module loading --- include/gmrf/gmrf.h | 5 +++++ include/mmss/protocol.h | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 include/mmss/protocol.h (limited to 'include') diff --git a/include/gmrf/gmrf.h b/include/gmrf/gmrf.h index 22bed35..d2ecdf5 100644 --- a/include/gmrf/gmrf.h +++ b/include/gmrf/gmrf.h @@ -58,6 +58,11 @@ size_t gmrf_iface_get_mtu(gmrf_context_t *ctx, gmrf_iface_t *iface); bool gmrf_iface_send(gmrf_context_t *ctx, gmrf_iface_t *iface, const void *data, size_t len, const gmrf_addr_t *dest); bool gmrf_iface_send_bc(gmrf_context_t *ctx, gmrf_iface_t *iface, const void *data, size_t len); + typedef void (*gmrf_handle_packet_func)(gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len); +typedef struct gmrf_protocol { + gmrf_handle_packet_func handle_packet; +} gmrf_protocol_t; + #endif /* _GMRF_GMRF_H_ */ diff --git a/include/mmss/protocol.h b/include/mmss/protocol.h new file mode 100644 index 0000000..4030ef0 --- /dev/null +++ b/include/mmss/protocol.h @@ -0,0 +1,40 @@ +/* + Copyright (c) 2013, Matthias Schiffer + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#ifndef _GMRF_MMSS_PROTOCOL_H_ +#define _GMRF_MMSS_PROTOCOL_H_ + +#include + + +typedef struct mmss_protocol { + const char *name; + const char *version; + + gmrf_protocol_t* (*init)(gmrf_context_t *ctx); +} mmss_protocol_t; + +#endif /* _GMRF_MMSS_PROTOCOL_H_ */ -- cgit v1.2.3