diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-22 20:13:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-22 20:13:41 +0000 |
commit | 3d7721605b69d913000774814146762e560aa2fb (patch) | |
tree | ee7d74ebdee3641bc66516fe1c7c80a3e4b17b2b /src/transport/transport_api.c | |
parent | 104a250fa953fed8646b80f52f2fabe853f17a75 (diff) | |
download | gnunet-3d7721605b69d913000774814146762e560aa2fb.tar.gz gnunet-3d7721605b69d913000774814146762e560aa2fb.zip |
-doxygen, cleanup
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r-- | src/transport/transport_api.c | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 27a281afd..3c57a83a0 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -195,20 +195,36 @@ struct GNUNET_TRANSPORT_TryConnectHandle | |||
195 | */ | 195 | */ |
196 | struct GNUNET_TRANSPORT_TryConnectHandle *next; | 196 | struct GNUNET_TRANSPORT_TryConnectHandle *next; |
197 | 197 | ||
198 | /** | ||
199 | * | ||
200 | */ | ||
198 | struct GNUNET_PeerIdentity pid; | 201 | struct GNUNET_PeerIdentity pid; |
199 | 202 | ||
203 | /** | ||
204 | * | ||
205 | */ | ||
200 | struct GNUNET_TRANSPORT_Handle *th; | 206 | struct GNUNET_TRANSPORT_Handle *th; |
201 | 207 | ||
208 | /** | ||
209 | * | ||
210 | */ | ||
202 | struct GNUNET_TRANSPORT_TransmitHandle *tth; | 211 | struct GNUNET_TRANSPORT_TransmitHandle *tth; |
203 | 212 | ||
213 | /** | ||
214 | * | ||
215 | */ | ||
204 | GNUNET_TRANSPORT_TryConnectCallback cb; | 216 | GNUNET_TRANSPORT_TryConnectCallback cb; |
205 | 217 | ||
206 | int connect; | ||
207 | |||
208 | /** | 218 | /** |
209 | * Closure for @e cb. | 219 | * Closure for @e cb. |
210 | */ | 220 | */ |
211 | void *cb_cls; | 221 | void *cb_cls; |
222 | |||
223 | /** | ||
224 | * | ||
225 | */ | ||
226 | int connect; | ||
227 | |||
212 | }; | 228 | }; |
213 | 229 | ||
214 | 230 | ||
@@ -227,10 +243,19 @@ struct GNUNET_TRANSPORT_OfferHelloHandle | |||
227 | */ | 243 | */ |
228 | struct GNUNET_TRANSPORT_OfferHelloHandle *next; | 244 | struct GNUNET_TRANSPORT_OfferHelloHandle *next; |
229 | 245 | ||
246 | /** | ||
247 | * | ||
248 | */ | ||
230 | struct GNUNET_TRANSPORT_Handle *th; | 249 | struct GNUNET_TRANSPORT_Handle *th; |
231 | 250 | ||
251 | /** | ||
252 | * | ||
253 | */ | ||
232 | struct GNUNET_TRANSPORT_TransmitHandle *tth; | 254 | struct GNUNET_TRANSPORT_TransmitHandle *tth; |
233 | 255 | ||
256 | /** | ||
257 | * | ||
258 | */ | ||
234 | GNUNET_SCHEDULER_Task cont; | 259 | GNUNET_SCHEDULER_Task cont; |
235 | 260 | ||
236 | /** | 261 | /** |
@@ -238,6 +263,9 @@ struct GNUNET_TRANSPORT_OfferHelloHandle | |||
238 | */ | 263 | */ |
239 | void *cls; | 264 | void *cls; |
240 | 265 | ||
266 | /** | ||
267 | * | ||
268 | */ | ||
241 | struct GNUNET_MessageHeader *msg; | 269 | struct GNUNET_MessageHeader *msg; |
242 | }; | 270 | }; |
243 | 271 | ||
@@ -385,7 +413,6 @@ struct GNUNET_TRANSPORT_Handle | |||
385 | }; | 413 | }; |
386 | 414 | ||
387 | 415 | ||
388 | |||
389 | /** | 416 | /** |
390 | * Schedule the task to send one message, either from the control | 417 | * Schedule the task to send one message, either from the control |
391 | * list or the peer message queues to the service. | 418 | * list or the peer message queues to the service. |
@@ -535,7 +562,8 @@ neighbour_delete (void *cls, | |||
535 | * @param msg message received, NULL on timeout or fatal error | 562 | * @param msg message received, NULL on timeout or fatal error |
536 | */ | 563 | */ |
537 | static void | 564 | static void |
538 | demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | 565 | demultiplexer (void *cls, |
566 | const struct GNUNET_MessageHeader *msg) | ||
539 | { | 567 | { |
540 | struct GNUNET_TRANSPORT_Handle *h = cls; | 568 | struct GNUNET_TRANSPORT_Handle *h = cls; |
541 | const struct DisconnectInfoMessage *dim; | 569 | const struct DisconnectInfoMessage *dim; |
@@ -1134,7 +1162,6 @@ cancel_control_transmit (struct GNUNET_TRANSPORT_Handle *th, | |||
1134 | } | 1162 | } |
1135 | 1163 | ||
1136 | 1164 | ||
1137 | |||
1138 | /** | 1165 | /** |
1139 | * Send REQUEST_CONNECT message to the service. | 1166 | * Send REQUEST_CONNECT message to the service. |
1140 | * | 1167 | * |
@@ -1178,6 +1205,7 @@ send_try_connect (void *cls, size_t size, void *buf) | |||
1178 | return sizeof (struct TransportRequestConnectMessage); | 1205 | return sizeof (struct TransportRequestConnectMessage); |
1179 | } | 1206 | } |
1180 | 1207 | ||
1208 | |||
1181 | /** | 1209 | /** |
1182 | * Ask the transport service to establish a connection to | 1210 | * Ask the transport service to establish a connection to |
1183 | * the given peer. | 1211 | * the given peer. |
@@ -1196,10 +1224,10 @@ GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, | |||
1196 | GNUNET_TRANSPORT_TryConnectCallback cb, | 1224 | GNUNET_TRANSPORT_TryConnectCallback cb, |
1197 | void *cb_cls) | 1225 | void *cb_cls) |
1198 | { | 1226 | { |
1199 | struct GNUNET_TRANSPORT_TryConnectHandle *tch = NULL; | 1227 | struct GNUNET_TRANSPORT_TryConnectHandle *tch; |
1200 | 1228 | ||
1201 | if (NULL == handle->client) | 1229 | if (NULL == handle->client) |
1202 | return NULL; | 1230 | return NULL; |
1203 | tch = GNUNET_new (struct GNUNET_TRANSPORT_TryConnectHandle); | 1231 | tch = GNUNET_new (struct GNUNET_TRANSPORT_TryConnectHandle); |
1204 | tch->th = handle; | 1232 | tch->th = handle; |
1205 | tch->pid = *(target); | 1233 | tch->pid = *(target); |
@@ -1209,7 +1237,9 @@ GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, | |||
1209 | tch->tth = schedule_control_transmit (handle, | 1237 | tch->tth = schedule_control_transmit (handle, |
1210 | sizeof (struct TransportRequestConnectMessage), | 1238 | sizeof (struct TransportRequestConnectMessage), |
1211 | &send_try_connect, tch); | 1239 | &send_try_connect, tch); |
1212 | GNUNET_CONTAINER_DLL_insert(handle->tc_head, handle->tc_tail, tch); | 1240 | GNUNET_CONTAINER_DLL_insert (handle->tc_head, |
1241 | handle->tc_tail, | ||
1242 | tch); | ||
1213 | return tch; | 1243 | return tch; |
1214 | } | 1244 | } |
1215 | 1245 | ||
@@ -1232,6 +1262,7 @@ GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *t | |||
1232 | GNUNET_free (tch); | 1262 | GNUNET_free (tch); |
1233 | } | 1263 | } |
1234 | 1264 | ||
1265 | |||
1235 | /** | 1266 | /** |
1236 | * Ask the transport service to shutdown a connection to | 1267 | * Ask the transport service to shutdown a connection to |
1237 | * the given peer. | 1268 | * the given peer. |
@@ -1240,20 +1271,20 @@ GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *t | |||
1240 | * @param target who we should try to connect to | 1271 | * @param target who we should try to connect to |
1241 | * @param cb callback to be called when request was transmitted to transport | 1272 | * @param cb callback to be called when request was transmitted to transport |
1242 | * service | 1273 | * service |
1243 | * @param cb_cls closure for the callback | 1274 | * @param cb_cls closure for the callback @a cb |
1244 | * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or | 1275 | * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or |
1245 | * NULL on failure (cb will not be called) | 1276 | * NULL on failure (cb will not be called) |
1246 | */ | 1277 | */ |
1247 | struct GNUNET_TRANSPORT_TryConnectHandle * | 1278 | struct GNUNET_TRANSPORT_TryConnectHandle * |
1248 | GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle, | 1279 | GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle, |
1249 | const struct GNUNET_PeerIdentity *target, | 1280 | const struct GNUNET_PeerIdentity *target, |
1250 | GNUNET_TRANSPORT_TryConnectCallback cb, | 1281 | GNUNET_TRANSPORT_TryConnectCallback cb, |
1251 | void *cb_cls) | 1282 | void *cb_cls) |
1252 | { | 1283 | { |
1253 | struct GNUNET_TRANSPORT_TryConnectHandle *tch = NULL; | 1284 | struct GNUNET_TRANSPORT_TryConnectHandle *tch; |
1254 | 1285 | ||
1255 | if (NULL == handle->client) | 1286 | if (NULL == handle->client) |
1256 | return NULL; | 1287 | return NULL; |
1257 | tch = GNUNET_new (struct GNUNET_TRANSPORT_TryConnectHandle); | 1288 | tch = GNUNET_new (struct GNUNET_TRANSPORT_TryConnectHandle); |
1258 | tch->th = handle; | 1289 | tch->th = handle; |
1259 | tch->pid = *(target); | 1290 | tch->pid = *(target); |
@@ -1263,7 +1294,9 @@ GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle, | |||
1263 | tch->tth = schedule_control_transmit (handle, | 1294 | tch->tth = schedule_control_transmit (handle, |
1264 | sizeof (struct TransportRequestConnectMessage), | 1295 | sizeof (struct TransportRequestConnectMessage), |
1265 | &send_try_connect, tch); | 1296 | &send_try_connect, tch); |
1266 | GNUNET_CONTAINER_DLL_insert(handle->tc_head, handle->tc_tail, tch); | 1297 | GNUNET_CONTAINER_DLL_insert (handle->tc_head, |
1298 | handle->tc_tail, | ||
1299 | tch); | ||
1267 | return tch; | 1300 | return tch; |
1268 | } | 1301 | } |
1269 | 1302 | ||
@@ -1278,8 +1311,8 @@ void | |||
1278 | GNUNET_TRANSPORT_try_disconnect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *tch) | 1311 | GNUNET_TRANSPORT_try_disconnect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *tch) |
1279 | { | 1312 | { |
1280 | struct GNUNET_TRANSPORT_Handle *th; | 1313 | struct GNUNET_TRANSPORT_Handle *th; |
1281 | GNUNET_assert (GNUNET_NO == tch->connect); | ||
1282 | 1314 | ||
1315 | GNUNET_assert (GNUNET_NO == tch->connect); | ||
1283 | th = tch->th; | 1316 | th = tch->th; |
1284 | cancel_control_transmit (th, tch->tth); | 1317 | cancel_control_transmit (th, tch->tth); |
1285 | GNUNET_CONTAINER_DLL_remove (th->tc_head, th->tc_tail, tch); | 1318 | GNUNET_CONTAINER_DLL_remove (th->tc_head, th->tc_tail, tch); |
@@ -1287,8 +1320,6 @@ GNUNET_TRANSPORT_try_disconnect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle | |||
1287 | } | 1320 | } |
1288 | 1321 | ||
1289 | 1322 | ||
1290 | |||
1291 | |||
1292 | /** | 1323 | /** |
1293 | * Send HELLO message to the service. | 1324 | * Send HELLO message to the service. |
1294 | * | 1325 | * |