jsoninfo: move code from olsr_jsoninfo into olsr_plugin
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 10:54:22 +0000 (11:54 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 19:54:15 +0000 (20:54 +0100)
To make it more compact

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/jsoninfo/src/olsrd_jsoninfo.c [deleted file]
lib/jsoninfo/src/olsrd_plugin.c
lib/jsoninfo/src/olsrd_plugin.h [moved from lib/jsoninfo/src/olsrd_jsoninfo.h with 100% similarity]

diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c b/lib/jsoninfo/src/olsrd_jsoninfo.c
deleted file mode 100644 (file)
index f0acfff..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of olsr.org, olsrd nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- * 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 OWNER 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.
- *
- * Visit http://www.olsr.org for more information.
- *
- * If you find this software useful feel free to make a donation
- * to the project. For more information see the website or contact
- * the copyright holders.
- *
- */
-
-/*
- * Dynamic linked library for the olsr.org olsr daemon
- */
-
-#include "olsrd_jsoninfo.h"
-#include "jsoninfo_printers.h"
-#include "../../info/olsrd_info.h"
-
-#define PLUGIN_NAME "JSONINFO"
-
-static printer_functions_t printer_functions = { //
-    //
-        .init = &plugin_init, //
-        .is_command = &isCommand, //
-        .determine_mime_type = &determine_mime_type, //
-        .output_start = &output_start, //
-        .output_end = &output_end, //
-        .neighbors = &ipc_print_neighbors, //
-        .links = &ipc_print_links, //
-        .routes = &ipc_print_routes, //
-        .topology = &ipc_print_topology, //
-        .hna = &ipc_print_hna, //
-        .mid = &ipc_print_mid, //
-        .gateways = &ipc_print_gateways, //
-        .sgw = &ipc_print_sgw, //
-        .version = &ipc_print_version, //
-        .olsrd_conf = &ipc_print_olsrd_conf, //
-        .interfaces = &ipc_print_interfaces, //
-        .config = &ipc_print_config, //
-        .plugins = &ipc_print_plugins //
-    };
-
-/**
- *Do initialization here
- *
- *This function is called by the my_init
- *function in uolsrd_plugin.c
- */
-int olsrd_plugin_init(void) {
-  return info_plugin_init(PLUGIN_NAME, &printer_functions, &info_plugin_config);
-}
-
-/**
- * destructor - called at unload
- */
-void olsr_plugin_exit(void) {
-  info_plugin_exit();
-}
-
-/*
- * Local Variables:
- * mode: c
- * style: linux
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * End:
- */
index 7794a0c..fffdfe2 100644 (file)
  * Dynamic linked library for the olsr.org olsr daemon
  */
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-
 #include "olsrd_plugin.h"
-#include "olsrd_jsoninfo.h"
-#include "defs.h"
-#include "../../info/info_types.h"
+#include "../../info/olsrd_info.h"
+#include "jsoninfo_printers.h"
 
-#define PLUGIN_NAME    "OLSRD jsoninfo plugin"
+#define PLUGIN_NAME "JSONINFO"
+#define PLUGIN_TITLE    "OLSRD jsoninfo plugin"
 #define PLUGIN_VERSION "0.0"
 #define PLUGIN_AUTHOR   "Hans-Christoph Steiner"
-#define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR
+#define MOD_DESC PLUGIN_TITLE " " PLUGIN_VERSION " by " PLUGIN_AUTHOR
 #define PLUGIN_INTERFACE_VERSION 5
 
+static printer_functions_t printer_functions = { //
+    //
+        .init = &plugin_init, //
+        .is_command = &isCommand, //
+        .determine_mime_type = &determine_mime_type, //
+        .output_start = &output_start, //
+        .output_end = &output_end, //
+        .neighbors = &ipc_print_neighbors, //
+        .links = &ipc_print_links, //
+        .routes = &ipc_print_routes, //
+        .topology = &ipc_print_topology, //
+        .hna = &ipc_print_hna, //
+        .mid = &ipc_print_mid, //
+        .gateways = &ipc_print_gateways, //
+        .sgw = &ipc_print_sgw, //
+        .version = &ipc_print_version, //
+        .olsrd_conf = &ipc_print_olsrd_conf, //
+        .interfaces = &ipc_print_interfaces, //
+        .config = &ipc_print_config, //
+        .plugins = &ipc_print_plugins //
+    };
+
+
 info_plugin_config_t info_plugin_config;
 char uuidfile[FILENAME_MAX];
 
@@ -106,6 +122,23 @@ static void my_fini(void) {
   olsr_plugin_exit();
 }
 
+/**
+ *Do initialization here
+ *
+ *This function is called by the my_init
+ *function in uolsrd_plugin.c
+ */
+int olsrd_plugin_init(void) {
+  return info_plugin_init(PLUGIN_NAME, &printer_functions, &info_plugin_config);
+}
+
+/**
+ * destructor - called at unload
+ */
+void olsr_plugin_exit(void) {
+  info_plugin_exit();
+}
+
 int olsrd_plugin_interface_version(void) {
   return PLUGIN_INTERFACE_VERSION;
 }