summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-02-12 22:31:17 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-02-16 18:19:59 +0100
commit71eeedd1a05d5dd200c77527ea15086bf43e1a26 (patch)
treede384011e90f0048f47c0a1b932f028dbff34bc5
parenta63edb8e9d3ba5eef03c1bbb454522ea7b369087 (diff)
downloadouroboros-71eeedd1a05d5dd200c77527ea15086bf43e1a26.zip
ouroboros-71eeedd1a05d5dd200c77527ea15086bf43e1a26.tar.gz
lib: Move hashtable from lib to unicast
The hashtable is only used for forwarding tables in the unicast IPCP. This moves the generic hashtable out of the library into the unicast IPCP to prepare a more tailored implementation specific to routing tables containing address lists. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/ipcpd/unicast/CMakeLists.txt1
-rw-r--r--src/ipcpd/unicast/pol/alternate_pff.c2
-rw-r--r--src/ipcpd/unicast/pol/hashtable.c (renamed from src/lib/hashtable.c)21
-rw-r--r--src/ipcpd/unicast/pol/hashtable.h (renamed from include/ouroboros/hashtable.h)20
-rw-r--r--src/ipcpd/unicast/pol/simple_pff.c2
-rw-r--r--src/ipcpd/unicast/pol/tests/CMakeLists.txt1
-rw-r--r--src/ipcpd/unicast/pol/tests/hashtable_test.c (renamed from src/lib/tests/hashtable_test.c)0
-rw-r--r--src/lib/CMakeLists.txt1
-rw-r--r--src/lib/tests/CMakeLists.txt1
9 files changed, 25 insertions, 24 deletions
diff --git a/src/ipcpd/unicast/CMakeLists.txt b/src/ipcpd/unicast/CMakeLists.txt
index c9344f8..192b659 100644
--- a/src/ipcpd/unicast/CMakeLists.txt
+++ b/src/ipcpd/unicast/CMakeLists.txt
@@ -44,6 +44,7 @@ set(SOURCE_FILES
routing.c
psched.c
# Add policies last
+ pol/hashtable.c
pol/alternate_pff.c
pol/flat.c
pol/link_state.c
diff --git a/src/ipcpd/unicast/pol/alternate_pff.c b/src/ipcpd/unicast/pol/alternate_pff.c
index 131bc2d..36d8d51 100644
--- a/src/ipcpd/unicast/pol/alternate_pff.c
+++ b/src/ipcpd/unicast/pol/alternate_pff.c
@@ -24,7 +24,6 @@
#include "config.h"
-#include <ouroboros/hashtable.h>
#include <ouroboros/errno.h>
#include <ouroboros/list.h>
@@ -32,6 +31,7 @@
#include <assert.h>
#include <pthread.h>
+#include "hashtable.h"
#include "alternate_pff.h"
struct nhop {
diff --git a/src/lib/hashtable.c b/src/ipcpd/unicast/pol/hashtable.c
index ffff1d7..596219f 100644
--- a/src/lib/hashtable.c
+++ b/src/ipcpd/unicast/pol/hashtable.c
@@ -1,22 +1,22 @@
/*
* Ouroboros - Copyright (C) 2016 - 2020
*
- * Hash table with separate chaining on collisions
+ * Hash table with integer keys with separate chaining on collisions
*
* Dimitri Staessens <dimitri.staessens@ugent.be>
* Sander Vrijders <sander.vrijders@ugent.be>
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
@@ -24,11 +24,12 @@
#define _DEFAULT_SOURCE
#endif
-#include <ouroboros/hashtable.h>
#include <ouroboros/list.h>
#include <ouroboros/errno.h>
#include <ouroboros/hash.h>
+#include "hashtable.h"
+
#include <assert.h>
#include <string.h>
diff --git a/include/ouroboros/hashtable.h b/src/ipcpd/unicast/pol/hashtable.h
index a1c39ea..b6a3618 100644
--- a/include/ouroboros/hashtable.h
+++ b/src/ipcpd/unicast/pol/hashtable.h
@@ -1,22 +1,22 @@
/*
* Ouroboros - Copyright (C) 2016 - 2020
*
- * Hash table with integer keys with separate chaining on collisions
- *
+* Hash table with integer keys with separate chaining on collisions
+ *
* Dimitri Staessens <dimitri.staessens@ugent.be>
* Sander Vrijders <sander.vrijders@ugent.be>
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
diff --git a/src/ipcpd/unicast/pol/simple_pff.c b/src/ipcpd/unicast/pol/simple_pff.c
index c34a4fd..3d294d9 100644
--- a/src/ipcpd/unicast/pol/simple_pff.c
+++ b/src/ipcpd/unicast/pol/simple_pff.c
@@ -24,12 +24,12 @@
#include "config.h"
-#include <ouroboros/hashtable.h>
#include <ouroboros/errno.h>
#include <assert.h>
#include <pthread.h>
+#include "hashtable.h"
#include "simple_pff.h"
struct pff_i {
diff --git a/src/ipcpd/unicast/pol/tests/CMakeLists.txt b/src/ipcpd/unicast/pol/tests/CMakeLists.txt
index d065253..86c2d94 100644
--- a/src/ipcpd/unicast/pol/tests/CMakeLists.txt
+++ b/src/ipcpd/unicast/pol/tests/CMakeLists.txt
@@ -18,6 +18,7 @@ get_filename_component(PARENT_DIR ${PARENT_PATH} NAME)
create_test_sourcelist(${PARENT_DIR}_tests test_suite.c
# Add new tests here
graph_test.c
+ hashtable_test.c
)
add_executable(${PARENT_DIR}_test EXCLUDE_FROM_ALL ${${PARENT_DIR}_tests})
diff --git a/src/lib/tests/hashtable_test.c b/src/ipcpd/unicast/pol/tests/hashtable_test.c
index f84fee6..f84fee6 100644
--- a/src/lib/tests/hashtable_test.c
+++ b/src/ipcpd/unicast/pol/tests/hashtable_test.c
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 8dbedcf..c5be994 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -202,7 +202,6 @@ set(SOURCE_FILES_COMMON
btree.c
crc32.c
hash.c
- hashtable.c
list.c
lockfile.c
logs.c
diff --git a/src/lib/tests/CMakeLists.txt b/src/lib/tests/CMakeLists.txt
index c887626..9e23b0e 100644
--- a/src/lib/tests/CMakeLists.txt
+++ b/src/lib/tests/CMakeLists.txt
@@ -6,7 +6,6 @@ create_test_sourcelist(${PARENT_DIR}_tests test_suite.c
bitmap_test.c
btree_test.c
crc32_test.c
- hashtable_test.c
md5_test.c
sha3_test.c
shm_rbuff_test.c