diff options
Diffstat (limited to 'src/include/report')
-rw-r--r-- | src/include/report/dump_dir.h | 80 | ||||
-rw-r--r-- | src/include/report/event_config.h | 107 | ||||
-rw-r--r-- | src/include/report/problem_data.h | 99 | ||||
-rw-r--r-- | src/include/report/report.h | 42 | ||||
-rw-r--r-- | src/include/report/run_event.h | 82 |
5 files changed, 0 insertions, 410 deletions
diff --git a/src/include/report/dump_dir.h b/src/include/report/dump_dir.h deleted file mode 100644 index c88ebe7f..00000000 --- a/src/include/report/dump_dir.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - On-disk storage of problem data - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef DUMP_DIR_H_ -#define DUMP_DIR_H_ - -/* For DIR */ -#include <sys/types.h> -#include <dirent.h> - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - DD_FAIL_QUIETLY_ENOENT = (1 << 0), - DD_FAIL_QUIETLY_EACCES = (1 << 1), - DD_OPEN_READONLY = (1 << 2), -}; - -struct dump_dir { - char *dd_dirname; - DIR *next_dir; - int locked; - uid_t dd_uid; - gid_t dd_gid; - /* mode fo saved files */ - mode_t mode; -}; - -void dd_close(struct dump_dir *dd); - -struct dump_dir *dd_opendir(const char *dir, int flags); -/* Pass uid = (uid_t)-1L to disable chown'ing of newly created files - * (IOW: if you aren't running under root): - */ -struct dump_dir *dd_create(const char *dir, uid_t uid, mode_t mode); - -void dd_create_basic_files(struct dump_dir *dd, uid_t uid); -int dd_exist(struct dump_dir *dd, const char *path); -void dd_sanitize_mode_and_owner(struct dump_dir *dd); - -DIR *dd_init_next_file(struct dump_dir *dd); -int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name); - -enum { - /* DD_FAIL_QUIETLY_ENOENT bit is valid for dd_load_text_ext too, */ - DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (DD_OPEN_READONLY << 1), -}; -char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags); -char* dd_load_text(const struct dump_dir *dd, const char *name); -void dd_save_text(struct dump_dir *dd, const char *name, const char *data); -void dd_save_binary(struct dump_dir *dd, const char *name, const char *data, unsigned size); -/* Returns 0 if directory is deleted or not found */ -int dd_delete(struct dump_dir *dd); - -void delete_dump_dir(const char *dirname); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/include/report/event_config.h b/src/include/report/event_config.h deleted file mode 100644 index 8ab9477d..00000000 --- a/src/include/report/event_config.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2011 ABRT team - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include <glib.h> - -#ifndef EVENT_CONFIG_H -#define EVENT_CONFIG_H - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum -{ - OPTION_TYPE_TEXT, - OPTION_TYPE_BOOL, - OPTION_TYPE_PASSWORD, - OPTION_TYPE_NUMBER, - OPTION_TYPE_HINT_HTML, - OPTION_TYPE_INVALID, -} option_type_t; - -/* - * struct to hold information about config options - * it's supposed to hold information about: - * type -> which designates the widget used to display it and we can do some test based on the type - * label - * allowed value(s) -> regexp? - * name -> env variable name - * value -> value retrieved from the gui, so when we want to set the env - * evn variables, we can just traverse the list of the options - * and set the env variables according to name:value in this structure - */ -typedef struct -{ - char *eo_name; //name of the value which should be used for env variable - char *eo_value; - char *eo_label; - char *eo_note_html; - option_type_t eo_type; - int eo_allow_empty; - //char *description; //can be used as tooltip in gtk app - //char *allowed_value; - //int required; -} event_option_t; - -event_option_t *new_event_option(void); -void free_event_option(event_option_t *p); - -//structure to hold the option data -typedef struct -{ - char *screen_name; //ui friendly name of the event: "Bugzilla" "RedHat Support Upload" - char *description; // "Report to..."/"Save to file". Should be one sentence, not long - char *long_descr; // Long(er) explanation, if needed - - char *ec_creates_items; - char *ec_requires_items; - char *ec_exclude_items_by_default; - char *ec_include_items_by_default; - char *ec_exclude_items_always; - bool ec_exclude_binary_items; - - GList *options; -} event_config_t; - -event_config_t *new_event_config(void); -void free_event_config(event_config_t *p); - - -void load_event_description_from_file(event_config_t *event_config, const char* filename); - -// (Re)loads data from /etc/abrt/events/*.{conf,xml} -void load_event_config_data(void); -/* Frees all loaded data */ -void free_event_config_data(void); -event_config_t *get_event_config(const char *event_name); -event_option_t *get_event_option_from_list(const char *option_name, GList *event_options); - -extern GHashTable *g_event_config_list; // for iterating through entire list of all loaded configs - -GList *export_event_config(const char *event_name); -void unexport_event_config(GList *env_list); - -GHashTable *validate_event(const char *event_name); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/include/report/problem_data.h b/src/include/report/problem_data.h deleted file mode 100644 index 31ef7d25..00000000 --- a/src/include/report/problem_data.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2009 Abrt team. - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef PROBLEM_DATA_H_ -#define PROBLEM_DATA_H_ - -#include <glib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct dump_dir; - -enum { - CD_FLAG_BIN = (1 << 0), - CD_FLAG_TXT = (1 << 1), - CD_FLAG_ISEDITABLE = (1 << 2), - CD_FLAG_ISNOTEDITABLE = (1 << 3), - /* Show this element in "short" info (abrt-cli -l) */ - CD_FLAG_LIST = (1 << 4), - CD_FLAG_UNIXTIME = (1 << 5), -}; - -struct problem_item { - char *content; - unsigned flags; - /* Used by UI for presenting "item allowed/not allowed" checkboxes: */ - int selected_by_user; /* 0 "don't know", -1 "no", 1 "yes" */ - int allowed_by_reporter; /* 0 "no", 1 "yes" */ - int default_by_reporter; /* 0 "no", 1 "yes" */ - int required_by_reporter; /* 0 "no", 1 "yes" */ -}; -typedef struct problem_item problem_item; - -char *format_problem_item(struct problem_item *item); - - -/* In-memory problem data structure and accessors */ - -typedef GHashTable problem_data_t; - -problem_data_t *new_problem_data(void); - -void add_basics_to_problem_data(problem_data_t *pd); - -static inline void free_problem_data(problem_data_t *problem_data) -{ - if (problem_data) - g_hash_table_destroy(problem_data); -} - -void add_to_problem_data_ext(problem_data_t *problem_data, - const char *name, - const char *content, - unsigned flags); -/* Uses CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE flags */ -void add_to_problem_data(problem_data_t *problem_data, - const char *name, - const char *content); - -static inline struct problem_item *get_problem_data_item_or_NULL(problem_data_t *problem_data, const char *key) -{ - return (struct problem_item *)g_hash_table_lookup(problem_data, key); -} -const char *get_problem_item_content_or_NULL(problem_data_t *problem_data, const char *key); -/* Aborts if key is not found: */ -const char *get_problem_item_content_or_die(problem_data_t *problem_data, const char *key); - - -/* Conversions between in-memory and on-disk formats */ - -void load_problem_data_from_dump_dir(problem_data_t *problem_data, struct dump_dir *dd, char **excluding); -problem_data_t *create_problem_data_from_dump_dir(struct dump_dir *dd); -/* Helper for typical operation in reporters: */ -problem_data_t *create_problem_data_for_reporting(const char *dump_dir_name); - -struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/include/report/report.h b/src/include/report/report.h deleted file mode 100644 index 269866b2..00000000 --- a/src/include/report/report.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2011 Abrt team. - Copyright (C) 2011 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef REPORT_H_ -#define REPORT_H_ - -#include "problem_data.h" - -enum { - LIBREPORT_NOWAIT = 0, - LIBREPORT_WAIT = (1 << 0), /* wait for report to finish and reload the problem data */ - LIBREPORT_ANALYZE = (1 << 1), /* run analyzers? */ - /* ("run reporters" is always on, has no flag (for now?)) */ - LIBREPORT_RELOAD_DATA = (1 << 3), /* reload problem data after run (needs WAIT) */ -}; - -int report_problem_in_dir(const char *dirname, int flags); - -/* Reports a problem stored in problem_data_t. - * It's first saved to /tmp and then processed as a dump dir. - */ -int report_problem_in_memory(problem_data_t *pd, int flags); - -/* Simple wrapper for trivial uses */ -int report_problem(problem_data_t *pd); - -#endif /* REPORT_H_ */ diff --git a/src/include/report/run_event.h b/src/include/report/run_event.h deleted file mode 100644 index 9726b643..00000000 --- a/src/include/report/run_event.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2009 Abrt team. - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef RUN_EVENT_H_ -#define RUN_EVENT_H_ - -#include "problem_data.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct dump_dir; - -struct run_event_state { - int children_count; - - /* Used only for post-create dup detection. TODO: document its API */ - int (*post_run_callback)(const char *dump_dir_name, void *param); - void *post_run_param; - - /* Can take ownership of log_line, which is malloced. In this case, return NULL. - * Otherwise should return log_line (it will be freed by caller) - */ - char* (*logging_callback)(char *log_line, void *param); - void *logging_param; - - /* Internal data for async command execution */ - GList *rule_list; - pid_t command_pid; - int command_out_fd; -}; -struct run_event_state *new_run_event_state(void); -void free_run_event_state(struct run_event_state *state); - -/* Asynchronous command execution */ - -/* Returns 0 if no commands found for this dump_dir_name+event, else >0 */ -int prepare_commands(struct run_event_state *state, const char *dump_dir_name, const char *event); -/* Returns -1 is no more commands needs to be executed, - * else sets state->command_pid and state->command_out_fd and returns >=0 - */ -int spawn_next_command(struct run_event_state *state, const char *dump_dir_name, const char *event); -/* Cleans up internal state created in prepare_commands */ -void free_commands(struct run_event_state *state); - -/* Synchronous command execution */ - -/* Returns exit code of first failed action, or first nonzero return value - * of post_run_callback. If all actions are successful, returns 0. - */ -int run_event_on_dir_name(struct run_event_state *state, const char *dump_dir_name, const char *event); -int run_event_on_problem_data(struct run_event_state *state, problem_data_t *data, const char *event); - -/* Querying for possible events */ - -/* Scans event.conf for events starting with pfx which are applicable - * to dd, or (if dd is NULL), to dump_dir. - * Returns a malloced string with '\n'-terminated event names. - */ -char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx); - -#ifdef __cplusplus -} -#endif - -#endif |