aboutsummaryrefslogtreecommitdiff
path: root/src/nat-auto/nat_auto_api.c
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/nat_auto_api.c
parent5c59b1796e462b468321ce1200eb4a6972340cce (diff)
downloadgnunet-c6bf6b89b5c1556590eadc3d64676d2f023e6da4.tar.gz
gnunet-c6bf6b89b5c1556590eadc3d64676d2f023e6da4.zip
make sure nat-auto code uses NAT_AUTO prefix
Diffstat (limited to 'src/nat-auto/nat_auto_api.c')
-rw-r--r--src/nat-auto/nat_auto_api.c43
1 files changed, 21 insertions, 22 deletions
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 @@
1
2/* 1/*
3 This file is part of GNUnet. 2 This file is part of GNUnet.
4 Copyright (C) 2007-2016 GNUnet e.V. 3 Copyright (C) 2007-2017 GNUnet e.V.
5 4
6 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -23,7 +22,7 @@
23 * @author Christian Grothoff 22 * @author Christian Grothoff
24 * @author Milan Bouchet-Valat 23 * @author Milan Bouchet-Valat
25 * 24 *
26 * @file nat/nat_auto_api.c 25 * @file nat-auto/nat_auto_api.c
27 * Routines for NAT auto configuration. 26 * Routines for NAT auto configuration.
28 */ 27 */
29#include "platform.h" 28#include "platform.h"
@@ -36,7 +35,7 @@
36/** 35/**
37 * Handle to auto-configuration in progress. 36 * Handle to auto-configuration in progress.
38 */ 37 */
39struct GNUNET_NAT_AutoHandle 38struct GNUNET_NAT_AUTO_AutoHandle
40{ 39{
41 40
42 /** 41 /**
@@ -52,7 +51,7 @@ struct GNUNET_NAT_AutoHandle
52 /** 51 /**
53 * Function called with the result from the autoconfiguration. 52 * Function called with the result from the autoconfiguration.
54 */ 53 */
55 GNUNET_NAT_AutoResultCallback arc; 54 GNUNET_NAT_AUTO_AutoResultCallback arc;
56 55
57 /** 56 /**
58 * Closure for @e arc. 57 * Closure for @e arc.
@@ -69,7 +68,7 @@ struct GNUNET_NAT_AutoHandle
69 * @return point to a static string containing the error code 68 * @return point to a static string containing the error code
70 */ 69 */
71const char * 70const char *
72GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err) 71GNUNET_NAT_AUTO_status2string (enum GNUNET_NAT_StatusCode err)
73{ 72{
74 switch (err) 73 switch (err)
75 { 74 {
@@ -120,13 +119,13 @@ GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err)
120/** 119/**
121 * Check result from autoconfiguration attempt. 120 * Check result from autoconfiguration attempt.
122 * 121 *
123 * @param cls the `struct GNUNET_NAT_AutoHandle` 122 * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle`
124 * @param res the result 123 * @param res the result
125 * @return #GNUNET_OK if @a res is well-formed (always for now) 124 * @return #GNUNET_OK if @a res is well-formed (always for now)
126 */ 125 */
127static int 126static int
128check_auto_result (void *cls, 127check_auto_result (void *cls,
129 const struct GNUNET_NAT_AutoconfigResultMessage *res) 128 const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res)
130{ 129{
131 return GNUNET_OK; 130 return GNUNET_OK;
132} 131}
@@ -135,14 +134,14 @@ check_auto_result (void *cls,
135/** 134/**
136 * Handle result from autoconfiguration attempt. 135 * Handle result from autoconfiguration attempt.
137 * 136 *
138 * @param cls the `struct GNUNET_NAT_AutoHandle` 137 * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle`
139 * @param res the result 138 * @param res the result
140 */ 139 */
141static void 140static void
142handle_auto_result (void *cls, 141handle_auto_result (void *cls,
143 const struct GNUNET_NAT_AutoconfigResultMessage *res) 142 const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res)
144{ 143{
145 struct GNUNET_NAT_AutoHandle *ah = cls; 144 struct GNUNET_NAT_AUTO_AutoHandle *ah = cls;
146 size_t left; 145 size_t left;
147 struct GNUNET_CONFIGURATION_Handle *cfg; 146 struct GNUNET_CONFIGURATION_Handle *cfg;
148 enum GNUNET_NAT_Type type 147 enum GNUNET_NAT_Type type
@@ -172,27 +171,27 @@ handle_auto_result (void *cls,
172 type); 171 type);
173 } 172 }
174 GNUNET_CONFIGURATION_destroy (cfg); 173 GNUNET_CONFIGURATION_destroy (cfg);
175 GNUNET_NAT_autoconfig_cancel (ah); 174 GNUNET_NAT_AUTO_autoconfig_cancel (ah);
176} 175}
177 176
178 177
179/** 178/**
180 * Handle queue errors by reporting autoconfiguration failure. 179 * Handle queue errors by reporting autoconfiguration failure.
181 * 180 *
182 * @param cls the `struct GNUNET_NAT_AutoHandle *` 181 * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle *`
183 * @param error details about the error 182 * @param error details about the error
184 */ 183 */
185static void 184static void
186ah_error_handler (void *cls, 185ah_error_handler (void *cls,
187 enum GNUNET_MQ_Error error) 186 enum GNUNET_MQ_Error error)
188{ 187{
189 struct GNUNET_NAT_AutoHandle *ah = cls; 188 struct GNUNET_NAT_AUTO_AutoHandle *ah = cls;
190 189
191 ah->arc (ah->arc_cls, 190 ah->arc (ah->arc_cls,
192 NULL, 191 NULL,
193 GNUNET_NAT_ERROR_IPC_FAILURE, 192 GNUNET_NAT_ERROR_IPC_FAILURE,
194 GNUNET_NAT_TYPE_UNKNOWN); 193 GNUNET_NAT_TYPE_UNKNOWN);
195 GNUNET_NAT_autoconfig_cancel (ah); 194 GNUNET_NAT_AUTO_autoconfig_cancel (ah);
196} 195}
197 196
198 197
@@ -205,21 +204,21 @@ ah_error_handler (void *cls,
205 * @param cb_cls closure for @a cb 204 * @param cb_cls closure for @a cb
206 * @return handle to cancel operation 205 * @return handle to cancel operation
207 */ 206 */
208struct GNUNET_NAT_AutoHandle * 207struct GNUNET_NAT_AUTO_AutoHandle *
209GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, 208GNUNET_NAT_AUTO_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
210 GNUNET_NAT_AutoResultCallback cb, 209 GNUNET_NAT_AUTO_AutoResultCallback cb,
211 void *cb_cls) 210 void *cb_cls)
212{ 211{
213 struct GNUNET_NAT_AutoHandle *ah = GNUNET_new (struct GNUNET_NAT_AutoHandle); 212 struct GNUNET_NAT_AUTO_AutoHandle *ah = GNUNET_new (struct GNUNET_NAT_AUTO_AutoHandle);
214 struct GNUNET_MQ_MessageHandler handlers[] = { 213 struct GNUNET_MQ_MessageHandler handlers[] = {
215 GNUNET_MQ_hd_var_size (auto_result, 214 GNUNET_MQ_hd_var_size (auto_result,
216 GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT, 215 GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT,
217 struct GNUNET_NAT_AutoconfigResultMessage, 216 struct GNUNET_NAT_AUTO_AutoconfigResultMessage,
218 ah), 217 ah),
219 GNUNET_MQ_handler_end () 218 GNUNET_MQ_handler_end ()
220 }; 219 };
221 struct GNUNET_MQ_Envelope *env; 220 struct GNUNET_MQ_Envelope *env;
222 struct GNUNET_NAT_AutoconfigRequestMessage *req; 221 struct GNUNET_NAT_AUTO_AutoconfigRequestMessage *req;
223 char *buf; 222 char *buf;
224 size_t size; 223 size_t size;
225 224
@@ -265,7 +264,7 @@ GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
265 * @param ah handle for operation to abort 264 * @param ah handle for operation to abort
266 */ 265 */
267void 266void
268GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah) 267GNUNET_NAT_AUTO_autoconfig_cancel (struct GNUNET_NAT_AUTO_AutoHandle *ah)
269{ 268{
270 GNUNET_MQ_destroy (ah->mq); 269 GNUNET_MQ_destroy (ah->mq);
271 GNUNET_free (ah); 270 GNUNET_free (ah);