gwenhywfar  4.20.2
Macros | Typedefs | Enumerations | Functions
gui.h File Reference
#include <gwenhywfar/inherit.h>
#include <gwenhywfar/logger.h>
#include <gwenhywfar/inetsocket.h>
#include <gwenhywfar/ssl_cert_descr.h>
#include <gwenhywfar/syncio.h>
#include <gwenhywfar/dialog.h>
#include <gwenhywfar/passwdstore.h>
#include <inttypes.h>

Go to the source code of this file.

Macros

#define GWEN_GUI_CHECK_PERIOD   750
 
#define GWEN_GUI_CPU_TIMEOUT   200
 
#define GWEN_GUI_DELAY_SECS   2
 
Flags For GWEN_Gui_ProgressStart

These flags are given to GWEN_Gui_ProgressStart to modify its behaviour.

#define GWEN_GUI_PROGRESS_DELAY   0x00000001
 
#define GWEN_GUI_PROGRESS_SHOW_LOG   0x00000002
 
#define GWEN_GUI_PROGRESS_SHOW_ABORT   0x00000004
 
#define GWEN_GUI_PROGRESS_ALLOW_SUBLEVELS   0x00000008
 
#define GWEN_GUI_PROGRESS_ALLOW_EMBED   0x00000010
 
#define GWEN_GUI_PROGRESS_SHOW_PROGRESS   0x00000020
 
#define GWEN_GUI_PROGRESS_KEEP_OPEN   0x00000040
 
#define GWEN_GUI_PROGRESS_ALWAYS_SHOW_LOG   0x00000080
 
Flags For GWEN_Gui_InputBox

These flags are given to GWEN_Gui_InputBox to modify its behaviour.

#define GWEN_GUI_INPUT_FLAGS_CONFIRM   0x00000001
 
#define GWEN_GUI_INPUT_FLAGS_SHOW   0x00000002
 
#define GWEN_GUI_INPUT_FLAGS_NUMERIC   0x00000004
 
#define GWEN_GUI_INPUT_FLAGS_RETRY   0x00000008
 
#define GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT   0x00000010
 
#define GWEN_GUI_INPUT_FLAGS_TAN   0x00000020
 
#define GWEN_GUI_INPUT_FLAGS_OPTICAL   0x00000040
 
#define GWEN_GUI_INPUT_FLAGS_DIRECT   0x00000080
 
Flags For GWEN_Gui_MessageBox

These flags are given to GWEN_Gui_MessageBox to modify its behaviour. You may OR-combine the flags.
Examples:

A note about confirmation buttons: Gwenhywfar has been designed with non-interactive applications in mind. For such an application it is important to know what button-press it has to simulate upon catching of a messagebox callback. This is what the confimation button flags are for. For informative messages the application may simply return the number of the confirmation button and be done.

However, non-interactive applications should return an error (value 0) for messages classified as dangerous (see GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS) to avoid data loss.

#define GWEN_GUI_MSG_FLAGS_TYPE_MASK   0x07
 
#define GWEN_GUI_MSG_FLAGS_TYPE_INFO   0
 
#define GWEN_GUI_MSG_FLAGS_TYPE_IS_INFO(fl)   ((fl & GWEN_GUI_MSG_FLAGS_TYPE_MASK)==GWEN_GUI_MSG_FLAGS_TYPE_INFO)
 
#define GWEN_GUI_MSG_FLAGS_TYPE_WARN   1
 
#define GWEN_GUI_MSG_FLAGS_TYPE_IS_WARN(fl)   ((fl & GWEN_GUI_MSG_FLAGS_TYPE_MASK)==GWEN_GUI_MSG_FLAGS_TYPE_WARN)
 
#define GWEN_GUI_MSG_FLAGS_TYPE_ERROR   2
 
#define GWEN_GUI_MSG_FLAGS_TYPE_IS_ERROR   ((fl & GWEN_GUI_MSG_FLAGS_TYPE_MASK)==GWEN_GUI_MSG_FLAGS_TYPE_ERROR)
 
#define GWEN_GUI_MSG_FLAGS_CONFIRM_B1   (1<<3)
 
#define GWEN_GUI_MSG_FLAGS_CONFIRM_B2   (2<<3)
 
#define GWEN_GUI_MSG_FLAGS_CONFIRM_B3   (3<<3)
 
#define GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(fl)   (((fl)>>3) & 0x3)
 
#define GWEN_GUI_MSG_FLAGS_SEVERITY_MASK   (0x7<<5)
 
#define GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL   (0x0<<5)
 
#define GWEN_GUI_MSG_FLAGS_SEVERITY_IS_NORMAL(fl)
 
#define GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS   (0x1<<5)
 
