diff options
author | Sander Vrijders <[email protected]> | 2016-08-21 21:12:03 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-08-21 21:12:03 +0200 |
commit | f0d4305c067044e74c44032c32ce6c4db3c6fffa (patch) | |
tree | d895b25fb5a8f7af106c6c2d3228b62ade81b3b4 /src/irmd/api_table.h | |
parent | ba27593e3e8406e109393ae383f17c7416675c1e (diff) | |
parent | cee5ae97ee14438b2dabc06bfad9b02e42e4d816 (diff) | |
download | ouroboros-f0d4305c067044e74c44032c32ce6c4db3c6fffa.tar.gz ouroboros-f0d4305c067044e74c44032c32ce6c4db3c6fffa.zip |
Merged in dstaesse/ouroboros/be-irmd-refactor (pull request #213)
irmd, lib: Rebuild the IRMd data model
Diffstat (limited to 'src/irmd/api_table.h')
-rw-r--r-- | src/irmd/api_table.h | 57 |
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 */ |