summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp-data.h
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-10-26 09:56:31 +0000
committerdimitri staessens <[email protected]>2016-10-26 09:56:31 +0000
commitcc64e52dee3559128293a17a669e94acb48f9309 (patch)
treee4ef544c225e3b118c8a73d868dccaa073b55f11 /src/ipcpd/ipcp-data.h
parent0fd97235ecf670f1fc6db2723c530934b5376458 (diff)
parentf0646875d0bc941e339d305d0c68b13543cd6f2a (diff)
downloadouroboros-cc64e52dee3559128293a17a669e94acb48f9309.tar.gz
ouroboros-cc64e52dee3559128293a17a669e94acb48f9309.zip
Merged in sandervrijders/ouroboros/be-directory (pull request #280)
lib, irmd, ipcpd: Add name querying to IPCPs
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 */