aboutsummaryrefslogtreecommitdiff
path: root/src/include/taler_util.h
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-05-12 13:40:22 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-05-12 13:40:22 +0200
commit4833234df63d7da774299b336adb925e700bd4b4 (patch)
treeabb478b860c2d3f292ded9364300ce73b1d60d11 /src/include/taler_util.h
parent9130cda9e775131d3ced613b7f238a4c9e43ad5a (diff)
parentff1a28319fe31741958a0b1cfa761fd44878db45 (diff)
downloadexchange-4833234df63d7da774299b336adb925e700bd4b4.tar.xz
Merge branch 'master' into age-withdraw
Diffstat (limited to 'src/include/taler_util.h')
-rw-r--r--src/include/taler_util.h64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 8192ed87c..1de264c12 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2021 Taler Systems SA
+ Copyright (C) 2014-2023 Taler Systems SA
TALER 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
@@ -230,6 +230,16 @@ TALER_OS_init (void);
/**
+ * Re-encode string at @a inp to match RFC 8785 (section 3.2.2.2).
+ *
+ * @param[in,out] inp pointer to string to re-encode
+ * @return number of bytes in resulting @a inp
+ */
+size_t
+TALER_rfc8785encode (char **inp);
+
+
+/**
* URL-encode a string according to rfc3986.
*
* @param s string to encode
@@ -559,6 +569,58 @@ enum GNUNET_GenericReturnValue
TALER_JSON_parse_age_groups (const json_t *root,
struct TALER_AgeMask *mask);
+
+/**
+ * Handle to an external process that will assist
+ * with some JSON-to-JSON conversion.
+ */
+struct TALER_JSON_ExternalConversion;
+
+/**
+ * Type of a callback that receives a JSON @a result.
+ *
+ * @param cls closure
+ * @param status_type how did the process die
+ * @param code termination status code from the process
+ * @param result some JSON result, NULL if we failed to get an JSON output
+ */
+typedef void
+(*TALER_JSON_JsonCallback) (void *cls,
+ enum GNUNET_OS_ProcessStatusType status_type,
+ unsigned long code,
+ const json_t *result);
+
+
+/**
+ * Launch some external helper @a binary to convert some @a input
+ * and eventually call @a cb with the result.
+ *
+ * @param input JSON to serialize and pass to the helper process
+ * @param cb function to call on the result
+ * @param cb_cls closure for @a cb
+ * @param binary name of the binary to execute
+ * @param ... NULL-terminated list of arguments for the @a binary,
+ * usually starting with again the name of the binary
+ * @return handle to cancel the operation (and kill the helper)
+ */
+struct TALER_JSON_ExternalConversion *
+TALER_JSON_external_conversion_start (const json_t *input,
+ TALER_JSON_JsonCallback cb,
+ void *cb_cls,
+ const char *binary,
+ ...);
+
+/**
+ * Abort external conversion, killing the process and preventing
+ * the callback from being called. Must not be called after the
+ * callback was invoked.
+ *
+ * @param[in] ec external conversion handle to cancel
+ */
+void
+TALER_JSON_external_conversion_stop (
+ struct TALER_JSON_ExternalConversion *ec);
+
#undef __TALER_UTIL_LIB_H_INSIDE__
#endif