libreport 2.13.1
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
27extern "C" {
28#endif
29
30typedef struct workflow workflow_t;
31
32extern GHashTable *g_workflow_list;
33
34workflow_t *new_workflow(const char *name);
35workflow_t *get_workflow(const char *name);
36void free_workflow(workflow_t *w);
37
38void load_workflow_description_from_file(workflow_t *w, const char *filename);
39config_item_info_t *workflow_get_config_info(workflow_t *w);
40const 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 */
46GList *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 */
52GList *wf_get_event_names(workflow_t *w);
53
54const char *wf_get_screen_name(workflow_t *w);
55const char *wf_get_description(workflow_t *w);
56const char *wf_get_long_desc(workflow_t *w);
57int wf_get_priority(workflow_t *w);
58
59void wf_set_screen_name(workflow_t *w, const char* screen_name);
60void wf_set_description(workflow_t *w, const char* description);
61void wf_set_long_desc(workflow_t *w, const char* long_desc);
62void wf_add_event(workflow_t *w, event_config_t *ec);
63void 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 */
70int 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 */
80GHashTable *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 */
89GHashTable *libreport_load_workflow_config_data(const char* directory);
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif