blob: 97ca7f04341168339ec095f3945dfc95481a7a98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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 */
|