libreport  2.6.4
A tool to inform users about various problems on the running system
workflow.h
1 /*
2  Copyright (C) 2011 ABRT team
3  Copyright (C) 2010 RedHat Inc
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 #ifndef LIBREPORT_WORKFLOW_H
20 #define LIBREPORT_WORKFLOW_H
21 
22 #include <glib.h>
23 #include "event_config.h"
24 #include "config_item_info.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 typedef struct workflow workflow_t;
31 
32 extern GHashTable *g_workflow_list;
33 
34 workflow_t *new_workflow(const char *name);
35 workflow_t *get_workflow(const char *name);
36 void free_workflow(workflow_t *w);
37 
38 void load_workflow_description_from_file(workflow_t *w, const char *filename);
39 config_item_info_t *workflow_get_config_info(workflow_t *w);
40 const char *wf_get_name(workflow_t *w);
41 GList *wf_get_event_list(workflow_t *w);
42 GList *wf_get_event_names(workflow_t *w);
43 const char *wf_get_screen_name(workflow_t *w);
44 const char *wf_get_description(workflow_t *w);
45 const char *wf_get_long_desc(workflow_t *w);
46 int wf_get_priority(workflow_t *w);
47 
48 void wf_set_screen_name(workflow_t *w, const char* screen_name);
49 void wf_set_description(workflow_t *w, const char* description);
50 void wf_set_long_desc(workflow_t *w, const char* long_desc);
51 void wf_add_event(workflow_t *w, event_config_t *ec);
52 void wf_set_priority(workflow_t *w, int priority);
53 
54 /*
55  * Returns a negative integer if the first value comes before the second, 0 if
56  * they are equal, or a positive integer if the first value comes after the
57  * second.
58  */
59 int wf_priority_compare(const workflow_t *first, const workflow_t *second);
60 
61 /* The function loads workflow XML configuration files for the workflows listed
62  * in the wf_names argument. The XML files are searched in a directory at path.
63  *
64  * @param wf_names Required workflow names
65  * @param path y File system path to directory with workflow XML
66  * configuration files. If NULL, the default 'WORKFLOWS_DIR' is used instead.
67  * @returns A map where the key is workflow's name and the value is workflow_t *.
68  */
69 GHashTable *load_workflow_config_data_from_list(GList *wf_names, const char *path);
70 
71 /* The function loads all workflow XML configuration files placed in the given
72  * directory.
73  *
74  * @param directory File system path to directory with workflow XML
75  * configuration files. If NULL, the default 'WORKFLOWS_DIR' is used instead.
76  * @returns A map where the key is workflow's name and the value is workflow_t *.
77  */
78 #define load_workflow_config_data libreport_load_workflow_config_data
79 GHashTable *load_workflow_config_data(const char* directory);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif