twister

HTTP fault injector for testing
Log | Files | Refs | README | LICENSE

commit 4392fab90a08daed0cd44802da04339d6b8a3ac1
parent 747ef703b46af9be76cd22da99b2cc1f83f17194
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Tue, 29 May 2018 16:36:02 +0200

Commenting the CLI utility

Diffstat:
Msrc/twister/taler-twister.c | 57++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 36 insertions(+), 21 deletions(-)

diff --git a/src/twister/taler-twister.c b/src/twister/taler-twister.c @@ -21,8 +21,8 @@ /** * @file taler-twister.c - * @brief - * @author + * @brief command line utility to batch commands to the twister. + * @author Marcello Stanisci */ #include "platform.h" @@ -39,8 +39,8 @@ static struct TALER_TWISTER_Handle *tth; static int status; /** - * What response code value should twister hack into the - * connection? 0 for no change. + * Response code to substitute to the genuine one. 0 for no + * substitution. */ static unsigned int hack_response_code; @@ -63,18 +63,26 @@ static int malform_response; static int malform_upload; /** - * Path to the string json object to flip. + * Path to the string-object to flip, belonging to the + * response JSON object. */ static char *flip_path_dl; + +/** + * Path to the string-object to flip, belonging to the + * request JSON object. + */ static char *flip_path_ul; /** - * Path to the download object to modify. + * Path to the field to modify, from the response JSON object. */ static char *modify_path_dl; - +/* + * Path to the field to modify, from the request JSON object. + */ static char *modify_path_ul; /** @@ -90,7 +98,7 @@ static char *modify_value; static int check_alive; /** - * Number of operations we launched. + * Number of operations we batched. */ static unsigned int num_ops; @@ -112,7 +120,7 @@ do_shutdown (void *cls) /** - * Callback to call when operation is complete + * Callback invoked after the twister batched one operation. * * @param cls NULL */ @@ -128,10 +136,7 @@ handle_acknowledgement (void *cls) /** - * Actual main function that runs the emulation. Just call - * the relevant API function - based on the CL option we read - * here - which then sends the twister service the message about - * the hack to do. + * Method that batches operations into the twister. * * @param cls unused * @param args remaining args, unused @@ -257,6 +262,8 @@ run (void *cls, /** * Main function. * + * @param argc number of CLI arguments given + 1. + * @param argv array of CLI arguments given, + the binary name. * @return 0 on success */ int @@ -270,7 +277,8 @@ main (int argc, "modify-ul", "PATH", gettext_noop - ("Modify upload object pointed by PATH, require --value.\n"), + ("Modify upload object pointed by PATH," + " require --value.\n"), &modify_path_ul), GNUNET_GETOPT_option_string @@ -278,7 +286,8 @@ main (int argc, "modify-dl", "PATH", gettext_noop - ("Modify download object pointed by PATH, require --value.\n"), + ("Modify download object pointed by PATH," + " require --value.\n"), &modify_path_dl), GNUNET_GETOPT_option_string @@ -286,7 +295,8 @@ main (int argc, "flip-ul", "PATH", gettext_noop - ("Flip a char in the *string* upload object pointed by PATH.\n"), + ("Flip a char in the *string* upload object" + " pointed by PATH.\n"), &flip_path_ul), GNUNET_GETOPT_option_string @@ -294,7 +304,8 @@ main (int argc, "flip-dl", "PATH", gettext_noop - ("Flip a char in the *string* download object pointed by PATH.\n"), + ("Flip a char in the *string* download" + " object pointed by PATH.\n"), &flip_path_dl), GNUNET_GETOPT_option_string @@ -317,26 +328,30 @@ main (int argc, GNUNET_GETOPT_option_flag ('a', "checkalive", - gettext_noop ("Check if twister accepts IPC connections\n"), + gettext_noop + ("Check if twister accepts IPC connections\n"), &check_alive), GNUNET_GETOPT_option_flag ('U', "malformupload", - gettext_noop ("Randomly truncate proxied request"), + gettext_noop + ("Randomly truncate proxied request"), &malform_upload), GNUNET_GETOPT_option_flag ('M', "malform", - gettext_noop ("Randomly truncate proxied response"), + gettext_noop + ("Randomly truncate proxied response"), &malform_response), GNUNET_GETOPT_option_uint ('r', "responsecode", "STATUS", - gettext_noop ("Set the next response code to STATUS"), + gettext_noop + ("Set the next response code to STATUS"), &hack_response_code), GNUNET_GETOPT_OPTION_END };