diff options
author | Dimitri Staessens <[email protected]> | 2021-12-04 15:35:36 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2021-12-06 17:52:08 +0100 |
commit | 11d2ecc140486949c8d81e984137263ca48d5799 (patch) | |
tree | 3b9a61015cb86e75fa7284fb1f3e66d7b326025e /src/ipcpd | |
parent | b8ffe155228dd05f8097422349e8e6525288bbdb (diff) | |
download | ouroboros-11d2ecc140486949c8d81e984137263ca48d5799.tar.gz ouroboros-11d2ecc140486949c8d81e984137263ca48d5799.zip |
ipcpd: Restructure policy code
The policies were all in a single folder pol/, and have been moved to
a folder per component/mechanism to keep things a bit more orderly.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/unicast/CMakeLists.txt | 23 | ||||
-rw-r--r-- | src/ipcpd/unicast/addr-auth.c (renamed from src/ipcpd/unicast/addr_auth.c) | 8 | ||||
-rw-r--r-- | src/ipcpd/unicast/addr-auth.h (renamed from src/ipcpd/unicast/addr_auth.h) | 0 | ||||
-rw-r--r-- | src/ipcpd/unicast/addr-auth/flat.c (renamed from src/ipcpd/unicast/pol/flat.c) | 2 | ||||
-rw-r--r-- | src/ipcpd/unicast/addr-auth/flat.h (renamed from src/ipcpd/unicast/pol/flat.h) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/addr-auth/ops.h (renamed from src/ipcpd/unicast/pol-addr-auth-ops.h) | 8 | ||||
-rw-r--r-- | src/ipcpd/unicast/ca.c | 8 | ||||
-rw-r--r-- | src/ipcpd/unicast/ca/mb-ecn.c (renamed from src/ipcpd/unicast/pol/ca-mb-ecn.c) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/ca/mb-ecn.h (renamed from src/ipcpd/unicast/pol/ca-mb-ecn.h) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/ca/nop.c (renamed from src/ipcpd/unicast/pol/ca-nop.c) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/ca/nop.h (renamed from src/ipcpd/unicast/pol/ca-nop.h) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/ca/ops.h (renamed from src/ipcpd/unicast/pol-ca-ops.h) | 8 | ||||
-rw-r--r-- | src/ipcpd/unicast/main.c | 2 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff.c | 12 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/alternate.c (renamed from src/ipcpd/unicast/pol/alternate_pff.c) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/alternate.h (renamed from src/ipcpd/unicast/pol/alternate_pff.h) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/multipath.c (renamed from src/ipcpd/unicast/pol/multipath_pff.c) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/multipath.h (renamed from src/ipcpd/unicast/pol/multipath_pff.h) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/ops.h (renamed from src/ipcpd/unicast/pol-pff-ops.h) | 8 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/pft.c (renamed from src/ipcpd/unicast/pol/pft.c) | 0 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/pft.h (renamed from src/ipcpd/unicast/pol/pft.h) | 0 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/simple.c (renamed from src/ipcpd/unicast/pol/simple_pff.c) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/simple.h (renamed from src/ipcpd/unicast/pol/simple_pff.h) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/tests/CMakeLists.txt | 34 | ||||
-rw-r--r-- | src/ipcpd/unicast/pff/tests/pft_test.c (renamed from src/ipcpd/unicast/pol/tests/pft_test.c) | 0 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing.c | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing/graph.c (renamed from src/ipcpd/unicast/pol/graph.c) | 0 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing/graph.h (renamed from src/ipcpd/unicast/pol/graph.h) | 0 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing/link-state.c (renamed from src/ipcpd/unicast/pol/link_state.c) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing/link-state.h (renamed from src/ipcpd/unicast/pol/link_state.h) | 4 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing/ops.h (renamed from src/ipcpd/unicast/pol-routing-ops.h) | 8 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing/tests/CMakeLists.txt (renamed from src/ipcpd/unicast/pol/tests/CMakeLists.txt) | 1 | ||||
-rw-r--r-- | src/ipcpd/unicast/routing/tests/graph_test.c (renamed from src/ipcpd/unicast/pol/tests/graph_test.c) | 0 |
33 files changed, 106 insertions, 72 deletions
diff --git a/src/ipcpd/unicast/CMakeLists.txt b/src/ipcpd/unicast/CMakeLists.txt index 07f12540..a14f4e44 100644 --- a/src/ipcpd/unicast/CMakeLists.txt +++ b/src/ipcpd/unicast/CMakeLists.txt @@ -31,7 +31,7 @@ endif () set(SOURCE_FILES # Add source files here - addr_auth.c + addr-auth.c ca.c connmgr.c dht.c @@ -44,15 +44,15 @@ set(SOURCE_FILES routing.c psched.c # Add policies last - pol/pft.c - pol/flat.c - pol/link_state.c - pol/graph.c - pol/simple_pff.c - pol/alternate_pff.c - pol/multipath_pff.c - pol/ca-mb-ecn.c - pol/ca-nop.c + addr-auth/flat.c + ca/mb-ecn.c + ca/nop.c + pff/simple.c + pff/alternate.c + pff/multipath.c + pff/pft.c + routing/link-state.c + routing/graph.c ) add_executable(ipcpd-unicast ${SOURCE_FILES} ${IPCP_SOURCES} @@ -66,7 +66,8 @@ endif () install(TARGETS ipcpd-unicast RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) -add_subdirectory(pol/tests) +add_subdirectory(pff/tests) +add_subdirectory(routing/tests) if (NOT GNU) add_subdirectory(tests) diff --git a/src/ipcpd/unicast/addr_auth.c b/src/ipcpd/unicast/addr-auth.c index e508d0cb..4aff9361 100644 --- a/src/ipcpd/unicast/addr_auth.c +++ b/src/ipcpd/unicast/addr-auth.c @@ -24,13 +24,13 @@ #include <ouroboros/logs.h> -#include "addr_auth.h" -#include "pol-addr-auth-ops.h" -#include "pol/flat.h" +#include "addr-auth.h" +#include "addr-auth/ops.h" +#include "addr-auth/flat.h" #include <stdlib.h> -struct pol_addr_auth_ops * ops; +struct addr_auth_ops * ops; int addr_auth_init(enum pol_addr_auth type, const void * info) diff --git a/src/ipcpd/unicast/addr_auth.h b/src/ipcpd/unicast/addr-auth.h index d26d3eb7..d26d3eb7 100644 --- a/src/ipcpd/unicast/addr_auth.h +++ b/src/ipcpd/unicast/addr-auth.h diff --git a/src/ipcpd/unicast/pol/flat.c b/src/ipcpd/unicast/addr-auth/flat.c index f869f761..af245a5d 100644 --- a/src/ipcpd/unicast/pol/flat.c +++ b/src/ipcpd/unicast/addr-auth/flat.c @@ -50,7 +50,7 @@ struct { #define INVALID_ADDRESS 0 -struct pol_addr_auth_ops flat_ops = { +struct addr_auth_ops flat_ops = { .init = flat_init, .fini = flat_fini, .address = flat_address diff --git a/src/ipcpd/unicast/pol/flat.h b/src/ipcpd/unicast/addr-auth/flat.h index 21f7721a..96642dcc 100644 --- a/src/ipcpd/unicast/pol/flat.h +++ b/src/ipcpd/unicast/addr-auth/flat.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_UNICAST_FLAT_H #define OUROBOROS_IPCPD_UNICAST_FLAT_H -#include "pol-addr-auth-ops.h" +#include "ops.h" int flat_init(const void * info); @@ -31,6 +31,6 @@ int flat_fini(void); uint64_t flat_address(void); -extern struct pol_addr_auth_ops flat_ops; +extern struct addr_auth_ops flat_ops; #endif /* OUROBOROS_IPCPD_UNICAST_FLAT_H */ diff --git a/src/ipcpd/unicast/pol-addr-auth-ops.h b/src/ipcpd/unicast/addr-auth/ops.h index 395a5675..e1069706 100644 --- a/src/ipcpd/unicast/pol-addr-auth-ops.h +++ b/src/ipcpd/unicast/addr-auth/ops.h @@ -20,10 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_IPCPD_UNICAST_POL_ADDR_AUTH_OPS_H -#define OUROBOROS_IPCPD_UNICAST_POL_ADDR_AUTH_OPS_H +#ifndef OUROBOROS_IPCPD_UNICAST_ADDR_AUTH_OPS_H +#define OUROBOROS_IPCPD_UNICAST_ADDR_AUTH_OPS_H -struct pol_addr_auth_ops { +struct addr_auth_ops { int (* init)(const void * info); int (* fini)(void); @@ -31,4 +31,4 @@ struct pol_addr_auth_ops { uint64_t (* address)(void); }; -#endif /* OUROBOROS_IPCPD_UNICAST_POL_ADDR_AUTH_OPS_H */ +#endif /* OUROBOROS_IPCPD_UNICAST_ADDR_AUTH_OPS_H */ diff --git a/src/ipcpd/unicast/ca.c b/src/ipcpd/unicast/ca.c index ddeb2849..20cdc6be 100644 --- a/src/ipcpd/unicast/ca.c +++ b/src/ipcpd/unicast/ca.c @@ -25,12 +25,12 @@ #include <ouroboros/logs.h> #include "ca.h" -#include "pol-ca-ops.h" -#include "pol/ca-mb-ecn.h" -#include "pol/ca-nop.h" +#include "ca/ops.h" +#include "ca/mb-ecn.h" +#include "ca/nop.h" struct { - struct pol_ca_ops * ops; + struct ca_ops * ops; } ca; int ca_init(enum pol_cong_avoid pol) diff --git a/src/ipcpd/unicast/pol/ca-mb-ecn.c b/src/ipcpd/unicast/ca/mb-ecn.c index 7a88718f..38305a39 100644 --- a/src/ipcpd/unicast/pol/ca-mb-ecn.c +++ b/src/ipcpd/unicast/ca/mb-ecn.c @@ -31,7 +31,7 @@ #include <ouroboros/ipcp-dev.h> #include <ouroboros/time_utils.h> -#include "ca-mb-ecn.h" +#include "mb-ecn.h" #include <inttypes.h> #include <stdlib.h> @@ -65,7 +65,7 @@ struct mb_ecn_ctx { size_t tx_slot; }; -struct pol_ca_ops mb_ecn_ca_ops = { +struct ca_ops mb_ecn_ca_ops = { .ctx_create = mb_ecn_ctx_create, .ctx_destroy = mb_ecn_ctx_destroy, .ctx_update_snd = mb_ecn_ctx_update_snd, diff --git a/src/ipcpd/unicast/pol/ca-mb-ecn.h b/src/ipcpd/unicast/ca/mb-ecn.h index a90ae3e2..53f23179 100644 --- a/src/ipcpd/unicast/pol/ca-mb-ecn.h +++ b/src/ipcpd/unicast/ca/mb-ecn.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_UNICAST_CA_MB_ECN_H #define OUROBOROS_IPCPD_UNICAST_CA_MB_ECN_H -#include "pol-ca-ops.h" +#include "ops.h" void * mb_ecn_ctx_create(void); @@ -51,6 +51,6 @@ ssize_t mb_ecn_print_stats(void * ctx, char * buf, size_t len); -extern struct pol_ca_ops mb_ecn_ca_ops; +extern struct ca_ops mb_ecn_ca_ops; #endif /* OUROBOROS_IPCPD_UNICAST_CA_MB_ECN_H */ diff --git a/src/ipcpd/unicast/pol/ca-nop.c b/src/ipcpd/unicast/ca/nop.c index db908c5c..5be826d4 100644 --- a/src/ipcpd/unicast/pol/ca-nop.c +++ b/src/ipcpd/unicast/ca/nop.c @@ -20,11 +20,11 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#include "ca-nop.h" +#include "nop.h" #include <string.h> -struct pol_ca_ops nop_ca_ops = { +struct ca_ops nop_ca_ops = { .ctx_create = nop_ctx_create, .ctx_destroy = nop_ctx_destroy, .ctx_update_snd = nop_ctx_update_snd, diff --git a/src/ipcpd/unicast/pol/ca-nop.h b/src/ipcpd/unicast/ca/nop.h index 7b9d318f..25996552 100644 --- a/src/ipcpd/unicast/pol/ca-nop.h +++ b/src/ipcpd/unicast/ca/nop.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_UNICAST_CA_NOP_H #define OUROBOROS_IPCPD_UNICAST_CA_NOP_H -#include "pol-ca-ops.h" +#include "ops.h" void * nop_ctx_create(void); @@ -47,6 +47,6 @@ int nop_calc_ecn(int fd, qoscube_t qc, size_t len); -extern struct pol_ca_ops nop_ca_ops; +extern struct ca_ops nop_ca_ops; #endif /* OUROBOROS_IPCPD_UNICAST_CA_NOP_H */ diff --git a/src/ipcpd/unicast/pol-ca-ops.h b/src/ipcpd/unicast/ca/ops.h index 88f6cf61..ee0f028b 100644 --- a/src/ipcpd/unicast/pol-ca-ops.h +++ b/src/ipcpd/unicast/ca/ops.h @@ -20,12 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_IPCPD_UNICAST_POL_CA_OPS_H -#define OUROBOROS_IPCPD_UNICAST_POL_CA_OPS_H +#ifndef OUROBOROS_IPCPD_UNICAST_CA_OPS_H +#define OUROBOROS_IPCPD_UNICAST_CA_OPS_H #include "ca.h" -struct pol_ca_ops { +struct ca_ops { void * (* ctx_create)(void); void (* ctx_destroy)(void * ctx); @@ -55,4 +55,4 @@ struct pol_ca_ops { }; -#endif /* OUROBOROS_IPCPD_UNICAST_POL_CA_OPS_H */ +#endif /* OUROBOROS_IPCPD_UNICAST_CA_OPS_H */ diff --git a/src/ipcpd/unicast/main.c b/src/ipcpd/unicast/main.c index 018dd1c6..873c6ce3 100644 --- a/src/ipcpd/unicast/main.c +++ b/src/ipcpd/unicast/main.c @@ -41,7 +41,7 @@ #include "common/connmgr.h" #include "common/enroll.h" -#include "addr_auth.h" +#include "addr-auth.h" #include "ca.h" #include "dir.h" #include "dt.h" diff --git a/src/ipcpd/unicast/pff.c b/src/ipcpd/unicast/pff.c index 03682184..192552b9 100644 --- a/src/ipcpd/unicast/pff.c +++ b/src/ipcpd/unicast/pff.c @@ -26,14 +26,14 @@ #include <ouroboros/logs.h> #include "pff.h" -#include "pol-pff-ops.h" -#include "pol/alternate_pff.h" -#include "pol/multipath_pff.h" -#include "pol/simple_pff.h" +#include "pff/ops.h" +#include "pff/alternate.h" +#include "pff/multipath.h" +#include "pff/simple.h" struct pff { - struct pol_pff_ops * ops; - struct pff_i * pff_i; + struct pff_ops * ops; + struct pff_i * pff_i; }; struct pff * pff_create(enum pol_pff pol) diff --git a/src/ipcpd/unicast/pol/alternate_pff.c b/src/ipcpd/unicast/pff/alternate.c index 18d3dfed..9f0a6279 100644 --- a/src/ipcpd/unicast/pol/alternate_pff.c +++ b/src/ipcpd/unicast/pff/alternate.c @@ -28,7 +28,7 @@ #include <ouroboros/list.h> #include "pft.h" -#include "alternate_pff.h" +#include "alternate.h" #include <string.h> #include <assert.h> @@ -54,7 +54,7 @@ struct pff_i { pthread_rwlock_t lock; }; -struct pol_pff_ops alternate_pff_ops = { +struct pff_ops alternate_pff_ops = { .create = alternate_pff_create, .destroy = alternate_pff_destroy, .lock = alternate_pff_lock, diff --git a/src/ipcpd/unicast/pol/alternate_pff.h b/src/ipcpd/unicast/pff/alternate.h index 9c7cc08f..294f48d9 100644 --- a/src/ipcpd/unicast/pol/alternate_pff.h +++ b/src/ipcpd/unicast/pff/alternate.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_UNICAST_ALTERNATE_PFF_H #define OUROBOROS_IPCPD_UNICAST_ALTERNATE_PFF_H -#include "pol-pff-ops.h" +#include "ops.h" struct pff_i * alternate_pff_create(void); @@ -56,6 +56,6 @@ int alternate_flow_state_change(struct pff_i * pff_i, int fd, bool up); -extern struct pol_pff_ops alternate_pff_ops; +extern struct pff_ops alternate_pff_ops; #endif /* OUROBOROS_IPCPD_UNICAST_ALTERNATE_PFF_H */ diff --git a/src/ipcpd/unicast/pol/multipath_pff.c b/src/ipcpd/unicast/pff/multipath.c index 0d759ec4..43135d27 100644 --- a/src/ipcpd/unicast/pol/multipath_pff.c +++ b/src/ipcpd/unicast/pff/multipath.c @@ -28,7 +28,7 @@ #include <ouroboros/errno.h> #include "pft.h" -#include "multipath_pff.h" +#include "multipath.h" #include <string.h> #include <assert.h> @@ -39,7 +39,7 @@ struct pff_i { pthread_rwlock_t lock; }; -struct pol_pff_ops multipath_pff_ops = { +struct pff_ops multipath_pff_ops = { .create = multipath_pff_create, .destroy = multipath_pff_destroy, .lock = multipath_pff_lock, diff --git a/src/ipcpd/unicast/pol/multipath_pff.h b/src/ipcpd/unicast/pff/multipath.h index 8168995e..4a5bcefb 100644 --- a/src/ipcpd/unicast/pol/multipath_pff.h +++ b/src/ipcpd/unicast/pff/multipath.h @@ -24,7 +24,7 @@ #ifndef OUROBOROS_IPCPD_UNICAST_MULTIPATH_PFF_H #define OUROBOROS_IPCPD_UNICAST_MULTIPATH_PFF_H -#include "pol-pff-ops.h" +#include "ops.h" struct pff_i * multipath_pff_create(void); @@ -53,6 +53,6 @@ void multipath_pff_flush(struct pff_i * pff_i); int multipath_pff_nhop(struct pff_i * pff_i, uint64_t addr); -extern struct pol_pff_ops multipath_pff_ops; +extern struct pff_ops multipath_pff_ops; #endif /* OUROBOROS_IPCPD_UNICAST_MULTIPATH_PFF_H */ diff --git a/src/ipcpd/unicast/pol-pff-ops.h b/src/ipcpd/unicast/pff/ops.h index 85615a1f..a46f3da8 100644 --- a/src/ipcpd/unicast/pol-pff-ops.h +++ b/src/ipcpd/unicast/pff/ops.h @@ -20,14 +20,14 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_IPCPD_UNICAST_POL_PFF_OPS_H -#define OUROBOROS_IPCPD_UNICAST_POL_PFF_OPS_H +#ifndef OUROBOROS_IPCPD_UNICAST_PFF_OPS_H +#define OUROBOROS_IPCPD_UNICAST_PFF_OPS_H #include <stdbool.h> struct pff_i; -struct pol_pff_ops { +struct pff_ops { struct pff_i * (* create)(void); void (* destroy)(struct pff_i * pff_i); @@ -60,4 +60,4 @@ struct pol_pff_ops { bool up); }; -#endif /* OUROBOROS_IPCPD_UNICAST_POL_PFF_OPS_H */ +#endif /* OUROBOROS_IPCPD_UNICAST_PFF_OPS_H */ diff --git a/src/ipcpd/unicast/pol/pft.c b/src/ipcpd/unicast/pff/pft.c index e42b4a98..e42b4a98 100644 --- a/src/ipcpd/unicast/pol/pft.c +++ b/src/ipcpd/unicast/pff/pft.c diff --git a/src/ipcpd/unicast/pol/pft.h b/src/ipcpd/unicast/pff/pft.h index 011ad414..011ad414 100644 --- a/src/ipcpd/unicast/pol/pft.h +++ b/src/ipcpd/unicast/pff/pft.h diff --git a/src/ipcpd/unicast/pol/simple_pff.c b/src/ipcpd/unicast/pff/simple.c index 13944aed..a007bcec 100644 --- a/src/ipcpd/unicast/pol/simple_pff.c +++ b/src/ipcpd/unicast/pff/simple.c @@ -27,7 +27,7 @@ #include <ouroboros/errno.h> #include "pft.h" -#include "simple_pff.h" +#include "simple.h" #include <assert.h> #include <pthread.h> @@ -37,7 +37,7 @@ struct pff_i { pthread_rwlock_t lock; }; -struct pol_pff_ops simple_pff_ops = { +struct pff_ops simple_pff_ops = { .create = simple_pff_create, .destroy = simple_pff_destroy, .lock = simple_pff_lock, diff --git a/src/ipcpd/unicast/pol/simple_pff.h b/src/ipcpd/unicast/pff/simple.h index 2b22c130..e9083cf5 100644 --- a/src/ipcpd/unicast/pol/simple_pff.h +++ b/src/ipcpd/unicast/pff/simple.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_UNICAST_SIMPLE_PFF_H #define OUROBOROS_IPCPD_UNICAST_SIMPLE_PFF_H -#include "pol-pff-ops.h" +#include "ops.h" struct pff_i * simple_pff_create(void); @@ -52,6 +52,6 @@ void simple_pff_flush(struct pff_i * pff_i); int simple_pff_nhop(struct pff_i * pff_i, uint64_t addr); -extern struct pol_pff_ops simple_pff_ops; +extern struct pff_ops simple_pff_ops; #endif /* OUROBOROS_IPCPD_UNICAST_SIMPLE_PFF_H */ diff --git a/src/ipcpd/unicast/pff/tests/CMakeLists.txt b/src/ipcpd/unicast/pff/tests/CMakeLists.txt new file mode 100644 index 00000000..e7082372 --- /dev/null +++ b/src/ipcpd/unicast/pff/tests/CMakeLists.txt @@ -0,0 +1,34 @@ +get_filename_component(CURRENT_SOURCE_PARENT_DIR + ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) +get_filename_component(CURRENT_BINARY_PARENT_DIR + ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +include_directories(${CURRENT_SOURCE_PARENT_DIR}) +include_directories(${CURRENT_BINARY_PARENT_DIR}) + +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}/include) + +get_filename_component(PARENT_PATH ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) +get_filename_component(PARENT_DIR ${PARENT_PATH} NAME) + +create_test_sourcelist(${PARENT_DIR}_tests test_suite.c + # Add new tests here + pft_test.c + ) + +add_executable(${PARENT_DIR}_test EXCLUDE_FROM_ALL ${${PARENT_DIR}_tests}) +target_link_libraries(${PARENT_DIR}_test ouroboros-common) + +add_dependencies(check ${PARENT_DIR}_test) + +set(tests_to_run ${${PARENT_DIR}_tests}) +remove(tests_to_run test_suite.c) + +foreach (test ${tests_to_run}) + get_filename_component(test_name ${test} NAME_WE) + add_test(${test_name} ${C_TEST_PATH}/${PARENT_DIR}_test ${test_name}) +endforeach (test) diff --git a/src/ipcpd/unicast/pol/tests/pft_test.c b/src/ipcpd/unicast/pff/tests/pft_test.c index c48267eb..c48267eb 100644 --- a/src/ipcpd/unicast/pol/tests/pft_test.c +++ b/src/ipcpd/unicast/pff/tests/pft_test.c diff --git a/src/ipcpd/unicast/routing.c b/src/ipcpd/unicast/routing.c index 1b13ae0e..b1e1ed77 100644 --- a/src/ipcpd/unicast/routing.c +++ b/src/ipcpd/unicast/routing.c @@ -26,9 +26,9 @@ #include "pff.h" #include "routing.h" -#include "pol/link_state.h" +#include "routing/link-state.h" -struct pol_routing_ops * r_ops; +struct routing_ops * r_ops; int routing_init(enum pol_routing pr) { diff --git a/src/ipcpd/unicast/pol/graph.c b/src/ipcpd/unicast/routing/graph.c index 6ea5c507..6ea5c507 100644 --- a/src/ipcpd/unicast/pol/graph.c +++ b/src/ipcpd/unicast/routing/graph.c diff --git a/src/ipcpd/unicast/pol/graph.h b/src/ipcpd/unicast/routing/graph.h index 632cc5a0..632cc5a0 100644 --- a/src/ipcpd/unicast/pol/graph.h +++ b/src/ipcpd/unicast/routing/graph.h diff --git a/src/ipcpd/unicast/pol/link_state.c b/src/ipcpd/unicast/routing/link-state.c index 08d39372..7ceb86a1 100644 --- a/src/ipcpd/unicast/pol/link_state.c +++ b/src/ipcpd/unicast/routing/link-state.c @@ -46,7 +46,7 @@ #include "common/connmgr.h" #include "graph.h" #include "ipcp.h" -#include "link_state.h" +#include "link-state.h" #include "pff.h" #include <assert.h> @@ -127,7 +127,7 @@ struct { enum routing_algo routing_algo; } ls; -struct pol_routing_ops link_state_ops = { +struct routing_ops link_state_ops = { .init = link_state_init, .fini = link_state_fini, .routing_i_create = link_state_routing_i_create, diff --git a/src/ipcpd/unicast/pol/link_state.h b/src/ipcpd/unicast/routing/link-state.h index 05b0ae5d..c6e573ff 100644 --- a/src/ipcpd/unicast/pol/link_state.h +++ b/src/ipcpd/unicast/routing/link-state.h @@ -26,7 +26,7 @@ #define LS_COMP "Management" #define LS_PROTO "LSP" -#include "pol-routing-ops.h" +#include "ops.h" int link_state_init(enum pol_routing pr); @@ -36,6 +36,6 @@ struct routing_i * link_state_routing_i_create(struct pff * pff); void link_state_routing_i_destroy(struct routing_i * instance); -extern struct pol_routing_ops link_state_ops; +extern struct routing_ops link_state_ops; #endif /* OUROBOROS_IPCPD_UNICAST_POL_LINK_STATE_H */ diff --git a/src/ipcpd/unicast/pol-routing-ops.h b/src/ipcpd/unicast/routing/ops.h index cea88582..1522ccd9 100644 --- a/src/ipcpd/unicast/pol-routing-ops.h +++ b/src/ipcpd/unicast/routing/ops.h @@ -20,12 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_IPCPD_UNICAST_POL_ROUTING_OPS_H -#define OUROBOROS_IPCPD_UNICAST_POL_ROUTING_OPS_H +#ifndef OUROBOROS_IPCPD_UNICAST_ROUTING_OPS_H +#define OUROBOROS_IPCPD_UNICAST_ROUTING_OPS_H #include "pff.h" -struct pol_routing_ops { +struct routing_ops { int (* init)(enum pol_routing pr); void (* fini)(void); @@ -35,4 +35,4 @@ struct pol_routing_ops { void (* routing_i_destroy)(struct routing_i * instance); }; -#endif /* OUROBOROS_IPCPD_UNICAST_POL_ROUTING_OPS_H */ +#endif /* OUROBOROS_IPCPD_UNICAST_ROUTING_OPS_H */ diff --git a/src/ipcpd/unicast/pol/tests/CMakeLists.txt b/src/ipcpd/unicast/routing/tests/CMakeLists.txt index 34d80e8d..d0652533 100644 --- a/src/ipcpd/unicast/pol/tests/CMakeLists.txt +++ b/src/ipcpd/unicast/routing/tests/CMakeLists.txt @@ -18,7 +18,6 @@ get_filename_component(PARENT_DIR ${PARENT_PATH} NAME) create_test_sourcelist(${PARENT_DIR}_tests test_suite.c # Add new tests here graph_test.c - pft_test.c ) add_executable(${PARENT_DIR}_test EXCLUDE_FROM_ALL ${${PARENT_DIR}_tests}) diff --git a/src/ipcpd/unicast/pol/tests/graph_test.c b/src/ipcpd/unicast/routing/tests/graph_test.c index 217c7eab..217c7eab 100644 --- a/src/ipcpd/unicast/pol/tests/graph_test.c +++ b/src/ipcpd/unicast/routing/tests/graph_test.c |