aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/kinet.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/kinet.c')
-rw-r--r--backends/kinet.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/backends/kinet.c b/backends/kinet.c
new file mode 100644
index 0000000..df259cf
--- /dev/null
+++ b/backends/kinet.c
@@ -0,0 +1,106 @@
+#define BACKEND_NAME "kinet"
+
+/*
+ * This protocol is largely undocumented. As a result,
+ * this backend may in some cases produce unintended
+ * output artifacts.
+ *
+ * Due to lack of consistent access to compliant hardware,
+ * testing is infrequent. If you are able to provide
+ * additional feedback or testing on compatible hardware,
+ * please notify the developers.
+ */
+
+#include <string.h>
+
+#include "libmmbackend.h"
+#include "kinet.h"
+
+#define MAX_FDS 255
+
+static struct {
+ size_t fds;
+ int* fd;
+} global_cfg = {
+ 0
+};
+
+/*
+ * TODO
+ * * detect mode
+ */
+
+MM_PLUGIN_API int init(){
+ backend kinet = {
+ .name = BACKEND_NAME,
+ .conf = kinet_configure,
+ .create = kinet_instance,
+ .conf_instance = kinet_configure_instance,
+ .channel = kinet_channel,
+ .handle = kinet_set,
+ .process = kinet_handle,
+ .start = kinet_start,
+ .shutdown = kinet_shutdown
+ };
+
+ //register backend
+ if(mm_backend_register(kinet)){
+ LOG("Failed to register backend");
+ return 1;
+ }
+ return 0;
+}
+
+static int kinet_configure(char* option, char* value){
+ //TODO
+ return 0;
+}
+
+static int kinet_configure_instance(instance* inst, char* option, char* value){
+ //TODO
+ return 0;
+}
+
+static int kinet_instance(instance* inst){
+ inst->impl = calloc(1, sizeof(kinet_instance_data));
+ if(!inst->impl){
+ LOG("Failed to allocate memory");
+ return 1;
+ }
+
+ return 0;
+}
+
+static channel* kinet_channel(instance* inst, char* spec, uint8_t flags){
+ //TODO
+ return NULL;
+}
+
+static int kinet_set(instance* inst, size_t num, channel** c, channel_value* v){
+ //TODO
+ return 0;
+}
+
+static int kinet_handle(size_t num, managed_fd* fds){
+ //TODO
+ return 0;
+}
+
+static int kinet_start(size_t n, instance** inst){
+ //TODO
+ return 0;
+}
+
+static int kinet_shutdown(size_t n, instance** inst){
+ size_t u;
+ kinet_instance_data* data = NULL;
+
+ for(u = 0; u < n; u++){
+ data = (kinet_instance_data*) inst[u]->impl;
+ free(inst[u]->impl);
+ inst[u]->impl = NULL;
+ }
+
+ LOG("Backend shut down");
+ return 0;
+}