First part of OS-specific interface cleanup.
authorHenning Rogge <hrogge@googlemail.com>
Thu, 7 Oct 2010 05:19:27 +0000 (07:19 +0200)
committerHenning Rogge <hrogge@googlemail.com>
Thu, 7 Oct 2010 05:19:27 +0000 (07:19 +0200)
31 files changed:
.gitignore
lib/arprefresh/src/olsrd_arprefresh.c
lib/debuginfo/src/olsrd_debuginfo.c
lib/quagga/src/quagga.c
lib/txtinfo/src/olsrd_txtinfo.c
src/defs.h
src/ifnet.h [deleted file]
src/interfaces.c
src/linux/kernel_routes.c
src/linux/net.c
src/main.c
src/net_olsr.c
src/olsr.c
src/olsr_cfg.c
src/olsr_cfg.h
src/olsr_cfg_data.h
src/olsr_cookie.c
src/olsr_logging.c
src/os_kernel_routes.h [moved from src/kernel_routes.h with 100% similarity]
src/os_log.h [moved from src/log.h with 87% similarity]
src/os_misc.h [moved from src/misc.h with 100% similarity]
src/os_net.h [moved from src/net_os.h with 92% similarity]
src/parser.c
src/plugin.h
src/process_routes.c
src/scheduler.c
src/unix/ifnet.c
src/unix/log.c
src/unix/misc.c
src/win32/log.c
src/win32/misc.c

index 23d5c1b..43b49ef 100644 (file)
@@ -27,6 +27,7 @@ lib/*/*so.*.*
 *.lib
 *.dll
 olsrd.exe
+olsrd.exe.exports
 olsr-setup.exe
 olsrd.exports
 *.opt
index b6f4cb3..2fbd984 100644 (file)
 #include <unistd.h>
 
 #include "olsrd_arprefresh.h"
-#include "kernel_routes.h"
 #include "scheduler.h"
-#include "misc.h"
+#include "os_misc.h"
 #include "olsr_logging.h"
+#include "olsr_cfg.h"
 
 #define PLUGIN_INTERFACE_VERSION 5
 
index 8c6b650..5c2dafc 100644 (file)
@@ -52,8 +52,7 @@
 #include "hna_set.h"
 #include "mid_set.h"
 #include "routing_table.h"
-#include "log.h"
-#include "misc.h"
+#include "olsr_logging.h"
 #include "olsr_ip_prefix_list.h"
 #include "parser.h"
 #include "olsr_comport_txt.h"
index 762216d..b719337 100644 (file)
@@ -24,7 +24,6 @@
 #include "quagga.h"
 #include "olsr.h"               /* olsr_exit
                                    olsr_malloc */
-#include "log.h"                /* olsr_syslog */
 #include "common/string.h"      /* strscpy */
 #include "olsr_ip_prefix_list.h"        /* ip_prefix_list_add
                                            ip_prefix_list_remove */
index b8e9310..3ce5cf2 100644 (file)
@@ -49,8 +49,6 @@
 #include "hna_set.h"
 #include "mid_set.h"
 #include "routing_table.h"
-#include "log.h"
-#include "misc.h"
 #include "olsr_ip_prefix_list.h"
 #include "parser.h"
 #include "olsr_comport_txt.h"
