|
Packit Service |
779887 |
/*
|
|
Packit Service |
779887 |
Copyright (C) 2011 ABRT team
|
|
Packit Service |
779887 |
Copyright (C) 2010 RedHat Inc
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
779887 |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
779887 |
the Free Software Foundation; either version 2 of the License, or
|
|
Packit Service |
779887 |
(at your option) any later version.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
779887 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
779887 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
779887 |
GNU General Public License for more details.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
You should have received a copy of the GNU General Public License along
|
|
Packit Service |
779887 |
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit Service |
779887 |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit Service |
779887 |
*/
|
|
Packit Service |
779887 |
#ifndef LIBREPORT_EVENT_CONFIG_H
|
|
Packit Service |
779887 |
#define LIBREPORT_EVENT_CONFIG_H
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
#include <stdbool.h>
|
|
Packit Service |
779887 |
#include <glib.h>
|
|
Packit Service |
779887 |
#include "problem_data.h"
|
|
Packit Service |
779887 |
#include "config_item_info.h"
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
#ifdef __cplusplus
|
|
Packit Service |
779887 |
extern "C" {
|
|
Packit Service |
779887 |
#endif
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
typedef enum
|
|
Packit Service |
779887 |
{
|
|
Packit Service |
779887 |
OPTION_TYPE_TEXT,
|
|
Packit Service |
779887 |
OPTION_TYPE_BOOL,
|
|
Packit Service |
779887 |
OPTION_TYPE_PASSWORD,
|
|
Packit Service |
779887 |
OPTION_TYPE_NUMBER,
|
|
Packit Service |
779887 |
OPTION_TYPE_HINT_HTML,
|
|
Packit Service |
779887 |
OPTION_TYPE_INVALID,
|
|
Packit Service |
779887 |
} option_type_t;
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
/*
|
|
Packit Service |
779887 |
* struct to hold information about config options
|
|
Packit Service |
779887 |
* it's supposed to hold information about:
|
|
Packit Service |
779887 |
* type -> which designates the widget used to display it and we can do some test based on the type
|
|
Packit Service |
779887 |
* label
|
|
Packit Service |
779887 |
* allowed value(s) -> regexp?
|
|
Packit Service |
779887 |
* name -> env variable name
|
|
Packit Service |
779887 |
* value -> value retrieved from the gui, so when we want to set the env
|
|
Packit Service |
779887 |
* evn variables, we can just traverse the list of the options
|
|
Packit Service |
779887 |
* and set the env variables according to name:value in this structure
|
|
Packit Service |
779887 |
*/
|
|
Packit Service |
779887 |
typedef struct
|
|
Packit Service |
779887 |
{
|
|
Packit Service |
779887 |
char *eo_name; //name of the value which should be used for env variable
|
|
Packit Service |
779887 |
char *eo_value;
|
|
Packit Service |
779887 |
char *eo_label;
|
|
Packit Service |
779887 |
char *eo_note_html;
|
|
Packit Service |
779887 |
option_type_t eo_type;
|
|
Packit Service |
779887 |
int eo_allow_empty;
|
|
Packit Service |
779887 |
//char *description; //can be used as tooltip in gtk app
|
|
Packit Service |
779887 |
//char *allowed_value;
|
|
Packit Service |
779887 |
//int required;
|
|
Packit Service |
779887 |
bool is_advanced;
|
|
Packit Service |
779887 |
} event_option_t;
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
/*
|
|
Packit Service |
779887 |
* struct holds
|
|
Packit Service |
779887 |
* invopt_name = name of the option with invalid value
|
|
Packit Service |
779887 |
* invopt_error = string of the error message
|
|
Packit Service |
779887 |
*/
|
|
Packit Service |
779887 |
typedef struct
|
|
Packit Service |
779887 |
{
|
|
Packit Service |
779887 |
char *invopt_name;
|
|
Packit Service |
779887 |
char *invopt_error;
|
|
Packit Service |
779887 |
} invalid_option_t;
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
event_option_t *new_event_option(void);
|
|
Packit Service |
779887 |
void free_event_option(event_option_t *p);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
//structure to hold the option data
|
|
Packit Service |
779887 |
typedef struct
|
|
Packit Service |
779887 |
{
|
|
Packit Service |
779887 |
config_item_info_t *info;
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
char *ec_creates_items;
|
|
Packit Service |
779887 |
char *ec_requires_items;
|
|
Packit Service |
779887 |
char *ec_exclude_items_by_default;
|
|
Packit Service |
779887 |
char *ec_include_items_by_default;
|
|
Packit Service |
779887 |
char *ec_exclude_items_always;
|
|
Packit Service |
779887 |
bool ec_exclude_binary_items;
|
|
Packit Service |
779887 |
long ec_minimal_rating;
|
|
Packit Service |
779887 |
bool ec_skip_review;
|
|
Packit Service |
779887 |
bool ec_sending_sensitive_data;
|
|
Packit Service |
779887 |
bool ec_supports_restricted_access;
|
|
Packit Service |
779887 |
char *ec_restricted_access_option;
|
|
Packit Service |
779887 |
bool ec_requires_details;
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
GList *ec_imported_event_names;
|
|
Packit Service |
779887 |
GList *options;
|
|
Packit Service |
779887 |
} event_config_t;
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
event_config_t *new_event_config(const char *name);
|
|
Packit Service |
779887 |
config_item_info_t *ec_get_config_info(event_config_t * ec);
|
|
Packit Service |
779887 |
const char *ec_get_screen_name(event_config_t *ec);
|
|
Packit Service |
779887 |
void ec_set_screen_name(event_config_t *ec, const char *screen_name);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
const char *ec_get_description(event_config_t *ec);
|
|
Packit Service |
779887 |
void ec_set_description(event_config_t *ec, const char *description);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
const char *ec_get_name(event_config_t *ec);
|
|
Packit Service |
779887 |
const char *ec_get_long_desc(event_config_t *ec);
|
|
Packit Service |
779887 |
void ec_set_long_desc(event_config_t *ec, const char *long_desc);
|
|
Packit Service |
779887 |
bool ec_is_configurable(event_config_t* ec);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
/* Returns True if the event is configured to create ticket with restricted
|
|
Packit Service |
779887 |
* access.
|
|
Packit Service |
779887 |
*/
|
|
Packit Service |
779887 |
bool ec_restricted_access_enabled(event_config_t *ec);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
void free_event_config(event_config_t *p);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
invalid_option_t *new_invalid_option(void);
|
|
Packit Service |
779887 |
void free_invalid_options(invalid_option_t* p);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
void load_event_description_from_file(event_config_t *event_config, const char* filename);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
// (Re)loads data from /etc/abrt/events/*.{conf,xml}
|
|
Packit Service |
779887 |
GHashTable *load_event_config_data(void);
|
|
Packit Service |
779887 |
/* Frees all loaded data */
|
|
Packit Service |
779887 |
void free_event_config_data(void);
|
|
Packit Service |
779887 |
event_config_t *get_event_config(const char *event_name);
|
|
Packit Service |
779887 |
event_option_t *get_event_option_from_list(const char *option_name, GList *event_options);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
/* for debugging */
|
|
Packit Service |
779887 |
void ec_print(event_config_t *ec);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
extern GHashTable *g_event_config_list; // for iterating through entire list of all loaded configs
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
GList *export_event_config(const char *event_name);
|
|
Packit Service |
779887 |
void unexport_event_config(GList *env_list);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
GList *get_options_with_err_msg(const char *event_name);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
/*
|
|
Packit Service |
779887 |
* Checks usability of problem's backtrace rating against required rating level
|
|
Packit Service |
779887 |
* from event configuration.
|
|
Packit Service |
779887 |
*
|
|
Packit Service |
779887 |
* @param cfg an event configuration
|
|
Packit Service |
779887 |
* @param pd a checked problem data
|
|
Packit Service |
779887 |
* @param description an output parameter for a description of rating
|
|
Packit Service |
779887 |
* usability. If the variable holds NULL after function call no description is
|
|
Packit Service |
779887 |
* available. The description can be provided even if backtrace rating is
|
|
Packit Service |
779887 |
* acceptable. Can be NULL.
|
|
Packit Service |
779887 |
* @param detail an output parameter for a more details about rating usability.
|
|
Packit Service |
779887 |
* If the variable holds NULL after function call no description is available.
|
|
Packit Service |
779887 |
* The detail can be provided even if backtrace rating is acceptable. Can be
|
|
Packit Service |
779887 |
* NULL.
|
|
Packit Service |
779887 |
* @returns true if rating is usable or above usable; otherwise false
|
|
Packit Service |
779887 |
*/
|
|
Packit Service |
779887 |
bool check_problem_rating_usability(const event_config_t *cfg,
|
|
Packit Service |
779887 |
problem_data_t *pd,
|
|
Packit Service |
779887 |
char **description,
|
|
Packit Service |
779887 |
char **detail);
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
#ifdef __cplusplus
|
|
Packit Service |
779887 |
}
|
|
Packit Service |
779887 |
#endif
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
#endif
|