summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-18 03:06:20 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-18 03:09:08 +0100
commitcdf537c71c29c05fd3d77637a3731de80019d2be (patch)
tree5a2c5a4efc353f6e04477aa5fdb537963e358622 /include
parent8a8800c818d06fbf7c1dfd16129757a41731dfe5 (diff)
downloadgmrf-cdf537c71c29c05fd3d77637a3731de80019d2be.tar
gmrf-cdf537c71c29c05fd3d77637a3731de80019d2be.zip
Implement protocol module loading
Diffstat (limited to 'include')
-rw-r--r--include/gmrf/gmrf.h5
-rw-r--r--include/mmss/protocol.h40
2 files changed, 45 insertions, 0 deletions
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 <mschiffer@universe-factory.net>
+ 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 <gmrf/gmrf.h>
+
+
+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_ */