#define GWEN_GUI_MSG_FLAGS_SEVERITY_IS_DANGEROUS(fl)
 
Flags For GWEN_Gui_ShowBox
#define GWEN_GUI_SHOWBOX_FLAGS_BEEP   0x00000001
 
Special Progress Values for GWEN_Gui_ProgressAdvance
#define GWEN_GUI_PROGRESS_NONE   (0xffffffffUL)
 
#define GWEN_GUI_PROGRESS_ONE   (0xfffffffeUL)
 

Typedefs

typedef struct GWEN_GUI GWEN_GUI
 

Enumerations

enum  GWEN_GUI_PASSWORD_STATUS {
  GWEN_Gui_PasswordStatus_Bad =-1, GWEN_Gui_PasswordStatus_Unknown, GWEN_Gui_PasswordStatus_Ok, GWEN_Gui_PasswordStatus_Used,
  GWEN_Gui_PasswordStatus_Unused, GWEN_Gui_PasswordStatus_Remove
}
 

Functions

GWENHYWFAR_API GWEN_LOGGER_LEVEL GWEN_Gui_GetMinProgressLogLevel (const GWEN_GUI *gui)
 
GWENHYWFAR_API const char * GWEN_Gui_GetName (void)
 
GWENHYWFAR_API void GWEN_Gui_SetMinProgressLogLevel (GWEN_GUI *gui, GWEN_LOGGER_LEVEL ll)
 
Constructor, Destructor etc
GWENHYWFAR_API GWEN_GUIGWEN_Gui_new (void)
 
GWENHYWFAR_API void GWEN_Gui_free (GWEN_GUI *gui)
 
GWENHYWFAR_API void GWEN_Gui_Attach (GWEN_GUI *gui)
 
GWENHYWFAR_API void GWEN_Gui_SetGui (GWEN_GUI *gui)
 
GWENHYWFAR_API GWEN_GUIGWEN_Gui_GetGui (void)
 
Character Set

All messages and texts can be converted from UTF8 automatically. This needs the name of the destination character set. See output of iconv –list for a list of supported character sets.

GWENHYWFAR_API const char * GWEN_Gui_GetCharSet (const GWEN_GUI *gui)
 
GWENHYWFAR_API void GWEN_Gui_SetCharSet (GWEN_GUI *gui, const char *s)
 
GWENHYWFAR_API int GWEN_Gui_ConvertString (const char *text, size_t len, GWEN_BUFFER *tbuf, const char *fromCs, const char *toCs)
 
Virtual User Interaction Functions

All text passed to the frontend via one of the following functions is expected to be an UTF-8 string which may contain newlines but no other control characters. Text delivered as argument called text throughout the documentation in this group may contain HTML tags. If it does a non-HTML version must be supplied, too. The text MUST begin with the non-HTML version, so that a frontend not capable of parsing HTML can simply exclude the HTML part by cutting before "<html".

This is an example for HTML and non-HTML text:

const char *text;
text="This is the non-HTML text"
"<html>"
"And this is the <b>HTML</b> version."
"</html>"

Frontends capable of parsing HTML (such as the KDE frontend) will extract the HTML information and show only that part of the string.

Other frontends have to extract the non-HTML information and show only that.

GWENHYWFAR_API int GWEN_Gui_MessageBox (uint32_t flags, const char *title, const char *text, const char *b1, const char *b2, const char *b3, uint32_t guiid)
 
GWENHYWFAR_API void GWEN_Gui_ShowError (const char *title, const char *text,...)
 
