diff options
Diffstat (limited to 'src/testing/testing_api_cmd_send_peer_ready.c')
-rw-r--r-- | src/testing/testing_api_cmd_send_peer_ready.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c index 27761c4d5..016837214 100644 --- a/src/testing/testing_api_cmd_send_peer_ready.c +++ b/src/testing/testing_api_cmd_send_peer_ready.c | |||
@@ -26,18 +26,33 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_testing_ng_lib.h" | 28 | #include "gnunet_testing_ng_lib.h" |
29 | #include "testbed_api.h" | 29 | #include "testing_cmds.h" |
30 | #include "testbed_helper.h" | ||
31 | 30 | ||
32 | 31 | ||
32 | /** | ||
33 | * Struct to hold information for callbacks. | ||
34 | * | ||
35 | */ | ||
33 | struct SendPeerReadyState | 36 | struct SendPeerReadyState |
34 | { | 37 | { |
35 | TESTBED_CMD_HELPER_write_cb write_message; | 38 | /** |
36 | 39 | * Callback to write messages to the master loop. | |
40 | * | ||
41 | */ | ||
42 | TESTING_CMD_HELPER_write_cb write_message; | ||
43 | |||
44 | /** | ||
45 | * The message send back to the master loop. | ||
46 | * | ||
47 | */ | ||
37 | struct GNUNET_CMDS_PEER_STARTED *reply; | 48 | struct GNUNET_CMDS_PEER_STARTED *reply; |
38 | }; | 49 | }; |
39 | 50 | ||
40 | 51 | ||
52 | /** | ||
53 | * Trait function of this cmd does nothing. | ||
54 | * | ||
55 | */ | ||
41 | static int | 56 | static int |
42 | send_peer_ready_traits (void *cls, | 57 | send_peer_ready_traits (void *cls, |
43 | const void **ret, | 58 | const void **ret, |
@@ -48,6 +63,10 @@ send_peer_ready_traits (void *cls, | |||
48 | } | 63 | } |
49 | 64 | ||
50 | 65 | ||
66 | /** | ||
67 | * The cleanup function of this cmd frees resources the cmd allocated. | ||
68 | * | ||
69 | */ | ||
51 | static void | 70 | static void |
52 | send_peer_ready_cleanup (void *cls, | 71 | send_peer_ready_cleanup (void *cls, |
53 | const struct GNUNET_TESTING_Command *cmd) | 72 | const struct GNUNET_TESTING_Command *cmd) |
@@ -59,6 +78,10 @@ send_peer_ready_cleanup (void *cls, | |||
59 | } | 78 | } |
60 | 79 | ||
61 | 80 | ||
81 | /** | ||
82 | * This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop. | ||
83 | * | ||
84 | */ | ||
62 | static void | 85 | static void |
63 | send_peer_ready_run (void *cls, | 86 | send_peer_ready_run (void *cls, |
64 | const struct GNUNET_TESTING_Command *cmd, | 87 | const struct GNUNET_TESTING_Command *cmd, |
@@ -68,7 +91,7 @@ send_peer_ready_run (void *cls, | |||
68 | struct GNUNET_CMDS_PEER_STARTED *reply; | 91 | struct GNUNET_CMDS_PEER_STARTED *reply; |
69 | size_t msg_length; | 92 | size_t msg_length; |
70 | 93 | ||
71 | msg_length = sizeof(struct GNUNET_CMDS_HelperInit);// GNUNET_CMDS_PEER_STARTED); | 94 | msg_length = sizeof(struct GNUNET_CMDS_PEER_STARTED); |
72 | reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED); | 95 | reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED); |
73 | reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED); | 96 | reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED); |
74 | reply->header.size = htons ((uint16_t) msg_length); | 97 | reply->header.size = htons ((uint16_t) msg_length); |
@@ -81,11 +104,12 @@ send_peer_ready_run (void *cls, | |||
81 | * Create command. | 104 | * Create command. |
82 | * | 105 | * |
83 | * @param label name for command. | 106 | * @param label name for command. |
107 | * @param write_message Callback to write messages to the master loop. | ||
84 | * @return command. | 108 | * @return command. |
85 | */ | 109 | */ |
86 | struct GNUNET_TESTING_Command | 110 | struct GNUNET_TESTING_Command |
87 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, | 111 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, |
88 | TESTBED_CMD_HELPER_write_cb write_message) | 112 | TESTING_CMD_HELPER_write_cb write_message) |
89 | { | 113 | { |
90 | struct SendPeerReadyState *sprs; | 114 | struct SendPeerReadyState *sprs; |
91 | 115 | ||