diff options
Diffstat (limited to 'src/multicast/test_multicast_multipeer.c')
-rw-r--r-- | src/multicast/test_multicast_multipeer.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src/multicast/test_multicast_multipeer.c b/src/multicast/test_multicast_multipeer.c index bb3ae447c..1b76737f4 100644 --- a/src/multicast/test_multicast_multipeer.c +++ b/src/multicast/test_multicast_multipeer.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #define NUM_PEERS 2 | 36 | #define NUM_PEERS 2 |
37 | 37 | ||
38 | static struct GNUNET_TESTBED_Operation *op0; | 38 | static struct GNUNET_TESTBED_Operation *op0; |
39 | static struct GNUNET_TESTBED_Operation *op1; | 39 | static struct GNUNET_TESTBED_Operation *op1; |
40 | static struct GNUNET_TESTBED_Operation *pi_op0; | 40 | static struct GNUNET_TESTBED_Operation *pi_op0; |
41 | static struct GNUNET_TESTBED_Operation *pi_op1; | 41 | static struct GNUNET_TESTBED_Operation *pi_op1; |
@@ -115,19 +115,19 @@ timeout_task (void *cls) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | static void | 118 | static void |
119 | member_join_request (void *cls, | 119 | member_join_request (void *cls, |
120 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, | 120 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, |
121 | const struct GNUNET_MessageHeader *join_msg, | 121 | const struct GNUNET_MessageHeader *join_msg, |
122 | struct GNUNET_MULTICAST_JoinHandle *jh) | 122 | struct GNUNET_MULTICAST_JoinHandle *jh) |
123 | { | 123 | { |
124 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 124 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
125 | "Member sent a join request.\n"); | 125 | "Member sent a join request.\n"); |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | static void | 130 | static void |
131 | member_join_decision (void *cls, | 131 | member_join_decision (void *cls, |
132 | int is_admitted, | 132 | int is_admitted, |
133 | const struct GNUNET_PeerIdentity *peer, | 133 | const struct GNUNET_PeerIdentity *peer, |
@@ -135,49 +135,49 @@ member_join_decision (void *cls, | |||
135 | const struct GNUNET_PeerIdentity *relays, | 135 | const struct GNUNET_PeerIdentity *relays, |
136 | const struct GNUNET_MessageHeader *join_msg) | 136 | const struct GNUNET_MessageHeader *join_msg) |
137 | { | 137 | { |
138 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 138 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
139 | "Member received a decision from origin: %s\n", (GNUNET_YES == is_admitted)?"accepted":"rejected"); | 139 | "Member received a decision from origin: %s\n", (GNUNET_YES == is_admitted)?"accepted":"rejected"); |
140 | 140 | ||
141 | result = GNUNET_OK; | 141 | result = GNUNET_OK; |
142 | GNUNET_SCHEDULER_shutdown (); | 142 | GNUNET_SCHEDULER_shutdown (); |
143 | } | 143 | } |
144 | 144 | ||
145 | static void | 145 | static void |
146 | member_replay_frag () | 146 | member_replay_frag () |
147 | { | 147 | { |
148 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 148 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
149 | "member replay frag...\n"); | 149 | "member replay frag...\n"); |
150 | } | 150 | } |
151 | 151 | ||
152 | static void | 152 | static void |
153 | member_replay_msg () | 153 | member_replay_msg () |
154 | { | 154 | { |
155 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 155 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
156 | "member replay msg...\n"); | 156 | "member replay msg...\n"); |
157 | } | 157 | } |
158 | 158 | ||
159 | static void | 159 | static void |
160 | member_message () | 160 | member_message () |
161 | { | 161 | { |
162 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 162 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
163 | "member message...\n"); | 163 | "member message...\n"); |
164 | } | 164 | } |
165 | 165 | ||
166 | static void | 166 | static void |
167 | origin_join_request (void *cls, | 167 | origin_join_request (void *cls, |
168 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, | 168 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, |
169 | const struct GNUNET_MessageHeader *join_msg, | 169 | const struct GNUNET_MessageHeader *join_msg, |
170 | struct GNUNET_MULTICAST_JoinHandle *jh) | 170 | struct GNUNET_MULTICAST_JoinHandle *jh) |
171 | { | 171 | { |
172 | struct GNUNET_MessageHeader *join_resp; | 172 | struct GNUNET_MessageHeader *join_resp; |
173 | 173 | ||
174 | uint8_t data_size = ntohs (join_msg->size); | 174 | uint8_t data_size = ntohs (join_msg->size); |
175 | 175 | ||
176 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 176 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
177 | "Dizzy: Mh, got a join request...\n"); | 177 | "Dizzy: Mh, got a join request...\n"); |
178 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 178 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
179 | "'%s'\n", (char *)&join_msg[1]); | 179 | "'%s'\n", (char *)&join_msg[1]); |
180 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 180 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
181 | "Dizzy: Oh, it's Bird! Let's get him in.\n"); | 181 | "Dizzy: Oh, it's Bird! Let's get him in.\n"); |
182 | 182 | ||
183 | char data[] = "Hi, Bird. Come in!"; | 183 | char data[] = "Hi, Bird. Come in!"; |
@@ -196,7 +196,7 @@ origin_join_request (void *cls, | |||
196 | result = GNUNET_OK; | 196 | result = GNUNET_OK; |
197 | } | 197 | } |
198 | 198 | ||
199 | static void | 199 | static void |
200 | origin_replay_frag (void *cls, | 200 | origin_replay_frag (void *cls, |
201 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, | 201 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, |
202 | uint64_t fragment_id, | 202 | uint64_t fragment_id, |
@@ -206,15 +206,15 @@ origin_replay_frag (void *cls, | |||
206 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin replay fraq msg\n"); | 206 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin replay fraq msg\n"); |
207 | } | 207 | } |
208 | 208 | ||
209 | static void | 209 | static void |
210 | origin_replay_msg (void *cls, | 210 | origin_replay_msg (void *cls, |
211 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, | 211 | const struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key, |
212 | uint64_t message_id, | 212 | uint64_t message_id, |
213 | uint64_t fragment_offset, | 213 | uint64_t fragment_offset, |
214 | uint64_t flags, | 214 | uint64_t flags, |
215 | struct GNUNET_MULTICAST_ReplayHandle *rh) | 215 | struct GNUNET_MULTICAST_ReplayHandle *rh) |
216 | { | 216 | { |
217 | 217 | ||
218 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin replay msg\n"); | 218 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin replay msg\n"); |
219 | } | 219 | } |
220 | 220 | ||
@@ -223,12 +223,12 @@ origin_request (void *cls, | |||
223 | const struct GNUNET_MULTICAST_RequestHeader *req) | 223 | const struct GNUNET_MULTICAST_RequestHeader *req) |
224 | { | 224 | { |
225 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin request msg\n"); | 225 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin request msg\n"); |
226 | 226 | ||
227 | } | 227 | } |
228 | 228 | ||
229 | static void | 229 | static void |
230 | origin_message (void *cls, | 230 | origin_message (void *cls, |
231 | const struct GNUNET_MULTICAST_MessageHeader *msg) | 231 | const struct GNUNET_MULTICAST_MessageHeader *msg) |
232 | { | 232 | { |
233 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin message msg\n"); | 233 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin message msg\n"); |
234 | } | 234 | } |
@@ -240,11 +240,11 @@ service_connect1 (void *cls, | |||
240 | void *ca_result, | 240 | void *ca_result, |
241 | const char *emsg) | 241 | const char *emsg) |
242 | { | 242 | { |
243 | member = ca_result; | 243 | member = ca_result; |
244 | 244 | ||
245 | if (NULL != member) | 245 | if (NULL != member) |
246 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to multicast service of member\n"); | 246 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to multicast service of member\n"); |
247 | else | 247 | else |
248 | result = GNUNET_SYSERR; | 248 | result = GNUNET_SYSERR; |
249 | } | 249 | } |
250 | 250 | ||
@@ -264,21 +264,21 @@ multicast_ca1 (void *cls, | |||
264 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 264 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
265 | { | 265 | { |
266 | struct GNUNET_MessageHeader *join_msg; | 266 | struct GNUNET_MessageHeader *join_msg; |
267 | 267 | ||
268 | // Get members keys | 268 | // Get members keys |
269 | member_key = GNUNET_CRYPTO_ecdsa_key_create (); | 269 | member_key = GNUNET_CRYPTO_ecdsa_key_create (); |
270 | GNUNET_CRYPTO_ecdsa_key_get_public (member_key, &member_pub_key); | 270 | GNUNET_CRYPTO_ecdsa_key_get_public (member_key, &member_pub_key); |
271 | 271 | ||
272 | char data[] = "Whut's up, Dizzy!"; | 272 | char data[] = "Whut's up, Dizzy!"; |
273 | uint8_t data_size = strlen (data) + 1; | 273 | uint8_t data_size = strlen (data) + 1; |
274 | join_msg = GNUNET_malloc (sizeof (join_msg) + data_size); | 274 | join_msg = GNUNET_malloc (sizeof (join_msg) + data_size); |
275 | join_msg->size = htons (sizeof (join_msg) + data_size); | 275 | join_msg->size = htons (sizeof (join_msg) + data_size); |
276 | join_msg->type = htons (123); | 276 | join_msg->type = htons (123); |
277 | GNUNET_memcpy (&join_msg[1], data, data_size); | 277 | GNUNET_memcpy (&join_msg[1], data, data_size); |
278 | 278 | ||
279 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 279 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
280 | "Members tries to join multicast group\n"); | 280 | "Members tries to join multicast group\n"); |
281 | 281 | ||
282 | return GNUNET_MULTICAST_member_join (cfg, | 282 | return GNUNET_MULTICAST_member_join (cfg, |
283 | &group_pub_key, | 283 | &group_pub_key, |
284 | member_key, | 284 | member_key, |
@@ -301,13 +301,13 @@ peer_information_cb (void *cls, | |||
301 | const struct GNUNET_TESTBED_PeerInformation *pinfo, | 301 | const struct GNUNET_TESTBED_PeerInformation *pinfo, |
302 | const char *emsg) | 302 | const char *emsg) |
303 | { | 303 | { |
304 | int i = (int) cls; | 304 | int i = (int) (long) cls; |
305 | 305 | ||
306 | if (NULL == pinfo) { | 306 | if (NULL == pinfo) { |
307 | result = GNUNET_SYSERR; | 307 | result = GNUNET_SYSERR; |
308 | GNUNET_SCHEDULER_shutdown (); | 308 | GNUNET_SCHEDULER_shutdown (); |
309 | } | 309 | } |
310 | 310 | ||
311 | peer_id[i] = pinfo->result.id; | 311 | peer_id[i] = pinfo->result.id; |
312 | 312 | ||
313 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 313 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -376,13 +376,13 @@ service_connect0 (void *cls, | |||
376 | * Function run when service multicast has started and is providing us | 376 | * Function run when service multicast has started and is providing us |
377 | * with a configuration file. | 377 | * with a configuration file. |
378 | */ | 378 | */ |
379 | static void * | 379 | static void * |
380 | multicast_ca0 (void *cls, | 380 | multicast_ca0 (void *cls, |
381 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 381 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
382 | { | 382 | { |
383 | group_key = GNUNET_CRYPTO_eddsa_key_create (); | 383 | group_key = GNUNET_CRYPTO_eddsa_key_create (); |
384 | GNUNET_CRYPTO_eddsa_key_get_public (group_key, &group_pub_key); | 384 | GNUNET_CRYPTO_eddsa_key_get_public (group_key, &group_pub_key); |
385 | 385 | ||
386 | return GNUNET_MULTICAST_origin_start (cfg, | 386 | return GNUNET_MULTICAST_origin_start (cfg, |
387 | group_key, | 387 | group_key, |
388 | 0, | 388 | 0, |
@@ -433,7 +433,7 @@ testbed_master (void *cls, | |||
433 | topology (FIXME) */ | 433 | topology (FIXME) */ |
434 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 434 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
435 | "Connected to testbed_master()\n"); | 435 | "Connected to testbed_master()\n"); |
436 | 436 | ||
437 | peers = p; | 437 | peers = p; |
438 | 438 | ||
439 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 439 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -451,7 +451,7 @@ testbed_master (void *cls, | |||
451 | NULL); /* closure for the above two callbacks */ | 451 | NULL); /* closure for the above two callbacks */ |
452 | 452 | ||
453 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); /* Schedule a new task on shutdown */ | 453 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); /* Schedule a new task on shutdown */ |
454 | 454 | ||
455 | /* Schedule the shutdown task with a delay of a few Seconds */ | 455 | /* Schedule the shutdown task with a delay of a few Seconds */ |
456 | timeout_tid = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 40), | 456 | timeout_tid = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 40), |
457 | &timeout_task, NULL); | 457 | &timeout_task, NULL); |