aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api_cmd_start_peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport_api_cmd_start_peer.c')
-rw-r--r--src/transport/transport_api_cmd_start_peer.c168
1 files changed, 14 insertions, 154 deletions
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c
index 52eacabb2..be2ea25b4 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -167,7 +167,7 @@ start_peer_run (void *cls,
167 char *emsg = NULL; 167 char *emsg = NULL;
168 struct GNUNET_PeerIdentity dummy; 168 struct GNUNET_PeerIdentity dummy;
169 const struct GNUNET_TESTING_Command *system_cmd; 169 const struct GNUNET_TESTING_Command *system_cmd;
170 struct GNUNET_TESTING_System *tl_system; 170 const struct GNUNET_TESTING_System *tl_system;
171 char *home; 171 char *home;
172 char *transport_unix_path; 172 char *transport_unix_path;
173 char *tcp_communicator_unix_path; 173 char *tcp_communicator_unix_path;
@@ -251,7 +251,8 @@ start_peer_run (void *cls,
251 sps->no); 251 sps->no);
252 252
253 if (GNUNET_SYSERR == 253 if (GNUNET_SYSERR ==
254 GNUNET_TESTING_configuration_create (tl_system, 254 GNUNET_TESTING_configuration_create ((struct
255 GNUNET_TESTING_System *) tl_system,
255 sps->cfg)) 256 sps->cfg))
256 { 257 {
257 LOG (GNUNET_ERROR_TYPE_DEBUG, 258 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -262,7 +263,9 @@ start_peer_run (void *cls,
262 return; 263 return;
263 } 264 }
264 265
265 sps->peer = GNUNET_TESTING_peer_configure (sps->tl_system, 266 sps->peer = GNUNET_TESTING_peer_configure ((struct
267 GNUNET_TESTING_System *) sps->
268 tl_system,
266 sps->cfg, 269 sps->cfg,
267 sps->no, 270 sps->no,
268 NULL, 271 NULL,
@@ -407,36 +410,14 @@ start_peer_traits (void *cls,
407 410
408 411
409 struct GNUNET_TESTING_Trait traits[] = { 412 struct GNUNET_TESTING_Trait traits[] = {
410 { 413 GNUNET_TRANSPORT_make_trait_application_handle ((const void *) ah),
411 .index = 0, 414 GNUNET_TRANSPORT_make_trait_peer_id ((const void *) id),
412 .trait_name = "application_handle", 415 GNUNET_TRANSPORT_make_trait_connected_peers_map ((const
413 .ptr = (const void *) ah, 416 void *)
414 }, 417 connected_peers_map),
415 { 418 GNUNET_TRANSPORT_make_trait_hello ((const void *) hello),
416 .index = 1, 419 GNUNET_TRANSPORT_make_trait_hello_size ((const void *) hello_size),
417 .trait_name = "peer_id", 420 GNUNET_TRANSPORT_make_trait_state ((const void *) sps),
418 .ptr = (const void *) id,
419 },
420 {
421 .index = 2,
422 .trait_name = "connected_peers_map",
423 .ptr = (const void *) connected_peers_map,
424 },
425 {
426 .index = 3,
427 .trait_name = "hello",
428 .ptr = (const void *) hello,
429 },
430 {
431 .index = 4,
432 .trait_name = "hello_size",
433 .ptr = (const void *) hello_size,
434 },
435 {
436 .index = 5,
437 .trait_name = "state",
438 .ptr = (const void *) sps,
439 },
440 GNUNET_TESTING_trait_end () 421 GNUNET_TESTING_trait_end ()
441 }; 422 };
442 423
@@ -448,127 +429,6 @@ start_peer_traits (void *cls,
448 429
449 430
450/** 431/**
451 * Function to get the trait with the struct StartPeerState.
452 *
453 * @param[out] sps struct StartPeerState.
454 * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
455 *
456 */
457int
458GNUNET_TRANSPORT_get_trait_state (
459 const struct GNUNET_TESTING_Command *cmd,
460 struct StartPeerState **sps)
461{
462 return cmd->traits (cmd->cls,
463 (const void **) sps,
464 "state",
465 (unsigned int) 5);
466}
467
468
469/**
470 * Function to get the trait with the size of the hello.
471 *
472 * @param[out] hello_size size of hello.
473 * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
474 *
475 */
476int
477GNUNET_TRANSPORT_get_trait_hello_size (const struct
478 GNUNET_TESTING_Command
479 *cmd,
480 size_t **hello_size)
481{
482 return cmd->traits (cmd->cls,
483 (const void **) hello_size,
484 "hello_size",
485 (unsigned int) 4);
486}
487
488
489/**
490 * Function to get the trait with the hello.
491 *
492 * @param[out] hello The hello for the peer.
493 * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
494 *
495 */
496int
497GNUNET_TRANSPORT_get_trait_hello (const struct
498 GNUNET_TESTING_Command
499 *cmd,
500 char **hello)
501{
502 return cmd->traits (cmd->cls,
503 (const void **) hello,
504 "hello",
505 (unsigned int) 3);
506}
507
508
509/**
510 * Function to get the trait with the map of connected peers.
511 *
512 * @param[out] connected_peers_map The map with connected peers.
513 * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
514 *
515 */
516int
517GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct
518 GNUNET_TESTING_Command
519 *cmd,
520 struct
521 GNUNET_CONTAINER_MultiShortmap
522 *
523 *
524 connected_peers_map)
525{
526 return cmd->traits (cmd->cls,
527 (const void **) connected_peers_map,
528 "connected_peers_map",
529 (unsigned int) 2);
530}
531
532
533/**
534 * Function to get the trait with the transport application handle.
535 *
536 * @param[out] ah The application handle.
537 * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
538 */
539int
540GNUNET_TRANSPORT_get_trait_application_handle (const struct
541 GNUNET_TESTING_Command *cmd,
542 struct
543 GNUNET_TRANSPORT_ApplicationHandle
544 **ah)
545{
546 return cmd->traits (cmd->cls,
547 (const void **) ah,
548 "application_handle",
549 (unsigned int) 0);
550}
551
552
553/**
554 * Function to get the trait with the peer id.
555 *
556 * @param[out] id The peer id.
557 * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
558 */
559int
560GNUNET_TRANSPORT_get_trait_peer_id (const struct
561 GNUNET_TESTING_Command *cmd,
562 struct GNUNET_PeerIdentity **id)
563{
564 return cmd->traits (cmd->cls,
565 (const void **) id,
566 "peer_id",
567 (unsigned int) 1);
568}
569
570
571/**
572 * Create command. 432 * Create command.
573 * 433 *
574 * @param label name for command. 434 * @param label name for command.