taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit 9065ce55d75b8bdabd3d646ab09375a282ace96c
parent 6202e2294295b98bbfd580584fcebabf2157207d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed,  4 Dec 2019 14:11:14 +0100

add TODO

Diffstat:
Msrc/main.c | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -21,6 +21,22 @@ along with * @brief main functionality of the application * @author Boss Marco * @author Christian Grothoff +* +* TODO: +* - comment code (Boss) +* - replace remaining MDB magic constants with #defines (Hofer) +* - support command line option to "disable_mdb" to run without +* connected MDB (instead of failing to launch); in this +* mode, print out what WOULD be done with MDB (Grothoff) +* - in keyboard interaction, distinguish between +* payment pending and payment not pending, allow +* 'c', only if pending (Grothoff) +* - have new state for waiting for MDB to signal vend success/failure +* in keyboard interaction prompt for success y/n at that time (or c cancel) (Grothoff) +* - add key strokes for "failure to vend" and "vend successful" +* (useful when faking MDB interaction), factor out function for + the respective operations! (Grothoff) +* - implement refunds on failure to vend (TBD) */ #include "config.h" #include <stdio.h> @@ -440,6 +456,11 @@ static char *framebuffer_device_filename; static char *uart_device_filename; /** + * Global option '-d' to disable MDB set. + */ +static int disable_mdb; + +/** * Taler wallet application identifier */ static const uint8_t taler_aid[] = { 0xF0, 0x00, 0x54, 0x41, 0x4c, 0x45, 0x52 }; @@ -1618,6 +1639,8 @@ run_mdb_event_loop () { struct GNUNET_DISK_FileHandle fh = { mdb.uartfd }; + if (disable_mdb) + return; if ( (GNUNET_NO == mdb.session_running) && (NULL == mdb.cmd) && (NULL == mdb.last_cmd) ) @@ -1724,6 +1747,8 @@ mdb_init () { struct termios uart_opts_raw; + if (disable_mdb) + return GNUNET_OK; /* open uart connection */ if (0 > (mdb.uartfd = open (uart_device_filename, O_RDWR | O_NOCTTY | O_NDELAY))) @@ -2056,6 +2081,10 @@ main (int argc, int ret; /* the available command line options */ struct GNUNET_GETOPT_CommandLineOption options[] = { + GNUNET_GETOPT_option_flag ('d', + "disable-mdb", + "disable all interactions with the MDB (for testing without machine)", + &disable_mdb), GNUNET_GETOPT_OPTION_END }; int have_tty;