GWENHYWFAR_API int GWEN_Gui_InputBox (uint32_t flags, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
 
GWENHYWFAR_API uint32_t GWEN_Gui_ShowBox (uint32_t flags, const char *title, const char *text, uint32_t guiid)
 
GWENHYWFAR_API void GWEN_Gui_HideBox (uint32_t id)
 
GWENHYWFAR_API uint32_t GWEN_Gui_ProgressStart (uint32_t progressFlags, const char *title, const char *text, uint64_t total, uint32_t guiid)
 
GWENHYWFAR_API int GWEN_Gui_ProgressAdvance (uint32_t id, uint32_t progress)
 
GWENHYWFAR_API int GWEN_Gui_ProgressSetTotal (uint32_t id, uint64_t total)
 
GWENHYWFAR_API int GWEN_Gui_ProgressLog (uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
 
GWENHYWFAR_API int GWEN_Gui_ProgressLog2 (uint32_t id, GWEN_LOGGER_LEVEL level, const char *text,...)
 
GWENHYWFAR_API int GWEN_Gui_ProgressEnd (uint32_t id)
 
GWENHYWFAR_API int GWEN_Gui_Print (const char *docTitle, const char *docType, const char *descr, const char *text, uint32_t guiid)
 
GWENHYWFAR_API int GWEN_Gui_GetPassword (uint32_t flags, const char *token, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
 
GWENHYWFAR_API int GWEN_Gui_SetPasswordStatus (const char *token, const char *pin, GWEN_GUI_PASSWORD_STATUS status, uint32_t guiid)
 
GWENHYWFAR_API int GWEN_Gui_LogHook (const char *logDomain, GWEN_LOGGER_LEVEL priority, const char *s)
 
GWENHYWFAR_API int GWEN_Gui_WaitForSockets (GWEN_SOCKET_LIST2 *readSockets, GWEN_SOCKET_LIST2 *writeSockets, uint32_t guiid, int msecs)
 
GWENHYWFAR_API int GWEN_Gui_GetSyncIo (const char *url, const char *defaultProto, int defaultPort, GWEN_SYNCIO **pSio)
 
GWENHYWFAR_API int GWEN_Gui_CheckCert (const GWEN_SSLCERTDESCR *cert, GWEN_SYNCIO *sio, uint32_t guiid)
 
GWENHYWFAR_API int GWEN_Gui_KeyDataFromText_OpenSSL (const char *text, unsigned char *buffer, unsigned int bufLength)
 
Password Cache

This implementation provides a password cache. This will be consulted upon GWEN_Gui_GetPassword. The implementation of GWEN_Gui_SetPasswordStatus also accesses this password cache.

Normally this cache is filled from password files (like those specified via option -P of aqbanking-cli).

GWENHYWFAR_API void GWEN_Gui_SetPasswordDb (GWEN_GUI *gui, GWEN_DB_NODE *dbPasswords, int persistent)
 
GWENHYWFAR_API GWEN_DB_NODEGWEN_Gui_GetPasswordDb (const GWEN_GUI *gui)
 
Password Store

This is the second level password storage. It can be used to safely store passwords in an encrypted file. This is used when a pin/password is requested which is not already in the password db (see Password Cache). This store is consulted if a given password is not found in the current pasword db (see GWEN_Gui_SetPasswordDb).

GWENHYWFAR_API GWEN_PASSWD_STOREGWEN_Gui_GetPasswdStore (const GWEN_GUI *gui)
 
GWENHYWFAR_API void GWEN_Gui_SetPasswdStore (GWEN_GUI *gui, GWEN_PASSWD_STORE *sto)
 

Dialogs

Providing dialog functionality is optional for the implementation. The internal implementations of the password and message box functions internally use dialog functions, so if your implementation of GWEN_GUI also implements the dialogs API then you're already set for most of the interactive callbacks.

enum  GWEN_GUI_FILENAME_TYPE { GWEN_Gui_FileNameType_OpenFileName =0, GWEN_Gui_FileNameType_SaveFileName, GWEN_Gui_FileNameType_OpenDirectory }
 
GWENHYWFAR_API int GWEN_Gui_ExecDialog (GWEN_DIALOG *dlg, uint32_t guiid)
 
GWENHYWFAR_API int GWEN_Gui_OpenDialog (GWEN_DIALOG *dlg, uint32_t guiid)
 
GWENHYWFAR_API int GWEN_Gui_CloseDialog (GWEN_DIALOG *dlg)
 
GWENHYWFAR_API int GWEN_Gui_RunDialog (GWEN_DIALOG *dlg, int untilEnd)
 
GWENHYWFAR_API int GWEN_Gui_GetFileName (const char *caption, GWEN_GUI_FILENAME_TYPE fnt, uint32_t flags, const char *patterns, GWEN_BUFFER *pathBuffer, uint32_t guiid)
 

Flags

Functions in this group influence the behaviour of GWEN_GUI implementations. These functions operate on a specific GUI object which applications create.

#define GWEN_GUI_FLAGS_NONINTERACTIVE   0x00000001
 
#define GWEN_GUI_FLAGS_ACCEPTVALIDCERTS   0x00000002
 
#define GWEN_GUI_FLAGS_REJECTINVALIDCERTS   0x00000004
 
#define GWEN_GUI_FLAGS_PERMPASSWORDS   0x00000008
 
#define GWEN_GUI_FLAGS_DIALOGSUPPORTED   0x80000000
 
GWENHYWFAR_API uint32_t GWEN_Gui_GetFlags (const GWEN_GUI *gui)
 
GWENHYWFAR_API void GWEN_Gui_SetFlags (GWEN_GUI *gui, uint32_t fl)
 
GWENHYWFAR_API void GWEN_Gui_AddFlags (GWEN_GUI *gui, uint32_t fl)
 
GWENHYWFAR_API void GWEN_Gui_SubFlags (GWEN_GUI *gui, uint32_t fl)