summaryrefslogtreecommitdiff
path: root/src/irmd/api_table.h
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-20 10:42:36 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-21 18:32:12 +0200
commit0efb1ff527ce3fb50d4c72c02904fa1cdd1e3a66 (patch)
tree9c0adf0b6ef3b9350c13939f6d40c79eca7546fd /src/irmd/api_table.h
parentba27593e3e8406e109393ae383f17c7416675c1e (diff)
downloadouroboros-0efb1ff527ce3fb50d4c72c02904fa1cdd1e3a66.tar.gz
ouroboros-0efb1ff527ce3fb50d4c72c02904fa1cdd1e3a66.zip
irmd, lib: Rebuild the IRMd data model
The complete data model inside the IRMd has been restructured. The bind operation was revised to allow binding of AP and AP instances and register those names with different DIFs (see "irm bind" for details). Server applications require to call ap_init with a server name argument, client application that do not the be reachable over any DIF can call ap_init(NULL). Calling ap_init for a client with a specified name will not have adverse consequences for the application, but will consume unnecessary resources in the IRMd. Application servers can now be started at any point after the IRMd has been started. Starting servers, binding AP names and registering names in DIFs can be performed in any order that does not defy temporal logic. Supports naming instances by their pid. In case of IPCP Instances created with the IRM tool, the name assigned during "irm ipcp create" can be used. All the changes required updates in the tools.
Diffstat (limited to 'src/irmd/api_table.h')
-rw-r--r--src/irmd/api_table.h57
1 files changed, 45 insertions, 12 deletions
diff --git a/src/irmd/api_table.h b/src/irmd/api_table.h
index 694de6da..0758fdb8 100644
--- a/src/irmd/api_table.h
+++ b/src/irmd/api_table.h
@@ -23,24 +23,57 @@
#ifndef OUROBOROS_IRMD_API_TABLE_H
#define OUROBOROS_IRMD_API_TABLE_H
+#include "utils.h"
+
#include <unistd.h>
+#include <pthread.h>
+
+enum api_state {
+ API_NULL = 0,
+ API_INIT,
+ API_SLEEP,
+ API_WAKE,
+ API_DESTROY
+};
struct api_entry {
- struct list_head next;
- pid_t api;
- char * apn;
- char * ap_subset; /* unique instance identifier */
+ struct list_head next;
+ pid_t api;
+ char * apn; /* application process instantiated */
+ char * daf_name; /* DAF this AP-I belongs to */
+ struct list_head names; /* names for which this api accepts flows */
+
+ struct reg_entry * re; /* reg_entry for which a flow arrived */
+
+ /* the api will block on this */
+ enum api_state state;
+ pthread_cond_t state_cond;
+ pthread_mutex_t state_lock;
};
-struct api_entry * api_entry_create(pid_t api, char * apn, char * ap_subset);
+struct api_entry * api_entry_create(pid_t api,
+ char * apn);
+
void api_entry_destroy(struct api_entry * e);
-int api_table_add_api(struct list_head * api_table,
- pid_t api,
- char * apn,
- char * ap_subset);
-void api_table_del_api(struct list_head * api_table, pid_t api);
-char * api_table_get_apn(struct list_head * api_table, pid_t api);
-char * api_table_get_ap_subset(struct list_head * api_table, pid_t api);
+int api_entry_sleep(struct api_entry * e);
+
+void api_entry_wake(struct api_entry * e,
+ struct reg_entry * re);
+
+int api_entry_add_name(struct api_entry * e,
+ char * name);
+
+void api_entry_del_name(struct api_entry * e,
+ char * name);
+
+int api_table_add(struct list_head * api_table,
+ struct api_entry * e);
+
+void api_table_del(struct list_head * api_table,
+ pid_t api);
+
+struct api_entry * api_table_get(struct list_head * api_table,
+ pid_t api);
#endif /* OUROBOROS_IRMD_API_TABLE_H */