instance: add support for customizable syslog facilities
[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
25 struct vrule {
26 struct avl_node avl;
27 char *option;
28 char *rule;
29 };
30
31 struct validate {
32 struct avl_node avl;
33 struct list_head list;
34
35 char *package;
36 char *type;
37
38 struct avl_tree rules;
39 };
40
41 struct service {
42 struct avl_node avl;
43 const char *name;
44 bool deleted;
45 bool autostart;
46
47 struct blob_attr *trigger;
48 struct vlist_tree instances;
49 struct list_head validators;
50 struct blob_attr *data;
51 struct blobmsg_list data_blob;
52 };
53
54 void service_validate_add(struct service *s, struct blob_attr *attr);
55 void service_validate_dump(struct blob_buf *b, struct service *s);
56 void service_validate_dump_all(struct blob_buf *b, char *p, char *s);
57 int service_start_early(char *name, char *cmdline);
58 void service_stopped(struct service *s);
59 void service_validate_del(struct service *s);
60 void service_event(const char *type, const char *service, const char *instance);
61
62
63
64 #endif