summaryrefslogtreecommitdiff
path: root/src/irmd/reg/name.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd/reg/name.h')
-rw-r--r--src/irmd/reg/name.h95
1 files changed, 35 insertions, 60 deletions
diff --git a/src/irmd/reg/name.h b/src/irmd/reg/name.h
index 3b570424..97ca7f04 100644
--- a/src/irmd/reg/name.h
+++ b/src/irmd/reg/name.h
@@ -23,81 +23,56 @@
#ifndef OUROBOROS_IRMD_REG_NAME_H
#define OUROBOROS_IRMD_REG_NAME_H
-#include <ouroboros/hash.h>
-#include <ouroboros/ipcp.h>
#include <ouroboros/list.h>
-#include <ouroboros/irm.h>
-
-#include "proc.h"
-#include "prog.h"
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <pthread.h>
-#include <string.h>
-#include <sys/types.h>
-
-enum name_state {
- NAME_NULL = 0,
- NAME_IDLE,
- NAME_AUTO_ACCEPT,
- NAME_AUTO_EXEC,
- NAME_FLOW_ACCEPT,
- NAME_FLOW_ARRIVED,
- NAME_DESTROY
-};
+#include <ouroboros/name.h>
+
+#define BIND_AUTO 0x01
-/* An entry in the registry */
struct reg_name {
- struct list_head next;
- char * name;
-
- /* Policies for this name. */
- enum pol_balance pol_lb; /* Load balance incoming flows. */
- /* Programs that can be instantiated by the irmd. */
- struct list_head reg_progs;
- /* Processes that are listening for this name. */
- struct list_head reg_pids;
-
- enum name_state state;
- pthread_cond_t cond;
- pthread_mutex_t mtx;
-};
+ struct list_head next;
-struct reg_name * reg_name_create(const char * name,
- enum pol_balance lb);
+ struct name_info info;
-void reg_name_destroy(struct reg_name * n);
+ struct list_head progs; /* autostart programs for this name */
+ size_t n_progs; /* number of programs */
-int reg_name_add_prog(struct reg_name * n,
- struct reg_prog * p);
+ struct list_head procs; /* processes bound to this name */
+ size_t n_procs; /* number of processes */
-void reg_name_del_prog(struct reg_name * n,
- const char * prog);
+ struct list_head active; /* processes actively calling accept */
+ size_t n_active; /* number of processes accepting */
+};
-char * reg_name_get_prog(struct reg_name * n);
+struct reg_name * reg_name_create(const struct name_info * info);
-int reg_name_add_pid(struct reg_name * n,
- pid_t pid);
+void reg_name_destroy(struct reg_name * name);
-void reg_name_del_pid(struct reg_name * n,
- pid_t pid);
+int reg_name_add_proc(struct reg_name * name,
+ pid_t proc);
-void reg_name_del_pid_el(struct reg_name * n,
- struct pid_el * p);
+void reg_name_del_proc(struct reg_name * name,
+ pid_t proc);
+
+bool reg_name_has_proc(const struct reg_name * name,
+ pid_t proc);
+
+int reg_name_add_prog(struct reg_name * name,
+ char ** exec);
+
+void reg_name_del_prog(struct reg_name * name,
+ const char * prog);
-pid_t reg_name_get_pid(struct reg_name * n);
+bool reg_name_has_prog(const struct reg_name * name,
+ const char * prog);
-void reg_name_set_policy(struct reg_name * n,
- enum pol_balance lb);
+char ** reg_name_get_exec(const struct reg_name * name);
-enum name_state reg_name_get_state(struct reg_name * n);
+int reg_name_add_active(struct reg_name * name,
+ pid_t proc);
-int reg_name_set_state(struct reg_name * n,
- enum name_state state);
+pid_t reg_name_get_active(struct reg_name * name);
-int reg_name_leave_state(struct reg_name * n,
- enum name_state state,
- struct timespec * timeout);
+void reg_name_del_active(struct reg_name * name,
+ pid_t proc);
#endif /* OUROBOROS_IRMD_REG_NAME_H */