diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-12-12 17:35:29 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-12-12 17:35:29 +0100 |
commit | 835a95d7f5e5d3b685bfe0bf5c26ac717218edd6 (patch) | |
tree | 7921012ac42f7c8f90272cd54b4e6b632c97c375 /src/include | |
parent | ce95e4c95824848e4aa3fce883cbe0f83e1b7667 (diff) | |
parent | e74140ba481df945758153c76281006c62a63935 (diff) | |
download | merchant-835a95d7f5e5d3b685bfe0bf5c26ac717218edd6.tar.gz merchant-835a95d7f5e5d3b685bfe0bf5c26ac717218edd6.tar.bz2 merchant-835a95d7f5e5d3b685bfe0bf5c26ac717218edd6.zip |
Merge branch '4795'
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchant_service.h | 54 | ||||
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 28 |
2 files changed, 82 insertions, 0 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index eaf85caf..0ed6856e 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -28,6 +28,60 @@ #include <jansson.h> +/* ********************* /map/{in,out} *********************** */ + +struct TALER_MERCHANT_MapOutOperation; + +typedef void +(*TALER_MERCHANT_MapOperationCallback) (void *cls, + unsigned int http_status, + const json_t *body); + +/** + * Issue a /map/out request to the backend. + * + * @param ctx execution context + * @param backend_uri base URL of the merchant backend + * @param h_contract hashcode of `contract` + * @param map_in_cb callback which will work the response gotten from the backend + * @param map_in_cb_cls closure to pass to @a history_cb + * @return handle for this operation, NULL upon errors + */ +struct TALER_MERCHANT_MapOperation * +TALER_MERCHANT_map_out (struct GNUNET_CURL_Context *ctx, + const char *backend_uri, + const struct GNUNET_HashCode *h_contract, + TALER_MERCHANT_MapOperationCallback map_cb, + void *map_cb_cls); + +/** + * Issue a /map/in request to the backend. + * + * @param ctx execution context + * @param backend_uri base URL of the merchant backend + * @param contract contract to store + * @param h_contract hashcode of `contract` + * @param map_in_cb callback which will work the response gotten from the backend + * @param map_in_cb_cls closure to pass to @a history_cb + * @return handle for this operation, NULL upon errors + */ +struct TALER_MERCHANT_MapOperation * +TALER_MERCHANT_map_in (struct GNUNET_CURL_Context *ctx, + const char *backend_uri, + const json_t *contract, + const struct GNUNET_HashCode *h_contract, + TALER_MERCHANT_MapOperationCallback map_cb, + void *map_cb_cls); + +/** + * Cancel a /map/in request. + * + * @param mio handle to the request to be canceled + */ +void +TALER_MERCHANT_map_cancel (struct TALER_MERCHANT_MapOperation *mo); + + /* ********************* /contract *********************** */ diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 92375fb2..3923fde1 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -150,6 +150,34 @@ struct TALER_MERCHANTDB_Plugin /** + * Insert a hash to contract map into the database + * + * @param cls closure + * @param h_contract hashcode of @a contract + * @param contract contract to store + * @return #GNUNET_OK on success, #GNUNET_SYSERR upon error + */ + int + (*store_map) (void *cls, + struct GNUNET_HashCode *h_contract, + const json_t *contract); + + + /** + * Retrieve plain contract given its hashcode + * + * @param cls closure + * @param h_contract hashcode of the contract to retrieve + * @param contract where to store the retrieved contract + * @return #GNUNET_OK on success, #GNUNET_NO if no contract is + * found, #GNUNET_SYSERR upon error + */ + int + (*find_contract) (void *cls, + json_t **contract, + struct GNUNET_HashCode *h_contract); + + /** * Insert transaction data into the database. * * @param cls closure |