From c6bf6b89b5c1556590eadc3d64676d2f023e6da4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 7 Jan 2017 16:03:59 +0100 Subject: [PATCH] make sure nat-auto code uses NAT_AUTO prefix --- src/include/gnunet_nat_auto_service.h | 128 +++++-------------------- src/include/gnunet_nat_service.h | 52 ++++++++++ src/nat-auto/gnunet-nat-auto.c | 30 +++--- src/nat-auto/gnunet-nat-server.c | 6 +- src/nat-auto/gnunet-service-nat-auto.c | 8 +- src/nat-auto/nat-auto.h | 6 +- src/nat-auto/nat_auto_api.c | 43 ++++----- src/nat-auto/nat_auto_api_test.c | 38 ++++---- src/transport/gnunet-transport.c | 4 +- 9 files changed, 142 insertions(+), 173 deletions(-) diff --git a/src/include/gnunet_nat_auto_service.h b/src/include/gnunet_nat_auto_service.h index 90115ff8c..c458dc81a 100644 --- a/src/include/gnunet_nat_auto_service.h +++ b/src/include/gnunet_nat_auto_service.h @@ -35,95 +35,13 @@ #define GNUNET_NAT_AUTO_SERVICE_H #include "gnunet_util_lib.h" +#include "gnunet_nat_service.h" /** * Handle to a NAT test. */ -struct GNUNET_NAT_Test; - - -/** - * Function called to report success or failure for - * NAT configuration test. - * - * @param cls closure - * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code - */ -typedef void -(*GNUNET_NAT_TestCallback) (void *cls, - enum GNUNET_NAT_StatusCode result); - - -/** - * Handle an incoming STUN message. This function is useful as - * some GNUnet service may be listening on a UDP port and might - * thus receive STUN messages while trying to receive other data. - * In this case, this function can be used to process replies - * to STUN requests. - * - * The function does some basic sanity checks on packet size and - * content, try to extract a bit of information. - * - * At the moment this only processes BIND requests, and returns the - * externally visible address of the request to the rest of the - * NAT logic. - * - * @param nh handle to the NAT service - * @param sender_addr address from which we got @a data - * @param sender_addr_len number of bytes in @a sender_addr - * @param data the packet - * @param data_size number of bytes in @a data - * @return #GNUNET_OK on success - * #GNUNET_NO if the packet is not a STUN packet - * #GNUNET_SYSERR on internal error handling the packet - */ -int -GNUNET_NAT_stun_handle_packet (struct GNUNET_NAT_Handle *nh, - const struct sockaddr *sender_addr, - size_t sender_addr_len, - const void *data, - size_t data_size); - - -/** - * Handle to a request given to the resolver. Can be used to cancel - * the request prior to the timeout or successful execution. Also - * used to track our internal state for the request. - */ -struct GNUNET_NAT_STUN_Handle; - - -/** - * Make Generic STUN request. Sends a generic stun request to the - * server specified using the specified socket. If we do this, - * we need to watch for possible responses and call - * #GNUNET_NAT_stun_handle_packet() on incoming packets. - * - * @param server the address of the stun server - * @param port port of the stun server, in host byte order - * @param sock the socket used to send the request, must be a - * UDP socket - * @param cb callback in case of error - * @param cb_cls closure for @a cb - * @return NULL on error - */ -struct GNUNET_NAT_STUN_Handle * -GNUNET_NAT_stun_make_request (const char *server, - uint16_t port, - struct GNUNET_NETWORK_Handle *sock, - GNUNET_NAT_TestCallback cb, - void *cb_cls); - - -/** - * Cancel active STUN request. Frees associated resources - * and ensures that the callback is no longer invoked. - * - * @param rh request to cancel - */ -void -GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh); +struct GNUNET_NAT_AUTO_Test; /** @@ -141,15 +59,15 @@ GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh); * @param report_cls closure for @a report * @return handle to cancel NAT test */ -struct GNUNET_NAT_Test * -GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - uint8_t proto, - struct in_addr bind_ip, - uint16_t bnd_port, - struct in_addr extern_ip, - uint16_t extern_port, - GNUNET_NAT_TestCallback report, - void *report_cls); +struct GNUNET_NAT_AUTO_Test * +GNUNET_NAT_AUTO_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, + uint8_t proto, + struct in_addr bind_ip, + uint16_t bnd_port, + struct in_addr extern_ip, + uint16_t extern_port, + GNUNET_NAT_TestCallback report, + void *report_cls); /** @@ -158,13 +76,13 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param tst test to stop. */ void -GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); +GNUNET_NAT_AUTO_test_stop (struct GNUNET_NAT_AUTO_Test *tst); /** * Handle to auto-configuration in progress. */ -struct GNUNET_NAT_AutoHandle; +struct GNUNET_NAT_AUTO_AutoHandle; /** @@ -174,7 +92,7 @@ struct GNUNET_NAT_AutoHandle; * @return point to a static string containing the error code */ const char * -GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err); +GNUNET_NAT_AUTO_status2string (enum GNUNET_NAT_StatusCode err); /** @@ -187,10 +105,10 @@ GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err); * @param type what the situation of the NAT */ typedef void -(*GNUNET_NAT_AutoResultCallback)(void *cls, - const struct GNUNET_CONFIGURATION_Handle *diff, - enum GNUNET_NAT_StatusCode result, - enum GNUNET_NAT_Type type); +(*GNUNET_NAT_AUTO_AutoResultCallback)(void *cls, + const struct GNUNET_CONFIGURATION_Handle *diff, + enum GNUNET_NAT_StatusCode result, + enum GNUNET_NAT_Type type); /** @@ -202,10 +120,10 @@ typedef void * @param cb_cls closure for @a cb * @return handle to cancel operation */ -struct GNUNET_NAT_AutoHandle * -GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_NAT_AutoResultCallback cb, - void *cb_cls); +struct GNUNET_NAT_AUTO_AutoHandle * +GNUNET_NAT_AUTO_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_NAT_AUTO_AutoResultCallback cb, + void *cb_cls); /** @@ -214,7 +132,7 @@ GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param ah handle for operation to abort */ void -GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah); +GNUNET_NAT_AUTO_autoconfig_cancel (struct GNUNET_NAT_AUTO_AutoHandle *ah); #endif diff --git a/src/include/gnunet_nat_service.h b/src/include/gnunet_nat_service.h index 94f8a8555..e75845207 100644 --- a/src/include/gnunet_nat_service.h +++ b/src/include/gnunet_nat_service.h @@ -425,6 +425,58 @@ GNUNET_NAT_stun_handle_packet (struct GNUNET_NAT_Handle *nh, size_t data_size); +/** + * Handle to a request given to the resolver. Can be used to cancel + * the request prior to the timeout or successful execution. Also + * used to track our internal state for the request. + */ +struct GNUNET_NAT_STUN_Handle; + + +/** + * Function called to report success or failure for + * NAT configuration test. + * + * @param cls closure + * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code + */ +typedef void +(*GNUNET_NAT_TestCallback) (void *cls, + enum GNUNET_NAT_StatusCode result); + + +/** + * Make Generic STUN request. Sends a generic stun request to the + * server specified using the specified socket. If we do this, + * we need to watch for possible responses and call + * #GNUNET_NAT_stun_handle_packet() on incoming packets. + * + * @param server the address of the stun server + * @param port port of the stun server, in host byte order + * @param sock the socket used to send the request, must be a + * UDP socket + * @param cb callback in case of error + * @param cb_cls closure for @a cb + * @return NULL on error + */ +struct GNUNET_NAT_STUN_Handle * +GNUNET_NAT_stun_make_request (const char *server, + uint16_t port, + struct GNUNET_NETWORK_Handle *sock, + GNUNET_NAT_TestCallback cb, + void *cb_cls); + + +/** + * Cancel active STUN request. Frees associated resources + * and ensures that the callback is no longer invoked. + * + * @param rh request to cancel + */ +void +GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh); + + #endif /** @} */ /* end of group */ diff --git a/src/nat-auto/gnunet-nat-auto.c b/src/nat-auto/gnunet-nat-auto.c index 3b9a5fa94..d411c6d75 100644 --- a/src/nat-auto/gnunet-nat-auto.c +++ b/src/nat-auto/gnunet-nat-auto.c @@ -37,7 +37,7 @@ static int global_ret; /** * Handle to ongoing autoconfiguration. */ -static struct GNUNET_NAT_AutoHandle *ah; +static struct GNUNET_NAT_AUTO_AutoHandle *ah; /** * If we do auto-configuration, should we write the result @@ -75,7 +75,7 @@ static unsigned int do_auto; /** * Handle to a NAT test operation. */ -static struct GNUNET_NAT_Test *nt; +static struct GNUNET_NAT_AUTO_Test *nt; /** * Flag set to 1 if we use IPPROTO_UDP. @@ -178,7 +178,7 @@ auto_config_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "NAT status: %s/%s\n", - GNUNET_NAT_status2string (result), + GNUNET_NAT_AUTO_status2string (result), nat_type); /* Shortcut: if there are no changes suggested, bail out early. */ @@ -256,7 +256,7 @@ test_report_cb (void *cls, { nt = NULL; PRINTF ("NAT test result: %s\n", - GNUNET_NAT_status2string (result)); + GNUNET_NAT_AUTO_status2string (result)); test_finished (); } @@ -271,12 +271,12 @@ do_shutdown (void *cls) { if (NULL != ah) { - GNUNET_NAT_autoconfig_cancel (ah); + GNUNET_NAT_AUTO_autoconfig_cancel (ah); ah = NULL; } if (NULL != nt) { - GNUNET_NAT_test_stop (nt); + GNUNET_NAT_AUTO_test_stop (nt); nt = NULL; } } @@ -307,7 +307,7 @@ run (void *cls, if (do_auto) { - ah = GNUNET_NAT_autoconfig_start (c, + ah = GNUNET_NAT_AUTO_autoconfig_start (c, &auto_config_cb, NULL); } @@ -360,14 +360,14 @@ run (void *cls, { if (NULL == extern_addr) extern_sa = bind_sa; - nt = GNUNET_NAT_test_start (c, - proto, - bind_sa.sin_addr, - ntohs (bind_sa.sin_port), - extern_sa.sin_addr, - ntohs (extern_sa.sin_port), - &test_report_cb, - NULL); + nt = GNUNET_NAT_AUTO_test_start (c, + proto, + bind_sa.sin_addr, + ntohs (bind_sa.sin_port), + extern_sa.sin_addr, + ntohs (extern_sa.sin_port), + &test_report_cb, + NULL); } test_finished (); } diff --git a/src/nat-auto/gnunet-nat-server.c b/src/nat-auto/gnunet-nat-server.c index 93352f5f0..d98a7a55e 100644 --- a/src/nat-auto/gnunet-nat-server.c +++ b/src/nat-auto/gnunet-nat-server.c @@ -240,12 +240,12 @@ test (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *msg) { - const struct GNUNET_NAT_TestMessage *tm; + const struct GNUNET_NAT_AUTO_TestMessage *tm; uint16_t dport; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received test request\n"); - tm = (const struct GNUNET_NAT_TestMessage *) msg; + tm = (const struct GNUNET_NAT_AUTO_TestMessage *) msg; dport = ntohs (tm->dport); if (0 == dport) try_anat (tm->dst_ipv4, @@ -293,7 +293,7 @@ run (void *cls, { static const struct GNUNET_SERVER_MessageHandler handlers[] = { {&test, NULL, GNUNET_MESSAGE_TYPE_NAT_TEST, - sizeof (struct GNUNET_NAT_TestMessage)}, + sizeof (struct GNUNET_NAT_AUTO_TestMessage)}, {NULL, NULL, 0, 0} }; unsigned int port; diff --git a/src/nat-auto/gnunet-service-nat-auto.c b/src/nat-auto/gnunet-service-nat-auto.c index 897d6feb2..f4e1b09e4 100644 --- a/src/nat-auto/gnunet-service-nat-auto.c +++ b/src/nat-auto/gnunet-service-nat-auto.c @@ -170,7 +170,7 @@ static struct GNUNET_STATISTICS_Handle *stats; */ static int check_autoconfig_request (void *cls, - const struct GNUNET_NAT_AutoconfigRequestMessage *message) + const struct GNUNET_NAT_AUTO_AutoconfigRequestMessage *message) { return GNUNET_OK; /* checked later */ } @@ -203,7 +203,7 @@ conclude_autoconfig_request (void *cls) { struct AutoconfigContext *ac = cls; struct ClientHandle *ch = ac->ch; - struct GNUNET_NAT_AutoconfigResultMessage *arm; + struct GNUNET_NAT_AUTO_AutoconfigResultMessage *arm; struct GNUNET_MQ_Envelope *env; size_t c_size; char *buf; @@ -295,7 +295,7 @@ update_enable_upnpc_option (struct AutoconfigContext *ac) */ static void handle_autoconfig_request (void *cls, - const struct GNUNET_NAT_AutoconfigRequestMessage *message) + const struct GNUNET_NAT_AUTO_AutoconfigRequestMessage *message) { struct ClientHandle *ch = cls; size_t left = ntohs (message->header.size) - sizeof (*message); @@ -458,7 +458,7 @@ GNUNET_SERVICE_MAIN NULL, GNUNET_MQ_hd_var_size (autoconfig_request, GNUNET_MESSAGE_TYPE_NAT_AUTO_REQUEST_CFG, - struct GNUNET_NAT_AutoconfigRequestMessage, + struct GNUNET_NAT_AUTO_AutoconfigRequestMessage, NULL), GNUNET_MQ_handler_end ()); diff --git a/src/nat-auto/nat-auto.h b/src/nat-auto/nat-auto.h index 150dc32c2..07b5a5b91 100644 --- a/src/nat-auto/nat-auto.h +++ b/src/nat-auto/nat-auto.h @@ -36,7 +36,7 @@ GNUNET_NETWORK_STRUCT_BEGIN * Request to test NAT traversal, sent to the gnunet-nat-server * (not the service!). */ -struct GNUNET_NAT_TestMessage +struct GNUNET_NAT_AUTO_TestMessage { /** * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST @@ -69,7 +69,7 @@ struct GNUNET_NAT_TestMessage /** * Client requesting automatic configuration. */ -struct GNUNET_NAT_AutoconfigRequestMessage +struct GNUNET_NAT_AUTO_AutoconfigRequestMessage { /** * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG @@ -84,7 +84,7 @@ struct GNUNET_NAT_AutoconfigRequestMessage /** * Service responding with proposed configuration. */ -struct GNUNET_NAT_AutoconfigResultMessage +struct GNUNET_NAT_AUTO_AutoconfigResultMessage { /** * Header with type #GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT diff --git a/src/nat-auto/nat_auto_api.c b/src/nat-auto/nat_auto_api.c index e6b0512c6..632561097 100644 --- a/src/nat-auto/nat_auto_api.c +++ b/src/nat-auto/nat_auto_api.c @@ -1,7 +1,6 @@ - /* This file is part of GNUnet. - Copyright (C) 2007-2016 GNUnet e.V. + Copyright (C) 2007-2017 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -23,7 +22,7 @@ * @author Christian Grothoff * @author Milan Bouchet-Valat * - * @file nat/nat_auto_api.c + * @file nat-auto/nat_auto_api.c * Routines for NAT auto configuration. */ #include "platform.h" @@ -36,7 +35,7 @@ /** * Handle to auto-configuration in progress. */ -struct GNUNET_NAT_AutoHandle +struct GNUNET_NAT_AUTO_AutoHandle { /** @@ -52,7 +51,7 @@ struct GNUNET_NAT_AutoHandle /** * Function called with the result from the autoconfiguration. */ - GNUNET_NAT_AutoResultCallback arc; + GNUNET_NAT_AUTO_AutoResultCallback arc; /** * Closure for @e arc. @@ -69,7 +68,7 @@ struct GNUNET_NAT_AutoHandle * @return point to a static string containing the error code */ const char * -GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err) +GNUNET_NAT_AUTO_status2string (enum GNUNET_NAT_StatusCode err) { switch (err) { @@ -120,13 +119,13 @@ GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err) /** * Check result from autoconfiguration attempt. * - * @param cls the `struct GNUNET_NAT_AutoHandle` + * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle` * @param res the result * @return #GNUNET_OK if @a res is well-formed (always for now) */ static int check_auto_result (void *cls, - const struct GNUNET_NAT_AutoconfigResultMessage *res) + const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res) { return GNUNET_OK; } @@ -135,14 +134,14 @@ check_auto_result (void *cls, /** * Handle result from autoconfiguration attempt. * - * @param cls the `struct GNUNET_NAT_AutoHandle` + * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle` * @param res the result */ static void handle_auto_result (void *cls, - const struct GNUNET_NAT_AutoconfigResultMessage *res) + const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res) { - struct GNUNET_NAT_AutoHandle *ah = cls; + struct GNUNET_NAT_AUTO_AutoHandle *ah = cls; size_t left; struct GNUNET_CONFIGURATION_Handle *cfg; enum GNUNET_NAT_Type type @@ -172,27 +171,27 @@ handle_auto_result (void *cls, type); } GNUNET_CONFIGURATION_destroy (cfg); - GNUNET_NAT_autoconfig_cancel (ah); + GNUNET_NAT_AUTO_autoconfig_cancel (ah); } /** * Handle queue errors by reporting autoconfiguration failure. * - * @param cls the `struct GNUNET_NAT_AutoHandle *` + * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle *` * @param error details about the error */ static void ah_error_handler (void *cls, enum GNUNET_MQ_Error error) { - struct GNUNET_NAT_AutoHandle *ah = cls; + struct GNUNET_NAT_AUTO_AutoHandle *ah = cls; ah->arc (ah->arc_cls, NULL, GNUNET_NAT_ERROR_IPC_FAILURE, GNUNET_NAT_TYPE_UNKNOWN); - GNUNET_NAT_autoconfig_cancel (ah); + GNUNET_NAT_AUTO_autoconfig_cancel (ah); } @@ -205,21 +204,21 @@ ah_error_handler (void *cls, * @param cb_cls closure for @a cb * @return handle to cancel operation */ -struct GNUNET_NAT_AutoHandle * -GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_NAT_AutoResultCallback cb, +struct GNUNET_NAT_AUTO_AutoHandle * +GNUNET_NAT_AUTO_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_NAT_AUTO_AutoResultCallback cb, void *cb_cls) { - struct GNUNET_NAT_AutoHandle *ah = GNUNET_new (struct GNUNET_NAT_AutoHandle); + struct GNUNET_NAT_AUTO_AutoHandle *ah = GNUNET_new (struct GNUNET_NAT_AUTO_AutoHandle); struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (auto_result, GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT, - struct GNUNET_NAT_AutoconfigResultMessage, + struct GNUNET_NAT_AUTO_AutoconfigResultMessage, ah), GNUNET_MQ_handler_end () }; struct GNUNET_MQ_Envelope *env; - struct GNUNET_NAT_AutoconfigRequestMessage *req; + struct GNUNET_NAT_AUTO_AutoconfigRequestMessage *req; char *buf; size_t size; @@ -265,7 +264,7 @@ GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param ah handle for operation to abort */ void -GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah) +GNUNET_NAT_AUTO_autoconfig_cancel (struct GNUNET_NAT_AUTO_AutoHandle *ah) { GNUNET_MQ_destroy (ah->mq); GNUNET_free (ah); diff --git a/src/nat-auto/nat_auto_api_test.c b/src/nat-auto/nat_auto_api_test.c index 056d2a2bf..df2d9fed3 100644 --- a/src/nat-auto/nat_auto_api_test.c +++ b/src/nat-auto/nat_auto_api_test.c @@ -54,7 +54,7 @@ struct NatActivity /** * Handle of the master context. */ - struct GNUNET_NAT_Test *h; + struct GNUNET_NAT_AUTO_Test *h; /** * Task reading from the incoming connection. @@ -86,7 +86,7 @@ struct ClientActivity /** * Handle to overall NAT test. */ - struct GNUNET_NAT_Test *h; + struct GNUNET_NAT_AUTO_Test *h; }; @@ -94,7 +94,7 @@ struct ClientActivity /** * Handle to a NAT test. */ -struct GNUNET_NAT_Test +struct GNUNET_NAT_AUTO_Test { /** @@ -187,7 +187,7 @@ reversal_cb (void *cls, const struct sockaddr *addr, socklen_t addrlen) { - struct GNUNET_NAT_Test *h = cls; + struct GNUNET_NAT_AUTO_Test *h = cls; const struct sockaddr_in *sa; if (sizeof (struct sockaddr_in) != addrlen) @@ -209,12 +209,12 @@ reversal_cb (void *cls, * Activity on our incoming socket. Read data from the * incoming connection. * - * @param cls the `struct GNUNET_NAT_Test` + * @param cls the `struct GNUNET_NAT_AUTO_Test` */ static void do_udp_read (void *cls) { - struct GNUNET_NAT_Test *tst = cls; + struct GNUNET_NAT_AUTO_Test *tst = cls; uint16_t data; const struct GNUNET_SCHEDULER_TaskContext *tc; @@ -255,7 +255,7 @@ static void do_read (void *cls) { struct NatActivity *na = cls; - struct GNUNET_NAT_Test *tst; + struct GNUNET_NAT_AUTO_Test *tst; uint16_t data; const struct GNUNET_SCHEDULER_TaskContext *tc; @@ -292,12 +292,12 @@ do_read (void *cls) * Activity on our listen socket. Accept the * incoming connection. * - * @param cls the `struct GNUNET_NAT_Test` + * @param cls the `struct GNUNET_NAT_AUTO_Test` */ static void do_accept (void *cls) { - struct GNUNET_NAT_Test *tst = cls; + struct GNUNET_NAT_AUTO_Test *tst = cls; struct GNUNET_NETWORK_Handle *s; struct NatActivity *wl; @@ -342,7 +342,7 @@ mq_error_handler (void *cls, enum GNUNET_MQ_Error error) { struct ClientActivity *ca = cls; - struct GNUNET_NAT_Test *tst = ca->h; + struct GNUNET_NAT_AUTO_Test *tst = ca->h; GNUNET_CONTAINER_DLL_remove (tst->ca_head, tst->ca_tail, @@ -367,10 +367,10 @@ addr_cb (void *cls, const struct sockaddr *addr, socklen_t addrlen) { - struct GNUNET_NAT_Test *h = cls; + struct GNUNET_NAT_AUTO_Test *h = cls; struct ClientActivity *ca; struct GNUNET_MQ_Envelope *env; - struct GNUNET_NAT_TestMessage *msg; + struct GNUNET_NAT_AUTO_TestMessage *msg; const struct sockaddr_in *sa; if (GNUNET_YES != add_remove) @@ -428,7 +428,7 @@ addr_cb (void *cls, static void do_timeout (void *cls) { - struct GNUNET_NAT_Test *nh = cls; + struct GNUNET_NAT_AUTO_Test *nh = cls; nh->ttask = NULL; nh->report (nh->report_cls, @@ -453,8 +453,8 @@ do_timeout (void *cls) * @param report_cls closure for @a report * @return handle to cancel NAT test or NULL. The error is always indicated via the report callback */ -struct GNUNET_NAT_Test * -GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, +struct GNUNET_NAT_AUTO_Test * +GNUNET_NAT_AUTO_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp, uint16_t bnd_port, uint16_t adv_port, @@ -462,7 +462,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_NAT_TestCallback report, void *report_cls) { - struct GNUNET_NAT_Test *nh; + struct GNUNET_NAT_AUTO_Test *nh; struct sockaddr_in sa; const struct sockaddr *addrs[] = { (const struct sockaddr *) &sa @@ -478,7 +478,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, sa.sin_len = sizeof (sa); #endif - nh = GNUNET_new (struct GNUNET_NAT_Test); + nh = GNUNET_new (struct GNUNET_NAT_AUTO_Test); nh->cfg = cfg; nh->is_tcp = is_tcp; nh->data = bnd_port; @@ -594,7 +594,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param tst test to stop. */ void -GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst) +GNUNET_NAT_AUTO_test_stop (struct GNUNET_NAT_AUTO_Test *tst) { struct NatActivity *pos; struct ClientActivity *cpos; @@ -641,4 +641,4 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst) GNUNET_free (tst); } -/* end of nat_test.c */ +/* end of nat_auto_api_test.c */ diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index e928cf660..c5eb58361 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2011-2014, 2016 GNUnet e.V. + Copyright (C) 2011-2014, 2016, 2017 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -194,7 +194,7 @@ struct TestContext /** * Task identifier for the timeout. */ - struct GNUNET_SCHEDULER_Task * tsk; + struct GNUNET_SCHEDULER_Task *tsk; /** * Name of plugin under test. -- 2.25.1