quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit f59b2d9567a16ab31b8ad8c138c0eef226caf7d4
parent 24a009cc08abfebc3d169c4fd55495335185634a
Author: Marc Stibane <marc@taler.net>
Date:   Wed, 28 Feb 2024 12:26:05 +0100

TALER_set_native_http_client_implementation

Diffstat:
Mtaler_wallet_core_lib.c | 16++++++++++++++++
Mtaler_wallet_core_lib_preprocessed.h | 14++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/taler_wallet_core_lib.c b/taler_wallet_core_lib.c @@ -334,3 +334,19 @@ TALER_set_http_client_implementation(struct TALER_WALLET_Instance *twi, { twi->http_impl = impl; } + +#pragma mark - +void +TALER_set_native_http_client_implementation(struct TALER_WALLET_Instance *twi, + JSHttpReqCreateFn req_create, + JSHttpReqCancelFn req_cancel, + void *handler_p) +{ + // will (and should!) crash if this tiny malloc fails + struct JSHttpClientImplementation *impl = malloc(sizeof *impl); + impl->cls = handler_p; + impl->req_create = req_create; + impl->req_cancel = req_cancel; + twi->http_impl = impl; + // no need to free impl, because this is a singleton +} diff --git a/taler_wallet_core_lib_preprocessed.h b/taler_wallet_core_lib_preprocessed.h @@ -372,4 +372,18 @@ void TALER_set_http_client_implementation(struct TALER_WALLET_Instance *twi, struct JSHttpClientImplementation *impl); +#pragma mark - +/** + * Set the native HTTP client implementation to be used by the wallet. + * + * @param twi wallet-core instance + * @param req_create HTTP client implementation + * @param req_cancel HTTP client implementation + */ +void +TALER_set_native_http_client_implementation(struct TALER_WALLET_Instance *twi, + JSHttpReqCreateFn req_create, + JSHttpReqCancelFn req_cancel, + void *handler_p); + #endif /*_TALER_WALLET_LIB_H */