libreport  2.9.5
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 
42 /* Get a list of executed events configuration.
43  *
44  * @return A list of event_config_t *. Do not free the list.
45  */
46 GList *wf_get_event_list(workflow_t *w);
47 
48 /* Get a list of the event names to execute.
49  *
50  * @return A list of char *. Free the list with g_list_free(list, free).
51  */
52 GList *wf_get_event_names(workflow_t *w);
53 
54 const char *wf_get_screen_name(workflow_t *w);
55 const char *wf_get_description(workflow_t *w);
56 const char *wf_get_long_desc(workflow_t *w);
57 int wf_get_priority(workflow_t *w);
58 
59 void wf_set_screen_name(workflow_t *w, const char* screen_name);
60 void wf_set_description(workflow_t *w, const char* description);
61 void wf_set_long_desc(workflow_t *w, const char* long_desc);
62 void wf_add_event(workflow_t *w, event_config_t *ec);
63 void wf_set_priority(workflow_t *w, int priority);
64 
65 /*
66  * Returns a negative integer if the first value comes before the second, 0 if
67  * they are equal, or a positive integer if the first value comes after the
68  * second.
69  */
70 int wf_priority_compare(const workflow_t *first, const workflow_t *second);
71 
72 /* The function loads workflow XML configuration files for the workflows listed
73  * in the wf_names argument. The XML files are searched in a directory at path.
74  *
75  * @param wf_names Required workflow names
76  * @param path y File system path to directory with workflow XML
77  * configuration files. If NULL, the default 'WORKFLOWS_DIR' is used instead.
78  * @returns A map where the key is workflow's name and the value is workflow_t *.
79  */
80 GHashTable *load_workflow_config_data_from_list(GList *wf_names, const char *path);
81 
82 /* The function loads all workflow XML configuration files placed in the given
83  * directory.
84  *
85  * @param directory File system path to directory with workflow XML
86  * configuration files. If NULL, the default 'WORKFLOWS_DIR' is used instead.
87  * @returns A map where the key is workflow's name and the value is workflow_t *.
88  */
89 #define load_workflow_config_data libreport_load_workflow_config_data
90 GHashTable *load_workflow_config_data(const char* directory);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif