#include "platform.h"
#include <stdio.h>
#include <stdbool.h>
#include <signal.h>
#include <zbar.h>
#include "gnunet_util_lib.h"
Go to the source code of this file.
Macros | |
#define | LOG(fmt, ...) |
Macro to handle verbosity when printing messages. More... | |
Functions | |
static void | shutdown_program (void *cls) |
Executed when program is terminating. More... | |
static void | wait_child (void *cls, enum GNUNET_OS_ProcessStatusType type, long unsigned int code) |
Callback executed when the child process terminates. More... | |
static void | handle_uri (void *cls, const char *uri, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Dispatch URIs to the appropriate GNUnet helper process. More... | |
static const zbar_symbol_t * | get_symbol (zbar_processor_t *proc) |
Obtain a QR code symbol from proc. More... | |
static char * | run_zbar (void) |
Run the zbar QR code parser. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function executed by the scheduler. More... | |
int | main (int argc, char *const *argv) |
Variables | |
static int | exit_code = 0 |
Global exit code. More... | |
static char * | device = NULL |
Video device to capture from. More... | |
static unsigned int | verbosity = 0 |
Requested verbosity. More... | |
struct GNUNET_OS_Process * | childproc = NULL |
Child process handle. More... | |
static struct GNUNET_ChildWaitHandle * | waitchildproc = NULL |
Child process handle for waiting. More... | |
Definition in file gnunet-qr.c.
#define LOG | ( | fmt, | |
... | |||
) |
Macro to handle verbosity when printing messages.
Definition at line 79 of file gnunet-qr.c.
|
static |
Executed when program is terminating.
Definition at line 97 of file gnunet-qr.c.
References childproc, GNUNET_OS_process_kill(), GNUNET_wait_child_cancel(), and waitchildproc.
Referenced by run().
|
static |
Callback executed when the child process terminates.
cls | closure |
type | status of the child process |
code | the exit code of the child process |
Definition at line 119 of file gnunet-qr.c.
References _, childproc, exit_code, GNUNET_free, GNUNET_OS_process_destroy(), GNUNET_SCHEDULER_shutdown(), uri, and waitchildproc.
Referenced by handle_uri().
|
static |
Dispatch URIs to the appropriate GNUnet helper process.
cls | closure |
uri | URI to dispatch |
cfgfile | name of the configuration file in use |
cfg | the configuration in use |
Definition at line 153 of file gnunet-qr.c.
References _, cfg, childproc, exit_code, GNUNET_array_append, GNUNET_array_grow, GNUNET_CONFIGURATION_get_value_string(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_OS_INHERIT_STD_ALL, GNUNET_OS_start_process_vap(), GNUNET_strdup, GNUNET_strndup, GNUNET_wait_child(), subsystem, uri, wait_child(), and waitchildproc.
Referenced by run().
|
static |
Obtain a QR code symbol from proc.
proc | the zbar processor to use |
Definition at line 243 of file gnunet-qr.c.
References _, device, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, LOG, and GNUNET_ChildWaitHandle::proc.
Referenced by run_zbar().
|
static |
Run the zbar QR code parser.
Definition at line 304 of file gnunet-qr.c.
References _, data, device, get_symbol(), GNUNET_break, GNUNET_free, GNUNET_strdup, LOG, and GNUNET_ChildWaitHandle::proc.
Referenced by run().
|
static |
Main function executed by the scheduler.
cls | closure |
args | remaining command line arguments |
cfgfile | name of the configuration file being used |
cfg | the used configuration |
Definition at line 544 of file gnunet-qr.c.
References _, cfg, data, exit_code, GNUNET_free, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), handle_uri(), LOG, run_zbar(), and shutdown_program().
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Definition at line 587 of file gnunet-qr.c.
References device, exit_code, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_string(), GNUNET_GETOPT_option_verbose(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, ret, run(), and verbosity.
|
static |
Global exit code.
Set to non-zero if an error occurs after the scheduler has started.
Definition at line 43 of file gnunet-qr.c.
Referenced by child_completed_callback(), handle_uri(), main(), maint_child_death(), run(), and wait_child().
|
static |
Video device to capture from.
Used by default if PNG support is disabled or no PNG file is specified. Defaults to /dev/video0.
Definition at line 50 of file gnunet-qr.c.
Referenced by get_symbol(), main(), and run_zbar().
|
static |
struct GNUNET_OS_Process* childproc = NULL |
Child process handle.
Definition at line 69 of file gnunet-qr.c.
Referenced by handle_uri(), shutdown_program(), and wait_child().
|
static |
Child process handle for waiting.
Definition at line 74 of file gnunet-qr.c.
Referenced by handle_uri(), shutdown_program(), and wait_child().