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.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/irmd/reg/name.h b/src/irmd/reg/name.h
new file mode 100644
index 00000000..97ca7f04
--- /dev/null
+++ b/src/irmd/reg/name.h
@@ -0,0 +1,78 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2024
+ *
+ * The IPC Resource Manager - Registry - Names
+ *
+ * Dimitri Staessens <dimitri@ouroboros.rocks>
+ * Sander Vrijders <sander@ouroboros.rocks>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., http://www.fsf.org/about/contact/.
+ */
+
+#ifndef OUROBOROS_IRMD_REG_NAME_H
+#define OUROBOROS_IRMD_REG_NAME_H
+
+#include <ouroboros/list.h>
+#include <ouroboros/name.h>
+
+#define BIND_AUTO 0x01
+
+struct reg_name {
+ struct list_head next;
+
+ struct name_info info;
+
+ struct list_head progs; /* autostart programs for this name */
+ size_t n_progs; /* number of programs */
+
+ struct list_head procs; /* processes bound to this name */
+ size_t n_procs; /* number of processes */
+
+ struct list_head active; /* processes actively calling accept */
+ size_t n_active; /* number of processes accepting */
+};
+
+struct reg_name * reg_name_create(const struct name_info * info);
+
+void reg_name_destroy(struct reg_name * name);
+
+int reg_name_add_proc(struct reg_name * name,
+ pid_t proc);
+
+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);
+
+bool reg_name_has_prog(const struct reg_name * name,
+ const char * prog);
+
+char ** reg_name_get_exec(const struct reg_name * name);
+
+int reg_name_add_active(struct reg_name * name,
+ pid_t proc);
+
+pid_t reg_name_get_active(struct reg_name * name);
+
+void reg_name_del_active(struct reg_name * name,
+ pid_t proc);
+
+#endif /* OUROBOROS_IRMD_REG_NAME_H */