summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2011-03-09 16:49:41 +0100
committerKarel Klic <kklic@redhat.com>2011-03-09 16:58:28 +0100
commit43d84e3f11e46b7c9a042ff338024dfc41bb4f22 (patch)
tree783b1122556f15345290ff8b1623812b6e864827 /src/include
parent6ec12db137f2d0fe18f059fcef2390512d0b2c3f (diff)
parentc2f2a9f310e7b3bc3725cc8dc7e805fd38c7fbbd (diff)
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am3
-rw-r--r--src/include/abrtlib.h10
-rw-r--r--src/include/report/crash_data.h4
-rw-r--r--src/include/report/event_config.h82
-rw-r--r--src/include/xfuncs.h13
5 files changed, 109 insertions, 3 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 477963c3..e6f0387b 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -2,7 +2,8 @@ libreport_includedir = $(includedir)/report
libreport_include_HEADERS = \
report/crash_data.h \
report/dump_dir.h \
- report/run_event.h
+ report/run_event.h \
+ report/event_config.h
libabrt_includedir = $(includedir)/abrt
libabrt_include_HEADERS = \
diff --git a/src/include/abrtlib.h b/src/include/abrtlib.h
index 116f4b36..f64046d9 100644
--- a/src/include/abrtlib.h
+++ b/src/include/abrtlib.h
@@ -82,6 +82,7 @@ int vdprintf(int d, const char *format, va_list ap);
#include "abrt_types.h"
#include "dump_dir.h"
#include "run_event.h"
+#include "event_config.h"
#ifdef __cplusplus
@@ -169,12 +170,17 @@ enum {
EXECFLG_SETGUID = 1 << 7,
EXECFLG_SETSID = 1 << 8,
};
-/* Returns pid */
+/*
+ * env_vec: list of variables to set in environment (if string has
+ * "VAR=VAL" form) or unset in environment (if string has no '=' char).
+ *
+ * Returns pid.
+ */
#define fork_execv_on_steroids abrt_fork_execv_on_steroids
pid_t fork_execv_on_steroids(int flags,
char **argv,
int *pipefds,
- char **unsetenv_vec,
+ char **env_vec,
const char *dir,
uid_t uid);
/* Returns malloc'ed string. NULs are retained, and extra one is appended
diff --git a/src/include/report/crash_data.h b/src/include/report/crash_data.h
index 3854118a..2dfdb242 100644
--- a/src/include/report/crash_data.h
+++ b/src/include/report/crash_data.h
@@ -32,8 +32,12 @@ enum {
CD_FLAG_TXT = (1 << 1),
CD_FLAG_ISEDITABLE = (1 << 2),
CD_FLAG_ISNOTEDITABLE = (1 << 3),
+ CD_FLAG_ONELINE = (1 << 4),
};
+#define IS_TXT(flag) ((flag) & CD_FLAG_TXT)
+#define IS_ONELINE(flag) ((flag) & CD_FLAG_ONELINE)
+
struct crash_item {
char *content;
unsigned flags;
diff --git a/src/include/report/event_config.h b/src/include/report/event_config.h
new file mode 100644
index 00000000..e2310885
--- /dev/null
+++ b/src/include/report/event_config.h
@@ -0,0 +1,82 @@
+/*
+ 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
+
+typedef enum
+{
+ OPTION_TYPE_TEXT,
+ OPTION_TYPE_BOOL,
+ OPTION_TYPE_PASSWORD,
+ OPTION_TYPE_NUMBER,
+ 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 *name; //name of the value which should be used for env variable
+ char *value;
+ char *label;
+ option_type_t type;
+ 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 *name; //name of the event "Bugzilla" "RedHat Support Uploader"
+ char *title; //window title - not used right now, maybe the "name" is enough?
+ char *action;//action description to show in gui like: Upload report to the Red Hat bugzilla"
+ char *description;
+ 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 *name);
+
+extern GHashTable *g_event_config_list; // for iterating through entire list of all loaded configs
+
+#endif
diff --git a/src/include/xfuncs.h b/src/include/xfuncs.h
index 61188c81..5f2504b6 100644
--- a/src/include/xfuncs.h
+++ b/src/include/xfuncs.h
@@ -74,6 +74,19 @@ char* xasprintf(const char *format, ...);
#define xsetenv abrt_xsetenv
void xsetenv(const char *key, const char *value);
+/*
+ * Utility function to unsetenv a string which was possibly putenv'ed.
+ * The problem here is that "natural" optimization:
+ * strchrnul(var_val, '=')[0] = '\0';
+ * unsetenv(var_val);
+ * is BUGGY: if string was put into environment via putenv,
+ * its modification (s/=/NUL/) is illegal, and unsetenv will fail to unset it.
+ * Of course, saving/restoring the char wouldn't work either.
+ * This helper creates a copy up to '=', unsetenv's it, and frees:
+ */
+#define safe_unsetenv abrt_safe_unsetenv
+void safe_unsetenv(const char *var_val);
+
#define xsocket abrt_xsocket
int xsocket(int domain, int type, int protocol);
#define xbind abrt_xbind