libreport
2.9.4
A tool to inform users about various problems on the running system
src
include
client.h
1
/*
2
Copyright (C) 2011 ABRT team.
3
Copyright (C) 2011 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
20
@brief API for interaction with users
21
22
These functions should be used by all libreport plugins to make it possible
23
to use the plugins in EVENT scripts.
24
25
## Communication Protocol
26
27
These functions work in two modes:
28
- MASTER : the called function will interact with user
29
- SLAVE : the called function will interact with the master process
30
31
If the function is called in the slave mode, the function will prefix its
32
output with the relevant "REPORT_PREFIX_*" macro defined below. These
33
prefixes are detected by the master process so the master can react
34
appropriately to the slave's output.
35
36
In the master mode, the functions does not taint its output because
37
the output will be directly shown to users.
38
39
The mode is driven by the environment variable **REPORT_CLIENT_SLAVE**
40
If the variable is set to any value, the mode is SLAVE. In all other cases
41
the mode is MASTER.
42
43
44
## Default answers
45
46
Another environment variable that controls behaviour of these functions is
47
**REPORT_CLIENT_NONINTERACTIVE**. If this variable is set to some value and
48
the mode is not SLAVE, the function call does not wait for response from
49
user but returns immediately with a default return value. The default
50
values must not cause any harm to users, so the boolean functions returns
51
false (the default answer is "No") and the string function returns ""
52
(the default answer is no answer).
53
*/
54
55
#ifndef LIBREPORT_CLIENT_H_
56
#define LIBREPORT_CLIENT_H_
57
58
59
#define REPORT_PREFIX_ASK_YES_NO "ASK_YES_NO "
60
74
#define REPORT_PREFIX_ASK_YES_NO_YESFOREVER "ASK_YES_NO_YESFOREVER "
75
80
#define REPORT_PREFIX_ASK_YES_NO_SAVE_RESULT "ASK_YES_NO_SAVE_RESULT "
81
#define REPORT_PREFIX_ASK "ASK "
82
#define REPORT_PREFIX_ASK_PASSWORD "ASK_PASSWORD "
83
#define REPORT_PREFIX_ALERT "ALERT "
84
85
#ifdef __cplusplus
86
extern
"C"
{
87
#endif
88
89
#define set_echo libreport_set_echo
90
int
set_echo(
int
enable);
91
92
#define ask_yes_no libreport_ask_yes_no
93
int
ask_yes_no(
const
char
*question);
94
118
#define ask_yes_no_yesforever libreport_ask_yes_no_yesforever
119
int
ask_yes_no_yesforever(
const
char
*key,
const
char
*question);
120
125
#define ask_yes_no_save_resutl libreport_ask_yes_no_save_result
126
int
ask_yes_no_save_result(
const
char
*key,
const
char
*question);
127
128
#define ask libreport_ask
129
char
*ask(
const
char
*question);
130
131
#define ask_password libreport_ask_password
132
char
*ask_password(
const
char
*question);
133
134
#define alert libreport_alert
135
void
alert(
const
char
*message);
136
137
#define client_log libreport_client_log
138
void
client_log(
const
char
*message);
139
140
#ifdef __cplusplus
141
}
142
#endif
143
144
#endif
Generated by
1.8.14