diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-10-25 13:22:51 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-10-26 11:52:53 +0200 |
commit | f0646875d0bc941e339d305d0c68b13543cd6f2a (patch) | |
tree | 0a3dde0e4f6284ece935d6eff99f26234126f1ab /src/ipcpd/normal | |
parent | 1c06b9ff80a2bf7ee6042534fee6098f7e452b59 (diff) | |
download | ouroboros-f0646875d0bc941e339d305d0c68b13543cd6f2a.tar.gz ouroboros-f0646875d0bc941e339d305d0c68b13543cd6f2a.zip |
lib, irmd, ipcpd: Add name querying to IPCPs
This adds the ability to query IPCPs if a name can be reached through
them, e.g. if a name is available in a DIF. This means that in the
shim-udp a DNS query is performed, in the shim-eth-llc an ARP-like
query has been added, in the local a check is done to see if the name
is registered, and in the normal currently no application is reachable
through it.
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r-- | src/ipcpd/normal/main.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 32aabdf2..2402972f 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -28,6 +28,11 @@ #include <ouroboros/ipcp-dev.h> #include <ouroboros/time_utils.h> +#include "fmgr.h" +#include "ribmgr.h" +#include "ipcp.h" +#include "frct.h" + #include <stdbool.h> #include <signal.h> #include <stdlib.h> @@ -35,11 +40,6 @@ #include <string.h> #include <errno.h> -#include "fmgr.h" -#include "ribmgr.h" -#include "ipcp.h" -#include "frct.h" - #define THIS_TYPE IPCP_NORMAL /* global for trapping signal */ @@ -72,7 +72,7 @@ static int normal_ipcp_name_reg(char * name) { pthread_rwlock_rdlock(&ipcpi.state_lock); - if (ipcp_data_add_reg_entry(ipcpi.data, name)) { + 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; @@ -89,13 +89,28 @@ static int normal_ipcp_name_unreg(char * name) { pthread_rwlock_rdlock(&ipcpi.state_lock); - ipcp_data_del_reg_entry(ipcpi.data, name); + 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; + + (void) name; + + /* + * NOTE: For the moment we just return -1, + * for testing purposes we may return zero here + * for certain names. + */ + + return -1; +} + static int normal_ipcp_enroll(char * dif_name) { struct timespec timeout = {(ENROLL_TIMEOUT / 1000), @@ -165,6 +180,7 @@ static struct ipcp_ops normal_ops = { .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_flow_alloc = fmgr_np1_alloc, .ipcp_flow_alloc_resp = fmgr_np1_alloc_resp, .ipcp_flow_dealloc = fmgr_np1_dealloc |