trace: use standard POSIX header for basename()
[project/procd.git] / service / service.h
1 /*
2 * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
3 * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License version 2.1
7 * as published by the Free Software Foundation
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15 #ifndef __PROCD_SERVICE_H
16 #define __PROCD_SERVICE_H
17
18 #include <libubox/avl.h>
19 #include <libubox/vlist.h>
20 #include <libubox/list.h>
21 #include "../utils/utils.h"
22
23 extern struct avl_tree services;
24 extern struct avl_tree containers;
25
26 struct vrule {
27 struct avl_node avl;
28 char *option;
29 char *rule;
30 };
31
32 struct validate {
33 struct avl_node avl;
34 struct list_head list;
35
36 char *package;
37 char *type;
38
39 struct avl_tree rules;
40 };
41
42 struct service {
43 struct avl_node avl;
44 const char *name;
45 bool deleted;
46 bool autostart;
47 bool container;
48
49 struct blob_attr *trigger;
50 struct vlist_tree instances;
51 struct list_head validators;
52 struct blob_attr *data;
53 struct blobmsg_list data_blob;
54 };
55
56 void service_validate_add(struct service *s, struct blob_attr *attr);
57 void service_validate_dump(struct blob_buf *b, struct service *s);
58 void service_validate_dump_all(struct blob_buf *b, char *p, char *s);
59 int service_start_early(char *name, char *cmdline, char *user, char *group);
60 void service_stopped(struct service *s);
61 void service_validate_del(struct service *s);
62 void service_event(const char *type, const char *service, const char *instance);
63 void service_stop_all(void);
64
65
66
67 #endif