summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-02 17:16:02 +0000
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-02 17:16:02 +0000
commit08aa32a59162e4383e2782dbf0419c61a0d22524 (patch)
tree941b20c216e21bceb8741704debfe6efc07f2c2f /src/ipcpd/normal/main.c
parent552f2eb19f04968c0c5ebc7b16f6aa1cb61b6b29 (diff)
parent85b3822a4cc121dcb3d87937c2a44395d8887ae3 (diff)
downloadouroboros-08aa32a59162e4383e2782dbf0419c61a0d22524.tar.gz
ouroboros-08aa32a59162e4383e2782dbf0419c61a0d22524.zip
Merged in sandervrijders/ouroboros/be-normal-dir (pull request #314)
ipcpd: normal: Provide directory for registered names
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c55
1 files changed, 7 insertions, 48 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 810fbca5..64138838 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -32,6 +32,7 @@
#include "ribmgr.h"
#include "ipcp.h"
#include "frct.h"
+#include "dir.h"
#include <stdbool.h>
#include <signal.h>
@@ -68,51 +69,6 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
}
}
-static int normal_ipcp_name_reg(char * name)
-{
- pthread_rwlock_rdlock(&ipcpi.state_lock);
-
- if (ipcp_data_reg_add_entry(ipcpi.data, name)) {
- pthread_rwlock_unlock(&ipcpi.state_lock);
- LOG_ERR("Failed to add %s to local registry.", name);
- return -1;
- }
-
- pthread_rwlock_unlock(&ipcpi.state_lock);
-
- LOG_DBG("Registered %s.", name);
-
- return 0;
-}
-
-static int normal_ipcp_name_unreg(char * name)
-{
- pthread_rwlock_rdlock(&ipcpi.state_lock);
-
- ipcp_data_reg_del_entry(ipcpi.data, name);
-
- pthread_rwlock_unlock(&ipcpi.state_lock);
-
- return 0;
-}
-
-static int normal_ipcp_name_query(char * name)
-{
- LOG_MISSING;
-
- /*
- * NOTE: For the moment we just return -1,
- * for testing purposes we may return zero here
- * for certain names.
- */
-
- /* FIXME: Here for testing purposes */
- if (strcmp(name, "normal.app") == 0)
- return 0;
-
- return -1;
-}
-
static int normal_ipcp_enroll(char * dif_name)
{
struct timespec timeout = {(ENROLL_TIMEOUT / 1000),
@@ -206,9 +162,9 @@ static int normal_ipcp_bootstrap(struct dif_config * conf)
static struct ipcp_ops normal_ops = {
.ipcp_bootstrap = normal_ipcp_bootstrap,
.ipcp_enroll = normal_ipcp_enroll,
- .ipcp_name_reg = normal_ipcp_name_reg,
- .ipcp_name_unreg = normal_ipcp_name_unreg,
- .ipcp_name_query = normal_ipcp_name_query,
+ .ipcp_name_reg = dir_name_reg,
+ .ipcp_name_unreg = dir_name_unreg,
+ .ipcp_name_query = dir_name_query,
.ipcp_flow_alloc = fmgr_np1_alloc,
.ipcp_flow_alloc_resp = fmgr_np1_alloc_resp,
.ipcp_flow_dealloc = fmgr_np1_dealloc
@@ -292,6 +248,9 @@ int main(int argc, char * argv[])
if (frct_fini())
LOG_ERR("Failed to finalize FRCT.");
+ if (dir_fini())
+ LOG_ERR("Failed to finalize directory.");
+
close_logfile();
ap_fini();