From: Christian Grothoff Date: Thu, 29 Oct 2015 14:44:56 +0000 (+0000) Subject: -code cleanup X-Git-Tag: initial-import-from-subversion-38251~1164 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=07cf21cb24446f7e5f71e9c464fc471600909bb5;p=oweals%2Fgnunet.git -code cleanup --- diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 7af8e139e..b53bda514 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -73,7 +73,7 @@ unsigned long long quota_out_p2; struct GNUNET_TRANSPORT_TESTING_handle *tth; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; /* diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index 52d8c441f..69e83115c 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c @@ -108,7 +108,7 @@ static struct GNUNET_TRANSPORT_TransmitHandle *th; static struct GNUNET_TRANSPORT_TESTING_handle *tth; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static int test_connected; diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 30f4bbbab..171004204 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c @@ -66,7 +66,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_bidirectional_connect.c b/src/transport/test_transport_api_bidirectional_connect.c index 85925b1bf..5c9ae36fe 100644 --- a/src/transport/test_transport_api_bidirectional_connect.c +++ b/src/transport/test_transport_api_bidirectional_connect.c @@ -57,8 +57,8 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc1; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc2; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc1; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc2; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c index 0ea99c3a6..9c3a0c460 100644 --- a/src/transport/test_transport_api_blacklisting.c +++ b/src/transport/test_transport_api_blacklisting.c @@ -32,7 +32,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c index fe43b8e8c..7951c7678 100644 --- a/src/transport/test_transport_api_disconnect.c +++ b/src/transport/test_transport_api_disconnect.c @@ -55,7 +55,7 @@ struct PeerContext *p1; struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c index 4bc0133cb..9223c3bf2 100644 --- a/src/transport/test_transport_api_limited_sockets.c +++ b/src/transport/test_transport_api_limited_sockets.c @@ -63,7 +63,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c index aa1f57a2a..41ad7f68f 100644 --- a/src/transport/test_transport_api_manipulation_cfg.c +++ b/src/transport/test_transport_api_manipulation_cfg.c @@ -75,7 +75,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c b/src/transport/test_transport_api_manipulation_recv_tcp.c index 7be1cfd3a..8a820fa16 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp.c +++ b/src/transport/test_transport_api_manipulation_recv_tcp.c @@ -67,7 +67,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c index 4dae7e6aa..0a52556ab 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp.c +++ b/src/transport/test_transport_api_manipulation_send_tcp.c @@ -67,7 +67,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_monitor_peers.c b/src/transport/test_transport_api_monitor_peers.c index 13a7baec8..8cd952cc5 100644 --- a/src/transport/test_transport_api_monitor_peers.c +++ b/src/transport/test_transport_api_monitor_peers.c @@ -61,7 +61,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_monitor_validation.c b/src/transport/test_transport_api_monitor_validation.c index 0b2a73059..76fa66949 100644 --- a/src/transport/test_transport_api_monitor_validation.c +++ b/src/transport/test_transport_api_monitor_validation.c @@ -64,7 +64,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 0b80477bf..0561e1a10 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -161,7 +161,7 @@ static int test_send_timeout; */ static char bitmap[TOTAL_MSGS / 8]; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; /* * END Testcase specific declarations diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c index 5d51559b7..0e91fa68f 100644 --- a/src/transport/test_transport_api_restart_1peer.c +++ b/src/transport/test_transport_api_restart_1peer.c @@ -59,7 +59,7 @@ static struct PeerContext *p2; static int p2_connected; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c index db1c0920d..5b47ee1d3 100644 --- a/src/transport/test_transport_api_restart_2peers.c +++ b/src/transport/test_transport_api_restart_2peers.c @@ -54,7 +54,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c index 7ba74b2e9..dd0d9a344 100644 --- a/src/transport/test_transport_api_timeout.c +++ b/src/transport/test_transport_api_timeout.c @@ -58,7 +58,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; static struct GNUNET_TRANSPORT_TransmitHandle *th; diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c index 6f2ba91c0..a0720820d 100644 --- a/src/transport/test_transport_api_unreliability_constant.c +++ b/src/transport/test_transport_api_unreliability_constant.c @@ -66,7 +66,7 @@ char *cfg_file_p2; uint32_t max_bps_p1; uint32_t max_bps_p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; /* * Testcase specific declarations diff --git a/src/transport/test_transport_blacklisting.c b/src/transport/test_transport_blacklisting.c index 2972e7dae..3d3d009dc 100644 --- a/src/transport/test_transport_blacklisting.c +++ b/src/transport/test_transport_blacklisting.c @@ -58,7 +58,7 @@ struct PeerContext *p1; struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; struct GNUNET_TRANSPORT_TESTING_handle *tth; diff --git a/src/transport/test_transport_testing.c b/src/transport/test_transport_testing.c index 727d6b785..0c2043119 100644 --- a/src/transport/test_transport_testing.c +++ b/src/transport/test_transport_testing.c @@ -40,7 +40,7 @@ static struct PeerContext *p1; static struct PeerContext *p2; -static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; struct GNUNET_TRANSPORT_TESTING_handle *tth; diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 993103ac1..86c67a039 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2006, 2009 Christian Grothoff (and other contributing authors) + Copyright (C) 2006, 2009, 2015 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -48,12 +48,13 @@ find_peer_context (struct GNUNET_TRANSPORT_TESTING_handle *tth, } -static struct ConnectingContext * +static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * find_connecting_context (struct GNUNET_TRANSPORT_TESTING_handle *tth, - struct PeerContext *p1, struct PeerContext *p2) + struct PeerContext *p1, + struct PeerContext *p2) { GNUNET_assert (tth != NULL); - struct ConnectingContext *cc = tth->cc_head; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = tth->cc_head; while (cc != NULL) { @@ -69,7 +70,8 @@ find_connecting_context (struct GNUNET_TRANSPORT_TESTING_handle *tth, static void -notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) +notify_connect (void *cls, + const struct GNUNET_PeerIdentity *peer) { struct PeerContext *p = cls; char *p2_s; @@ -93,7 +95,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) GNUNET_free (p2_s); /* Find ConnectingContext */ - struct ConnectingContext *cc = find_connecting_context (p->tth, p, p2); + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = find_connecting_context (p->tth, p, p2); if (cc == NULL) return; @@ -113,7 +115,8 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) static void -notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) +notify_disconnect (void *cls, + const struct GNUNET_PeerIdentity *peer) { struct PeerContext *p = cls; @@ -149,7 +152,8 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) static void -notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, +notify_receive (void *cls, + const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { struct PeerContext *p = cls; @@ -162,7 +166,8 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, static void -get_hello (void *cb_cls, const struct GNUNET_MessageHeader *message) +get_hello (void *cb_cls, + const struct GNUNET_MessageHeader *message) { struct PeerContext *p = cb_cls; struct GNUNET_PeerIdentity hello_id; @@ -187,9 +192,10 @@ get_hello (void *cb_cls, const struct GNUNET_MessageHeader *message) static void -try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +try_connect (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) { - struct ConnectingContext *cc = cls; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls; struct PeerContext *p1 = cc->p1; struct PeerContext *p2 = cc->p2; @@ -477,18 +483,16 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth, * @param cls callback cls * @return a connect request handle */ -GNUNET_TRANSPORT_TESTING_ConnectRequest +struct GNUNET_TRANSPORT_TESTING_ConnectRequest * GNUNET_TRANSPORT_TESTING_connect_peers (struct GNUNET_TRANSPORT_TESTING_handle *tth, struct PeerContext *p1, struct PeerContext *p2, GNUNET_TRANSPORT_TESTING_connect_cb cb, void *cls) { - GNUNET_assert (tth != NULL); - - struct ConnectingContext *cc = - GNUNET_new (struct ConnectingContext); + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_ConnectRequest); + GNUNET_assert (tth != NULL); GNUNET_assert (p1 != NULL); GNUNET_assert (p2 != NULL); cc->p1 = p1; @@ -502,7 +506,9 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct GNUNET_TRANSPORT_TESTING_handle * cc->th_p2 = p2->th; GNUNET_assert (cc->th_p1 != NULL); GNUNET_assert (cc->th_p2 != NULL); - GNUNET_CONTAINER_DLL_insert (tth->cc_head, tth->cc_tail, cc); + GNUNET_CONTAINER_DLL_insert (tth->cc_head, + tth->cc_tail, + cc); cc->tct = GNUNET_SCHEDULER_add_now (&try_connect, cc); LOG (GNUNET_ERROR_TYPE_DEBUG, "New connect request %p\n", @@ -517,17 +523,12 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct GNUNET_TRANSPORT_TESTING_handle * * Tou MUST cancel the request if you stop the peers before the peers connected succesfully * * @param tth transport testing handle - * @param ccr a connect request handle + * @param cc a connect request handle */ void -GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct - GNUNET_TRANSPORT_TESTING_handle - *tth, - GNUNET_TRANSPORT_TESTING_ConnectRequest - ccr) +GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct GNUNET_TRANSPORT_TESTING_handle *tth, + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc) { - struct ConnectingContext *cc = ccr; - GNUNET_assert (tth != NULL); LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -550,8 +551,8 @@ GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct void GNUNET_TRANSPORT_TESTING_done (struct GNUNET_TRANSPORT_TESTING_handle *tth) { - struct ConnectingContext *cc = tth->cc_head; - struct ConnectingContext *ct = NULL; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = tth->cc_head; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ct = NULL; struct PeerContext *p = tth->p_head; struct PeerContext *t = NULL; @@ -596,11 +597,14 @@ GNUNET_TRANSPORT_TESTING_init () tth = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_handle); /* Init testing the testing lib */ - tth->tl_system = GNUNET_TESTING_system_create ("transport-testing", NULL, - NULL, NULL); + tth->tl_system = GNUNET_TESTING_system_create ("transport-testing", + NULL, + NULL, + NULL); if (NULL == tth->tl_system) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to initialize testing library!\n")); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Failed to initialize testing library!\n")); GNUNET_free (tth); return NULL; } @@ -671,7 +675,8 @@ extract_filename (const char *file) * @param dest where to store result */ void -GNUNET_TRANSPORT_TESTING_get_test_name (const char *file, char **dest) +GNUNET_TRANSPORT_TESTING_get_test_name (const char *file, + char **dest) { char *filename = extract_filename (file); char *backup = filename; @@ -708,7 +713,8 @@ suc: * @param dest where to store result */ void -GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file, char **dest) +GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file, + char **dest) { char *src = extract_filename (file); char *split; @@ -732,7 +738,8 @@ GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file, char **dest) */ void GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *file, - const char *test, char **dest) + const char *test, + char **dest) { char *filename; char *dotexe; @@ -776,7 +783,8 @@ suc: * @param count peer number */ void -GNUNET_TRANSPORT_TESTING_get_config_name (const char *file, char **dest, +GNUNET_TRANSPORT_TESTING_get_config_name (const char *file, + char **dest, int count) { char *filename = extract_filename (file); diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h index 0e84ac236..dcac29185 100644 --- a/src/transport/transport-testing.h +++ b/src/transport/transport-testing.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2006, 2009 Christian Grothoff (and other contributing authors) + Copyright (C) 2006, 2009, 2015 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -31,7 +31,7 @@ #include "gnunet_testing_lib.h" -#define GNUNET_TRANSPORT_TESTING_ConnectRequest void * +struct GNUNET_TRANSPORT_TESTING_ConnectRequest; /** @@ -43,16 +43,18 @@ struct PeerContext; * Callback when two peers are connected and both have called the connect callback * to notify clients about a new peer */ -typedef void (*GNUNET_TRANSPORT_TESTING_start_cb) (struct PeerContext * p, - void *cls); +typedef void +(*GNUNET_TRANSPORT_TESTING_start_cb) (struct PeerContext *p, + void *cls); /** * Callback when two peers are connected and both have called the connect callback * to notify clients about a new peer */ -typedef void (*GNUNET_TRANSPORT_TESTING_connect_cb) (struct PeerContext * p1, - struct PeerContext * p2, - void *cls); +typedef void +(*GNUNET_TRANSPORT_TESTING_connect_cb) (struct PeerContext *p1, + struct PeerContext *p2, + void *cls); /** @@ -147,13 +149,13 @@ struct PeerContext }; -struct ConnectingContext +struct GNUNET_TRANSPORT_TESTING_ConnectRequest { - struct ConnectingContext *next; - struct ConnectingContext *prev; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *next; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *prev; struct PeerContext *p1; struct PeerContext *p2; - struct GNUNET_SCHEDULER_Task * tct; + struct GNUNET_SCHEDULER_Task *tct; GNUNET_TRANSPORT_TESTING_connect_cb cb; void *cb_cls; struct GNUNET_TRANSPORT_Handle *th_p1; @@ -172,12 +174,12 @@ struct GNUNET_TRANSPORT_TESTING_handle /** * head DLL of connect contexts */ - struct ConnectingContext *cc_head; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc_head; /** * head DLL of connect contexts */ - struct ConnectingContext *cc_tail; + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc_tail; /** * head DLL of peers @@ -192,20 +194,22 @@ struct GNUNET_TRANSPORT_TESTING_handle /** -* Start a peer with the given configuration -* @param tth the testing handle -* @param cfgname configuration file -* @param peer_id the peer_id -* @param rec receive callback -* @param nc connect callback -* @param nd disconnect callback -* @param start_cb start callback -* @param cb_cls closure for callback -* @return the peer context -*/ + * Start a peer with the given configuration + * + * @param tth the testing handle + * @param cfgname configuration file + * @param peer_id the peer_id + * @param rec receive callback + * @param nc connect callback + * @param nd disconnect callback + * @param start_cb start callback + * @param cb_cls closure for callback + * @return the peer context + */ struct PeerContext * -GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle - *tth, const char *cfgname, int peer_id, +GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth, + const char *cfgname, + int peer_id, GNUNET_TRANSPORT_ReceiveCallback rec, GNUNET_TRANSPORT_NotifyConnect nc, GNUNET_TRANSPORT_NotifyDisconnect nd, @@ -215,30 +219,32 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle /** * shutdown the given peer + * * @param tth the testing handle * @param p the peer */ - void GNUNET_TRANSPORT_TESTING_stop_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth, struct PeerContext *pc); /** -* Restart the given peer -* @param tth testing handle -* @param p the peer -* @param cfgname the cfg file used to restart -* @param restart_cb restart callback -* @param cb_cls callback closure -* @return GNUNET_OK in success otherwise GNUNET_SYSERR -*/ + * Restart the given peer + * + * @param tth testing handle + * @param p the peer + * @param cfgname the cfg file used to restart + * @param restart_cb restart callback + * @param cb_cls callback closure + * @return #GNUNET_OK in success otherwise #GNUNET_SYSERR + */ int -GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle - *tth, struct PeerContext *p, +GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth, + struct PeerContext *p, const char *cfgname, - GNUNET_TRANSPORT_TESTING_start_cb - restart_cb, void *cb_cls); + GNUNET_TRANSPORT_TESTING_start_cb restart_cb, + void *cb_cls); + /** * Connect the given peers and call the callback when both peers report the @@ -252,25 +258,23 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle * @param cls callback cls * @return a connect request handle */ -GNUNET_TRANSPORT_TESTING_ConnectRequest +struct GNUNET_TRANSPORT_TESTING_ConnectRequest * GNUNET_TRANSPORT_TESTING_connect_peers (struct GNUNET_TRANSPORT_TESTING_handle *tth, struct PeerContext *p1, struct PeerContext *p2, GNUNET_TRANSPORT_TESTING_connect_cb cb, void *cls); + /** * Cancel the request to connect two peers * Tou MUST cancel the request if you stop the peers before the peers connected succesfully * @param tth testing - * @param ccr a connect request handle + * @param cc a connect request handle */ void -GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct - GNUNET_TRANSPORT_TESTING_handle - *tth, - GNUNET_TRANSPORT_TESTING_ConnectRequest - ccr); +GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct GNUNET_TRANSPORT_TESTING_handle *tth, + struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc); /** * Clean up the transport testing @@ -284,7 +288,7 @@ GNUNET_TRANSPORT_TESTING_done (struct GNUNET_TRANSPORT_TESTING_handle *tth); * @return transport testing handle */ struct GNUNET_TRANSPORT_TESTING_handle * -GNUNET_TRANSPORT_TESTING_init (); +GNUNET_TRANSPORT_TESTING_init (void); /* * Some utility functions @@ -296,7 +300,8 @@ GNUNET_TRANSPORT_TESTING_init (); * @param dest where to store result */ void -GNUNET_TRANSPORT_TESTING_get_test_name (const char *file, char **dest); +GNUNET_TRANSPORT_TESTING_get_test_name (const char *file, + char **dest); /** * This function takes the filename (e.g. argv[0), removes a "lt-"-prefix and @@ -307,7 +312,8 @@ GNUNET_TRANSPORT_TESTING_get_test_name (const char *file, char **dest); * @param count peer number */ void -GNUNET_TRANSPORT_TESTING_get_config_name (const char *file, char **dest, +GNUNET_TRANSPORT_TESTING_get_config_name (const char *file, + char **dest, int count);