diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2017-02-23 14:31:31 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-03-03 11:20:40 +0100 |
commit | a409fd81dfc6d22f9a287f15394b86490dea5273 (patch) | |
tree | cec27d3c2064f0c0bcb564060d9d9012f819b22f /src/ipcpd/normal/main.c | |
parent | 46c2f9d5363cdff2d99cf1b1c4a41c5bf97d2c03 (diff) | |
download | ouroboros-a409fd81dfc6d22f9a287f15394b86490dea5273.tar.gz ouroboros-a409fd81dfc6d22f9a287f15394b86490dea5273.zip |
ipcpd: normal: Refactor application entities and add neighbors struct
This refactors the different Application Entities of the normal
IPCP. They all listen to and use the connection manager to establish
new application connections.
This commit also adds a neighbors struct to the normal IPCP. It
contains neighbor structs that contain application
connection. Notifiers can be registered in case a neighbor changes
(added, removed, QoS changed).
The flow manager has an instance of this neighbors struct and listens
to these events to update its flow set. The routing component also
listens to these events so that it can update the FSDB if needed. The
flow manager now also creates the PFF instances and the routing
instances per QoS cube.
The RIB manager also uses this an instance of the neighbors struct and
listens to neighbor events as well.
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r-- | src/ipcpd/normal/main.c | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 3e5907a8..8b9a7c09 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -105,11 +105,6 @@ static int boot_components(void) log_dbg("Starting components."); - if (connmgr_init()) { - log_err("Failed to init ap connection manager"); - return -1; - } - if (rib_read(BOOT_PATH "/addr_auth/type", &pa, sizeof(pa)) != sizeof(pa)) { log_err("Failed to read policy for address authority."); @@ -126,7 +121,6 @@ static int boot_components(void) if (ipcpi.dt_addr == 0) { log_err("Failed to get a valid address."); addr_auth_fini(); - connmgr_fini(); return -1; } @@ -137,7 +131,6 @@ static int boot_components(void) if (ribmgr_init()) { log_err("Failed to initialize RIB manager."); addr_auth_fini(); - connmgr_fini(); return -1; } @@ -145,7 +138,6 @@ static int boot_components(void) log_err("Failed to initialize directory."); ribmgr_fini(); addr_auth_fini(); - connmgr_fini(); return -1; } @@ -155,7 +147,6 @@ static int boot_components(void) dir_fini(); ribmgr_fini(); addr_auth_fini(); - connmgr_fini(); log_err("Failed to start flow manager."); return -1; } @@ -165,20 +156,29 @@ static int boot_components(void) dir_fini(); ribmgr_fini(); addr_auth_fini(); - connmgr_fini(); log_err("Failed to initialize FRCT."); return -1; } + if (enroll_start()) { + fmgr_fini(); + dir_fini(); + ribmgr_fini(); + addr_auth_fini(); + log_err("Failed to start enroll."); + return -1; + } + ipcp_set_state(IPCP_OPERATIONAL); if (connmgr_start()) { ipcp_set_state(IPCP_INIT); + enroll_stop(); + frct_fini(); fmgr_fini(); dir_fini(); ribmgr_fini(); addr_auth_fini(); - connmgr_fini(); log_err("Failed to start AP connection manager."); return -1; } @@ -190,6 +190,8 @@ void shutdown_components(void) { connmgr_stop(); + enroll_stop(); + frct_fini(); fmgr_fini(); @@ -199,8 +201,6 @@ void shutdown_components(void) ribmgr_fini(); addr_auth_fini(); - - connmgr_fini(); } static int normal_ipcp_enroll(char * dst_name) @@ -418,11 +418,33 @@ int main(int argc, exit(EXIT_FAILURE); } + + if (connmgr_init()) { + log_err("Failed to initialize connection manager."); + ipcp_create_r(getpid(), -1); + rib_fini(); + irm_unbind_api(getpid(), ipcpi.name); + ipcp_fini(); + exit(EXIT_FAILURE); + } + + if (enroll_init()) { + log_err("Failed to initialize enroll component."); + ipcp_create_r(getpid(), -1); + connmgr_fini(); + rib_fini(); + irm_unbind_api(getpid(), ipcpi.name); + ipcp_fini(); + exit(EXIT_FAILURE); + } + pthread_sigmask(SIG_BLOCK, &sigset, NULL); if (ipcp_boot() < 0) { log_err("Failed to boot IPCP."); ipcp_create_r(getpid(), -1); + enroll_fini(); + connmgr_fini(); rib_fini(); irm_unbind_api(getpid(), ipcpi.name); ipcp_fini(); @@ -435,6 +457,8 @@ int main(int argc, log_err("Failed to notify IRMd we are initialized."); ipcp_set_state(IPCP_NULL); ipcp_shutdown(); + enroll_fini(); + connmgr_fini(); rib_fini(); irm_unbind_api(getpid(), ipcpi.name); ipcp_fini(); @@ -448,6 +472,10 @@ int main(int argc, rib_fini(); + connmgr_fini(); + + enroll_fini(); + irm_unbind_api(getpid(), ipcpi.name); ipcp_fini(); |