summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp-data.h
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-10-25 13:22:51 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-10-26 11:52:53 +0200
commitf0646875d0bc941e339d305d0c68b13543cd6f2a (patch)
tree0a3dde0e4f6284ece935d6eff99f26234126f1ab /src/ipcpd/ipcp-data.h
parent1c06b9ff80a2bf7ee6042534fee6098f7e452b59 (diff)
downloadouroboros-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/ipcp-data.h')
-rw-r--r--src/ipcpd/ipcp-data.h56
1 files changed, 43 insertions, 13 deletions
diff --git a/src/ipcpd/ipcp-data.h b/src/ipcpd/ipcp-data.h
index 4472a1d7..5263b156 100644
--- a/src/ipcpd/ipcp-data.h
+++ b/src/ipcpd/ipcp-data.h
@@ -26,10 +26,28 @@
#include <ouroboros/shared.h>
#include <ouroboros/list.h>
+
+#include "ipcp-ops.h"
+
#include <sys/types.h>
#include <pthread.h>
-#include "ipcp-ops.h"
+enum dir_query_state {
+ QUERY_INIT = 0,
+ QUERY_PENDING,
+ QUERY_RESPONSE,
+ QUERY_DONE,
+ QUERY_DESTROY
+};
+
+struct dir_query {
+ struct list_head next;
+ char * name;
+ enum dir_query_state state;
+
+ pthread_mutex_t lock;
+ pthread_cond_t cond;
+};
struct ipcp_data {
enum ipcp_type type;
@@ -40,6 +58,9 @@ struct ipcp_data {
struct list_head directory;
pthread_rwlock_t dir_lock;
+
+ struct list_head dir_queries;
+ pthread_mutex_t dir_queries_lock;
};
struct ipcp_data * ipcp_data_create(void);
@@ -49,26 +70,35 @@ struct ipcp_data * ipcp_data_init(struct ipcp_data * dst,
void ipcp_data_destroy(struct ipcp_data * data);
-int ipcp_data_add_reg_entry(struct ipcp_data * data,
+int ipcp_data_reg_add_entry(struct ipcp_data * data,
char * name);
-int ipcp_data_del_reg_entry(struct ipcp_data * data,
+int ipcp_data_reg_del_entry(struct ipcp_data * data,
const char * name);
-int ipcp_data_add_dir_entry(struct ipcp_data * data,
- char * ap_name,
+bool ipcp_data_reg_has(struct ipcp_data * data,
+ const char * name);
+
+int ipcp_data_dir_add_entry(struct ipcp_data * data,
+ char * name,
uint64_t addr);
-int ipcp_data_del_dir_entry(struct ipcp_data * data,
- const char * ap_name,
+int ipcp_data_dir_del_entry(struct ipcp_data * data,
+ const char * name,
uint64_t addr);
-bool ipcp_data_is_in_registry(struct ipcp_data * data,
- const char * name);
+bool ipcp_data_dir_has(struct ipcp_data * data,
+ const char * name);
+
+uint64_t ipcp_data_dir_get_addr(struct ipcp_data * data,
+ const char * name);
+
+struct dir_query * ipcp_data_dir_query_create(char * name);
+
+void ipcp_data_dir_query_respond(struct dir_query * query);
-bool ipcp_data_is_in_directory(struct ipcp_data * data,
- const char * ap_name);
+void ipcp_data_dir_query_destroy(struct dir_query * query);
-uint64_t ipcp_data_get_addr(struct ipcp_data * data,
- const char * ap_name);
+int ipcp_data_dir_query_wait(struct dir_query * query,
+ const struct timespec * timeout);
#endif /* IPCPD_IPCP_DATA_H */