offer url trait

This commit is contained in:
Marcello Stanisci 2018-02-14 12:46:01 +01:00
parent fe6960cce8
commit 5b1e17617f
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
4 changed files with 81 additions and 2 deletions

View File

@ -89,7 +89,7 @@ wirewatch_run (void *cls,
*/
static void
wirewatch_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd)
const struct TALER_TESTING_Command *cmd)
{
struct WirewatchState *ws = cls;
@ -141,6 +141,10 @@ wirewatch_traits (void *cls,
/**
* Execute taler-exchange-wirewatch process.
*
* @param label command label
* @param config_filename configuration filename
*
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_wirewatch (const char *label,

View File

@ -537,7 +537,6 @@ main_wrapper (void *cls)
main_ctx)) );
GNUNET_free (exchange_url);
GNUNET_CONFIGURATION_destroy (cfg);
}
@ -586,6 +585,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
GNUNET_assert (NULL != sigpipe);
shc_chld = GNUNET_SIGNAL_handler_install
(GNUNET_SIGCHLD, &sighandler_child_death);
/* Blocking */
GNUNET_SCHEDULER_run (&main_wrapper,
&main_ctx);
GNUNET_SIGNAL_handler_uninstall (shc_chld);

View File

@ -34,6 +34,7 @@
#define TALER_TESTING_TRAIT_CONTRACT_TERMS "contract-terms"
#define TALER_TESTING_TRAIT_TRANSFER_SUBJECT "transfer-subject"
#define TALER_TESTING_TRAIT_AMOUNT "amount"
#define TALER_TESTING_TRAIT_URL "url"
/**
* Obtain contract terms from @a cmd.
@ -206,4 +207,49 @@ TALER_TESTING_make_trait_amount
}
/**
* Obtain a url from @a cmd.
*
* @param cmd command to extract trait from
* @param index which url is to be picked, in case
* multiple are offered.
* @param amount[out] where to write the url.
* @return #GNUNET_OK on success
*/
int
TALER_TESTING_get_trait_url
(const struct TALER_TESTING_Command *cmd,
unsigned int index,
const char **url)
{
return cmd->traits (cmd->cls,
(void **) url,
TALER_TESTING_TRAIT_URL,
index);
}
/**
* Offer url in a trait.
*
* @param index which url is to be picked, in case
* multiple are offered.
* @param url the url to offer
* @return the trait, to be put in the traits array of the command
*/
struct TALER_TESTING_Trait
TALER_TESTING_make_trait_url
(unsigned int index,
const char *url)
{
struct TALER_TESTING_Trait ret = {
.index = index,
.trait_name = TALER_TESTING_TRAIT_URL,
.ptr = (const void *) url
};
return ret;
}
/* end of testing_api_trait_string.c */

View File

@ -1251,4 +1251,33 @@ TALER_TESTING_get_trait_amount
unsigned int index,
const char **amount);
/**
* Offer url in a trait.
*
* @param index which url is to be picked, in case
* multiple are offered.
* @param url the url to offer
* @return the trait, to be put in the traits array of the command
*/
struct TALER_TESTING_Trait
TALER_TESTING_make_trait_url
(unsigned int index,
const char *url);
/**
* Obtain a url from @a cmd.
*
* @param cmd command to extract trait from
* @param index which url is to be picked, in case
* multiple are offered.
* @param amount[out] where to write the url.
* @return #GNUNET_OK on success
*/
int
TALER_TESTING_get_trait_url
(const struct TALER_TESTING_Command *cmd,
unsigned int index,
const char **url);
#endif