index 2f0bf1e..ced8415 100644 (file)
@@ -115,6 +115,19 @@ enum app_state {
 };
 
 /**
+ * defines the severity of a logging event
+ */
+enum log_severity {
+  SEVERITY_DEBUG,                      //!< SEVERITY_DEBUG
+  SEVERITY_INFO,                       //!< SEVERITY_INFO
+  SEVERITY_WARN,                       //!< SEVERITY_WARN
+  SEVERITY_ERR,                        //!< SEVERITY_ERR
+
+  /* this one must be the last of the enums ! */
+  LOG_SEVERITY_COUNT                   //!< LOG_SEVERITY_COUNT
+};
+
+/**
  * Double list pointer for save iteration
  */
 struct list_iterator {
diff --git a/src/ifnet.h b/src/ifnet.h
deleted file mode 100644 (file)
index ccd0767..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
- * 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.
- *
- */
-
-/* Network interface configuration interface.
- * Platform independent - the implementations
- * reside in OS/ifnet.c(e.g. linux/ifnet.c)
- */
-
-#ifndef _OLSR_IFNET
-#define _OLSR_IFNET
-
-/* To get ifreq */
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <net/if.h>
-
-#include "olsr_cfg.h"
-
-#if 0
-int
-  set_flag(char *, short);
-#endif
-
-int os_init_interface(struct interface *, struct olsr_if_config *);
-int chk_if_changed(struct olsr_if_config *);
-
-#ifdef WIN32
-void CallSignalHandler(void);
-void ListInterfaces(void);
-#endif
-
-#endif
-
-/*
- * Local Variables:
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * End:
- */
index 54dc994..41f69fe 100644 (file)
 
 #include "defs.h"
 #include "interfaces.h"
-#include "ifnet.h"
 #include "scheduler.h"
 #include "olsr.h"
-#include "log.h"
 #include "parser.h"
 #include "net_olsr.h"
 #include "ipcalc.h"
 #include "common/string.h"
 #include "common/avl.h"
 #include "olsr_logging.h"
-#include "valgrind/valgrind.h"
-#include "net_os.h"
+#include "os_net.h"
 
 #include <signal.h>
 #include <unistd.h>
index 4b21d13..bf623cb 100644 (file)
  *
  */
 
-#include "kernel_routes.h"
 #include "interfaces.h"
-#include "log.h"
-#include "net_os.h"
-#include "ifnet.h"
+#include "olsr_logging.h"
+#include "os_net.h"
+#include "os_kernel_routes.h"
 
 #include <assert.h>
 #include <linux/types.h>
index e99937a..a5281b6 100644 (file)
  * Linux spesific code
  */
 
-#include "../net_os.h"
-#include "../ipcalc.h"
-#include "../common/string.h"
-#include "../olsr_protocol.h"
-#include "../misc.h"
-#include "../olsr_logging.h"
-#include "../olsr.h"
+#include "os_net.h"
+#include "os_misc.h"
+#include "ipcalc.h"
+#include "common/string.h"
+#include "olsr_protocol.h"
+#include "olsr_logging.h"
+#include "olsr.h"
 
 #include <net/if.h>
 
index 5d65ac2..53a39bd 100644 (file)
 #include "common/avl.h"
 #include "common/avl_olsr_comp.h"
 #include "olsr.h"
-#include "log.h"
 #include "ipcalc.h"
 #include "scheduler.h"
 #include "parser.h"
 #include "plugin_loader.h"
 #include "apm.h"
-#include "net_os.h"
 #include "net_olsr.h"
-#include "misc.h"
+#include "os_misc.h"
 #include "olsr_cfg_gen.h"
 #include "common/string.h"
 #include "mid_set.h"
 #include "duplicate_set.h"
-#include "kernel_routes.h"
 #include "olsr_comport.h"
 #include "neighbor_table.h"
+#include "olsr_logging.h"
+#include "os_net.h"
+#include "os_kernel_routes.h"
 
 #if defined linux
 #include <linux/types.h>
 #include <linux/rtnetlink.h>
 #include <fcntl.h>
-#include "kernel_routes.h"
 #endif
 
 #define STDOUT_PULSE_INT 600    /* msec */
index a7cb49f..2d1573e 100644 (file)
@@ -41,9 +41,8 @@
 
 #include "net_olsr.h"
 #include "ipcalc.h"
-#include "log.h"
 #include "olsr.h"
-#include "net_os.h"
+#include "os_net.h"
 #include "link_set.h"
 #include "lq_packet.h"
 #include "olsr_logging.h"
index 6307480..49518ad 100644 (file)
@@ -53,9 +53,8 @@
 #include "olsr_spf.h"
 #include "scheduler.h"
 #include "apm.h"
-#include "misc.h"
+#include "os_misc.h"
 #include "neighbor_table.h"
-#include "log.h"
 #include "lq_packet.h"
 #include "common/avl.h"
 #include "net_olsr.h"
index c0c3599..ac9b02a 100644 (file)
@@ -45,8 +45,6 @@
 #include "olsr.h"
 #include "parser.h"
 #include "net_olsr.h"
-#include "ifnet.h"
-#include "log.h"
 #include "olsr_ip_prefix_list.h"
 #include "olsr_protocol.h"
 #include "common/string.h"
index 6d1d15e..399c93a 100644 (file)
@@ -112,6 +112,7 @@ struct olsr_if_config;
 #include "interfaces.h"
 #include "olsr_ip_acl.h"
 #include "olsr_cfg_data.h"
+#include "olsr_logging.h"
 
 enum smart_gw_uplinktype {
   GW_UPLINK_NONE,
index 0fc9067..69603cb 100644 (file)
@@ -76,19 +76,6 @@ enum log_source {
 };
 
 /**
- * defines the severity of a logging event
- */
-enum log_severity {
-  SEVERITY_DEBUG,                      //!< SEVERITY_DEBUG
-  SEVERITY_INFO,                       //!< SEVERITY_INFO
-  SEVERITY_WARN,                       //!< SEVERITY_WARN
-  SEVERITY_ERR,                        //!< SEVERITY_ERR
-
-  /* this one must be the last of the enums ! */
-  LOG_SEVERITY_COUNT                   //!< LOG_SEVERITY_COUNT
-};
-
-/**
  * defines the mode of the interface.
  *
  * - Mesh: default behavior
index 47fe690..d2dbb07 100644 (file)
@@ -42,7 +42,7 @@
 #include "olsr.h"
 #include "defs.h"
 #include "olsr_cookie.h"
-#include "log.h"
+#include "olsr_logging.h"
 #include "common/list.h"
 
 #include <assert.h>
index f2f0d68..1cac5db 100644 (file)
@@ -49,7 +49,7 @@
 #include "olsr_cfg.h"
 #include "olsr_cfg_data.h"
 #include "olsr_logging.h"
-#include "log.h"
+#include "os_log.h"
 
 struct log_handler_entry {
   void (*handler)
similarity index 100%
rename from src/kernel_routes.h
rename to src/os_kernel_routes.h
similarity index 87%
rename from src/log.h
rename to src/os_log.h
index 1b84271..125e19b 100644 (file)
--- a/src/log.h
 #define _OLSR_SYSLOG_H
 
 #include "defs.h"
-#include "olsr_logging.h"
 
-#define OLSR_LOG_INFO            SEVERITY_INFO
-#define OLSR_LOG_WARN            SEVERITY_WARN
-#define OLSR_LOG_ERR             SEVERITY_ERR
+void olsr_open_syslog(const char *ident);
 
-void
-  olsr_open_syslog(const char *ident);
-
-void
-  EXPORT(olsr_print_syslog) (int level, const char *format, ...) __attribute__ ((format(printf, 2, 3)));
+void EXPORT(olsr_print_syslog) (int level, const char *format, ...) __attribute__ ((format(printf, 2, 3)));
 
 
 #endif
similarity index 100%
rename from src/misc.h
rename to src/os_misc.h
similarity index 92%
rename from src/net_os.h
rename to src/os_net.h
index 71d1444..9a78114 100644 (file)
 #include "olsr_types.h"
 #include "interfaces.h"
 
-/* OS dependent functions */
+/* OS dependent functions socket functions */
 ssize_t olsr_sendto(int, const void *, size_t, int, const union olsr_sockaddr *);
-
 ssize_t olsr_recvfrom(int, void *, size_t, int, union olsr_sockaddr *, socklen_t *);
-
 int olsr_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 
-int convert_ip_to_mac(union olsr_ip_addr *, struct sockaddr *, char *);
+int getsocket4(int, struct interface *, bool, uint16_t);
+int getsocket6(int, struct interface *, bool, uint16_t);
+
+/* OS dependent interface functions */
+int os_init_interface(struct interface *, struct olsr_if_config *);
+
+int chk_if_changed(struct olsr_if_config *);
+
+#ifdef WIN32
+void CallSignalHandler(void);
+void ListInterfaces(void);
+#endif
 
 int disable_redirects(const char *, struct interface *, int);
 
@@ -76,9 +85,6 @@ int restore_settings(int);
 
 int enable_ip_forwarding(int);
 
-int getsocket4(int, struct interface *, bool, uint16_t);
-
-int getsocket6(int, struct interface *, bool, uint16_t);
 
 void os_set_olsr_socketoptions(int socket);
 
index 31d4ec2..6f35dcf 100644 (file)
@@ -47,8 +47,8 @@
 #include "duplicate_set.h"
 #include "mid_set.h"
 #include "olsr.h"
-#include "net_os.h"
-#include "log.h"
+#include "os_net.h"
+#include "olsr_logging.h"
 #include "net_olsr.h"
 
 #include <assert.h>
index 8fce155..5a695bc 100644 (file)
  */
 
 
-/*
- * Example plugin for olsrd.org OLSR daemon
- * Only the bare minimum
- */
-
 #ifndef _PLUGIN_H
 #define _PLUGIN_H
 
@@ -57,9 +52,9 @@ struct olsrd_plugin_parameters;
 #define LAST_SUPPORTED_PLUGIN_INTERFACE_VERSION                5
 
 
-/****************************************************************************
- *                Functions that the plugin MUST provide                    *
- ****************************************************************************/
+/*************************************************************************
+ * This are the necessary functions for the outdated v5 plugin interface *
+ *************************************************************************/
 #if OLSR_PLUGIN
 
 /* We hide them from the compiler here to allow the plugins itself to declare them
@@ -81,9 +76,6 @@ int olsrd_plugin_interface_version(void);
  */
 int olsrd_plugin_init(void);
 
-
-/* Interface version 4 */
-
 /**
  * Register parameters from config file
  * Called for all plugin parameters
index 1a704b8..9b4788d 100644 (file)
@@ -40,9 +40,8 @@
  */
 
 #include "process_routes.h"
-#include "log.h"
-#include "kernel_routes.h"
 #include "olsr_logging.h"
+#include "os_kernel_routes.h"
 
 #include <errno.h>
 
index b1bcbbd..dadbbbc 100644 (file)
 #include "common/avl.h"
 #include "common/avl_olsr_comp.h"
 #include "scheduler.h"
-#include "log.h"
 #include "link_set.h"
 #include "olsr.h"
 #include "olsr_cookie.h"
-#include "net_os.h"
+#include "os_net.h"
 #include "olsr_logging.h"
 
 /* Timer data, global. Externed in scheduler.h */
index a07b1f9..6fb7854 100644 (file)
 #define ifr_netmask ifr_addr
 #endif
 
-#include "ifnet.h"
 #include "ipcalc.h"
 #include "interfaces.h"
 #include "defs.h"
 #include "olsr.h"
-#include "net_os.h"
+#include "os_net.h"
 #include "net_olsr.h"
 #include "parser.h"
 #include "scheduler.h"
 #include "olsr_time.h"
 #include "lq_packet.h"
-#include "log.h"
 #include "link_set.h"
 #include "mid_set.h"
 #include "hna_set.h"
-#include "../common/string.h"
-#include "../valgrind/valgrind.h"
+#include "common/string.h"
 
 #include <assert.h>
 #include <signal.h>
index cc89ed2..2a1a792 100644 (file)
@@ -43,7 +43,7 @@
  * System logging interface for GNU/Linux systems
  */
 
-#include "../log.h"
+#include "os_log.h"
 #include <syslog.h>
 #include <stdarg.h>
 
index d9d6fc2..2d50baf 100644 (file)
@@ -39,8 +39,8 @@
  *
  */
 
-#include "misc.h"
-#include "log.h"
+#include "os_misc.h"
+#include "olsr_logging.h"
 
 #include <stdio.h>
 #include <string.h>
index 0ed11e8..96cf37d 100644 (file)
@@ -39,7 +39,7 @@
  *
  */
 
-#include "../log.h"
+#include "os_log.h"
 
 void
 olsr_open_syslog(const char *Id __attribute__ ((unused)))
index f0b827e..b539e26 100644 (file)
@@ -43,7 +43,7 @@
 #undef interface
 
 #include "misc.h"
-#include "log.h"
+#include "olsr_logging.h"
 
 void
 clear_console(void)