diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-02-16 19:22:50 +0100 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-02-17 10:53:43 +0100 |
commit | 645cf66af11ac36b81648f2e1eb3b1f5aeb7b544 (patch) | |
tree | c5e4af02e99a098dd123509cc67bfeb6efb6d69c /src/ipcpd/normal | |
parent | 8cb5218438feaf455a297915d037675e3c3eea21 (diff) | |
download | ouroboros-645cf66af11ac36b81648f2e1eb3b1f5aeb7b544.tar.gz ouroboros-645cf66af11ac36b81648f2e1eb3b1f5aeb7b544.zip |
ipcpd: Move RIB configuration to common header
Moves the definitions of paths in the RIB for the normal IPCP to a
header ribconfig.h to avoid repetition.
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r-- | src/ipcpd/normal/dir.c | 3 | ||||
-rw-r--r-- | src/ipcpd/normal/enroll.c | 8 | ||||
-rw-r--r-- | src/ipcpd/normal/fmgr.c | 7 | ||||
-rw-r--r-- | src/ipcpd/normal/gam.h | 1 | ||||
-rw-r--r-- | src/ipcpd/normal/main.c | 6 | ||||
-rw-r--r-- | src/ipcpd/normal/pol/complete.c | 1 | ||||
-rw-r--r-- | src/ipcpd/normal/pol/flat.c | 1 | ||||
-rw-r--r-- | src/ipcpd/normal/ribconfig.h | 39 | ||||
-rw-r--r-- | src/ipcpd/normal/ribmgr.c | 12 | ||||
-rw-r--r-- | src/ipcpd/normal/shm_pci.c | 5 |
10 files changed, 57 insertions, 26 deletions
diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c index c67d303f..55d6e3f6 100644 --- a/src/ipcpd/normal/dir.c +++ b/src/ipcpd/normal/dir.c @@ -26,13 +26,12 @@ #include "dir.h" #include "ipcp.h" +#include "ribconfig.h" #include <stdlib.h> #include <string.h> #include <assert.h> -#define DIR_PATH "/" DIR_NAME - static char dir_path[RIB_MAX_PATH_LEN + 1]; static void dir_path_reset(void) { diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index a0d28598..bc5d2a20 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -29,6 +29,7 @@ #include <ouroboros/rib.h> #include "ae.h" +#include "ribconfig.h" #include <assert.h> #include <stdlib.h> @@ -36,14 +37,9 @@ /* Symbolic, will return current time */ #define TIME_NAME "localtime" +#define TIME_PATH DLR TIME_NAME #define ENROLL_WARN_TIME_OFFSET 20 -#define DLR "/" -#define DIF_PATH DLR DIF_NAME -#define BOOT_PATH DLR BOOT_NAME -#define MEMBERS_PATH DLR MEMBERS_NAME -#define TIME_PATH DLR TIME_NAME - int enroll_handle(int fd) { struct cdap * ci; diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 31c83ac5..c2b53abf 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -36,6 +36,7 @@ #include "ipcp.h" #include "shm_pci.h" #include "gam.h" +#include "ribconfig.h" #include <stdlib.h> #include <stdbool.h> @@ -285,13 +286,13 @@ int fmgr_init(void) } } - if (rib_read("/" BOOT_NAME "/dt/gam/type", &pg, sizeof(pg)) + if (rib_read(BOOT_PATH "/dt/gam/type", &pg, sizeof(pg)) != sizeof(pg)) { log_err("Failed to read policy for ribmgr gam."); return -1; } - if (rib_read("/" BOOT_NAME "/dt/gam/cacep", &pc, sizeof(pc)) + if (rib_read(BOOT_PATH "/dt/gam/cacep", &pc, sizeof(pc)) != sizeof(pc)) { log_err("Failed to read CACEP policy for ribmgr gam."); return -1; @@ -375,7 +376,7 @@ int fmgr_np1_alloc(int fd, assert(strlen(dst_ap_name) + strlen("/" DIR_NAME) + 1 < RIB_MAX_PATH_LEN); - strcpy(path, "/" DIR_NAME); + strcpy(path, DIR_PATH); rib_path_append(path, dst_ap_name); diff --git a/src/ipcpd/normal/gam.h b/src/ipcpd/normal/gam.h index e858114c..50f83df9 100644 --- a/src/ipcpd/normal/gam.h +++ b/src/ipcpd/normal/gam.h @@ -24,6 +24,7 @@ #define OUROBOROS_IPCPD_NORMAL_GAM_H #include <ouroboros/cacep.h> +#include <ouroboros/irm_config.h> struct gam * gam_create(enum pol_gam gam_type, const char * ae_name); diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 11ec0938..e3955ff2 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -39,6 +39,7 @@ #include "fmgr.h" #include "frct.h" #include "ipcp.h" +#include "ribconfig.h" #include "ribmgr.h" #include <stdbool.h> @@ -49,11 +50,6 @@ #include <assert.h> #include <inttypes.h> -#define DLR "/" -#define DIF_PATH DLR DIF_NAME -#define BOOT_PATH DLR BOOT_NAME -#define MEMBERS_PATH DLR MEMBERS_NAME - #define THIS_TYPE IPCP_NORMAL struct { diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index f85fd749..5faa1ae8 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -30,6 +30,7 @@ #include "ipcp.h" #include "gam.h" +#include "ribconfig.h" #include <string.h> #include <stdlib.h> diff --git a/src/ipcpd/normal/pol/flat.c b/src/ipcpd/normal/pol/flat.c index 61b0110c..d982f5ac 100644 --- a/src/ipcpd/normal/pol/flat.c +++ b/src/ipcpd/normal/pol/flat.c @@ -30,6 +30,7 @@ #include <ouroboros/utils.h> #include "ipcp.h" +#include "ribconfig.h" #include <time.h> #include <stdlib.h> diff --git a/src/ipcpd/normal/ribconfig.h b/src/ipcpd/normal/ribconfig.h new file mode 100644 index 00000000..15b65ce2 --- /dev/null +++ b/src/ipcpd/normal/ribconfig.h @@ -0,0 +1,39 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Normal IPC Process - RIB configuration + * + * Dimitri Staessens <dimitri.staessens@ugent.be> + * Sander Vrijders <sander.vrijders@ugent.be> + * + * 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 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 General Public License for more details. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef OUROBOROS_IPCPD_NORMAL_RIB_CONFIG_H +#define OUROBOROS_IPCPD_NORMAL_RIB_CONFIG_H + +/* RIB configuration for normal */ +#define RIB_MAX_PATH_LEN 256 + +#define DLR "/" +#define BOOT_NAME "boot" +#define MEMBERS_NAME "members" +#define DIF_NAME "dif_name" +#define DIR_NAME "directory" +#define DIF_PATH DLR DIF_NAME +#define DIR_PATH DLR DIR_NAME +#define BOOT_PATH DLR BOOT_NAME +#define MEMBERS_PATH DLR MEMBERS_NAME + +#endif /* OUROBOROS_IPCPD_NORMAL_RIB_CONFIG_H */ diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c index 05d881ea..f254bd50 100644 --- a/src/ipcpd/normal/ribmgr.c +++ b/src/ipcpd/normal/ribmgr.c @@ -3,7 +3,8 @@ * * RIB manager of the IPC Process * - * Sander Vrijders <sander.vrijders@intec.ugent.be> + * Dimitri Staessens <dimitri.staessens@intec.ugent.be> + * Sander Vrijders <sander.vrijders@intec.ugent.be> * * 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 @@ -32,11 +33,10 @@ #include <ouroboros/fqueue.h> #include <ouroboros/rib.h> -#include "timerwheel.h" -#include "addr_auth.h" -#include "ribmgr.h" -#include "gam.h" #include "ae.h" +#include "gam.h" +#include "ribconfig.h" +#include "ribmgr.h" #include <stdlib.h> #include <pthread.h> @@ -44,8 +44,6 @@ #include <errno.h> #include <assert.h> -#define BOOT_PATH "/" BOOT_NAME - struct { flow_set_t * fs; fqueue_t * fq; diff --git a/src/ipcpd/normal/shm_pci.c b/src/ipcpd/normal/shm_pci.c index 1c2cee54..0807a24f 100644 --- a/src/ipcpd/normal/shm_pci.c +++ b/src/ipcpd/normal/shm_pci.c @@ -25,8 +25,9 @@ #include <ouroboros/crc32.h> #include <ouroboros/rib.h> -#include "shm_pci.h" #include "dt_const.h" +#include "shm_pci.h" +#include "ribconfig.h" #include <stdlib.h> #include <string.h> @@ -38,8 +39,6 @@ #define TTL_SIZE 1 #define CHK_SIZE 4 -#define BOOT_PATH "/" BOOT_NAME - struct { struct dt_const dtc; size_t head_size; |