diff options
Diffstat (limited to 'src/irmd/registry.h')
-rw-r--r-- | src/irmd/registry.h | 139 |
1 files changed, 65 insertions, 74 deletions
diff --git a/src/irmd/registry.h b/src/irmd/registry.h index 927b2364..04ce7cf8 100644 --- a/src/irmd/registry.h +++ b/src/irmd/registry.h @@ -25,6 +25,7 @@ #include <ouroboros/config.h> #include <ouroboros/list.h> +#include <ouroboros/irm_config.h> #include <stdint.h> #include <stdbool.h> @@ -32,9 +33,10 @@ #include <string.h> #include <sys/types.h> -#define reg_entry_has_api(e, id) (reg_entry_get_reg_instance(e, id) != NULL) -#define reg_entry_has_ap_name(e, name) (reg_entry_get_ap_name(e, name) != NULL) -#define reg_entry_has_ap_auto(e, name) (reg_entry_get_reg_auto(e, name) != NULL) +#define registry_has_name(r, name) \ + (registry_get_entry_by_name(r, name) != NULL) +#define registry_name_has_api(r, name) \ + (registry_get_api_by_name(r, name) != NULL) enum reg_name_state { REG_NAME_NULL = 0, @@ -51,7 +53,7 @@ enum reg_i_state { REG_I_WAKE }; -struct reg_instance { +struct reg_api { struct list_head next; pid_t api; @@ -63,102 +65,91 @@ struct reg_instance { /* an entry in the registry */ struct reg_entry { - struct list_head next; - - /* generic name */ - char * name; - - /* names of the aps that can listen to this name */ - struct list_head ap_names; - - enum reg_name_state state; - - uint32_t flags; + struct list_head next; + char * name; - /* auto execution info */ - struct list_head auto_ap_info; + /* DIFs in which this name is registered */ + struct list_head difs; + /* names of the APs that can listen to this name */ + struct list_head bindings; /* known instances */ - struct list_head ap_instances; + struct list_head reg_apis; - /* difs in which this name is registered */ - struct list_head difs; - - char * req_ae_name; - int response; - - pthread_cond_t acc_signal; - pthread_mutex_t state_lock; + /* flow handling information */ + enum reg_name_state state; + char * req_ae_name; + int response; + pthread_cond_t acc_signal; + pthread_mutex_t state_lock; }; -struct reg_auto { - struct list_head next; - char * ap_name; - char ** argv; -}; +struct reg_api * reg_api_create(pid_t api); +void reg_api_destroy(struct reg_api * i); +void reg_api_sleep(struct reg_api * i); +void reg_api_wake(struct reg_api * i); -struct reg_ap_name { - struct list_head next; - char * ap_name; -}; - -struct reg_dif_name { - struct list_head next; - char * dif_name; -}; -struct reg_instance * reg_instance_create(pid_t api); -void reg_instance_destroy(struct reg_instance * i); -void reg_instance_sleep(struct reg_instance * i); -void reg_instance_wake(struct reg_instance * i); +struct reg_binding * reg_binding_create(char * apn, + uint32_t opts, + char ** argv); +void reg_binding_destroy(); struct reg_entry * reg_entry_create(); struct reg_entry * reg_entry_init(struct reg_entry * e, - char * name, - char * ap_name, - uint32_t flags); + char * name); void reg_entry_destroy(struct reg_entry * e); -struct reg_ap_name * reg_entry_get_ap_name(struct reg_entry * e, - char * ap_name); -struct reg_instance * reg_entry_get_reg_instance(struct reg_entry * e, - pid_t api); +struct reg_binding * reg_entry_get_binding(struct reg_entry * e, + char * apn); +char ** reg_entry_get_auto_info(struct reg_entry * e); +void reg_entry_del_binding(struct reg_entry * e, + char * apn); +struct reg_api * reg_entry_get_reg_api(struct reg_entry * e, + pid_t api); -struct reg_auto * reg_entry_get_reg_auto(struct reg_entry * e, - char * ap_name); pid_t reg_entry_resolve_api(struct reg_entry * e); -char ** reg_entry_resolve_auto(struct reg_entry * e); bool reg_entry_is_local_in_dif(struct reg_entry * e, char * dif_name); int reg_entry_add_local_in_dif(struct reg_entry * e, - char * dif_name); + char * dif_name, + enum ipcp_type type); void reg_entry_del_local_from_dif(struct reg_entry * e, char * dif_name); -int registry_add_entry(struct list_head * registry, - char * name, - char * ap_name, - uint16_t flags); -int registry_add_ap_auto(struct list_head * registry, + +struct reg_entry * registry_assign(struct list_head * registry, + char * name); +void registry_deassign(struct list_head * registry, + char * name); +int registry_add_binding(struct list_head * registry, char * name, - char * ap_name, + char * apn, + uint32_t flags, char ** argv); -int registry_remove_ap_auto(struct list_head * registry, - char * name, - char * ap_name); -struct reg_instance * registry_add_api_name(struct list_head * registry, +void registry_del_binding(struct list_head * registry, + char * name, + char * apn); +struct reg_api * registry_add_api_name(struct list_head * registry, pid_t api, char * name); -int registry_remove_api_name(struct list_head * registry, - pid_t api, +void registry_del_api(struct list_head * registry, + pid_t api); +struct reg_api * registry_get_api_by_name(struct list_head * registry, char * name); struct reg_entry * registry_get_entry_by_name(struct list_head * registry, char * name); -struct reg_entry * registry_get_entry_by_ap_name(struct list_head * registry, - char * ap_name); -struct reg_entry * registry_get_entry_by_ap_id(struct list_head * registry, - pid_t api); -void registry_del_name(struct list_head * registry, - char * name); - +struct reg_entry * registry_get_entry_by_apn(struct list_head * registry, + char * apn); +struct reg_entry * registry_get_entry_by_api(struct list_head * registry, + pid_t api); +char * registry_get_dif_for_dst(struct list_head * registry, + char * dst_name); +int registry_add_name_to_dif(struct list_head * registry, + char * name, + char * dif_name, + enum ipcp_type type); +void registry_del_name_from_dif(struct list_head * registry, + char * name, + char * dif_name); #endif |