summaryrefslogtreecommitdiff
path: root/src/nat-auto
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-07 16:03:59 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-07 16:03:59 +0100
commitc6bf6b89b5c1556590eadc3d64676d2f023e6da4 (patch)
treedbc378b6ac024e73972b0ac0015b60b3f3ca5c5f /src/nat-auto
parent5c59b1796e462b468321ce1200eb4a6972340cce (diff)
make sure nat-auto code uses NAT_AUTO prefix
Diffstat (limited to 'src/nat-auto')
-rw-r--r--src/nat-auto/gnunet-nat-auto.c30
-rw-r--r--src/nat-auto/gnunet-nat-server.c6
-rw-r--r--src/nat-auto/gnunet-service-nat-auto.c8
-rw-r--r--src/nat-auto/nat-auto.h6
-rw-r--r--src/nat-auto/nat_auto_api.c43
-rw-r--r--src/nat-auto/nat_auto_api_test.c38
6 files changed, 65 insertions, 66 deletions
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 */