aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-09 14:53:44 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-09 14:53:44 +0000
commit7ae3bcd234e062c28f66db9758f61af401d0a707 (patch)
treeadb1da7611b0afd6ff0fa094a6f6bc7ebabd174e /src/core
parent006eb1c4f3307fe89c786c2f1ac866611e33d3cd (diff)
downloadgnunet-7ae3bcd234e062c28f66db9758f61af401d0a707.tar.gz
gnunet-7ae3bcd234e062c28f66db9758f61af401d0a707.zip
-simplifying core API (#2400)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core_api.c22
-rw-r--r--src/core/test_core_api.c4
-rw-r--r--src/core/test_core_api_reliability.c4
-rw-r--r--src/core/test_core_api_send_to_self.c2
-rw-r--r--src/core/test_core_api_start_only.c4
-rw-r--r--src/core/test_core_quota_compliance.c4
6 files changed, 23 insertions, 17 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 526dc9fff..2b6407b6e 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -1158,7 +1158,6 @@ reconnect (struct GNUNET_CORE_Handle *h)
1158 * complete (or fail) asynchronously. 1158 * complete (or fail) asynchronously.
1159 * 1159 *
1160 * @param cfg configuration to use 1160 * @param cfg configuration to use
1161 * @param queue_size size of the per-peer message queue
1162 * @param cls closure for the various callbacks that follow (including handlers in the handlers array) 1161 * @param cls closure for the various callbacks that follow (including handlers in the handlers array)
1163 * @param init callback to call once we have successfully 1162 * @param init callback to call once we have successfully
1164 * connected to the core service 1163 * connected to the core service
@@ -1178,7 +1177,7 @@ reconnect (struct GNUNET_CORE_Handle *h)
1178 */ 1177 */
1179struct GNUNET_CORE_Handle * 1178struct GNUNET_CORE_Handle *
1180GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 1179GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1181 unsigned int queue_size, void *cls, 1180 void *cls,
1182 GNUNET_CORE_StartupCallback init, 1181 GNUNET_CORE_StartupCallback init,
1183 GNUNET_CORE_ConnectEventHandler connects, 1182 GNUNET_CORE_ConnectEventHandler connects,
1184 GNUNET_CORE_DisconnectEventHandler disconnects, 1183 GNUNET_CORE_DisconnectEventHandler disconnects,
@@ -1192,7 +1191,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1192 1191
1193 h = GNUNET_malloc (sizeof (struct GNUNET_CORE_Handle)); 1192 h = GNUNET_malloc (sizeof (struct GNUNET_CORE_Handle));
1194 h->cfg = cfg; 1193 h->cfg = cfg;
1195 h->queue_size = queue_size; 1194 h->queue_size = 1; // FIXME: remove entirely...
1196 h->cls = cls; 1195 h->cls = cls;
1197 h->init = init; 1196 h->init = init;
1198 h->connects = connects; 1197 h->connects = connects;
@@ -1285,9 +1284,13 @@ run_request_next_transmission (void *cls,
1285 1284
1286/** 1285/**
1287 * Ask the core to call "notify" once it is ready to transmit the 1286 * Ask the core to call "notify" once it is ready to transmit the
1288 * given number of bytes to the specified "target". Must only be 1287 * given number of bytes to the specified "target". Must only be
1289 * called after a connection to the respective peer has been 1288 * called after a connection to the respective peer has been
1290 * established (and the client has been informed about this). 1289 * established (and the client has been informed about this). You may
1290 * have one request of this type pending for each connected peer at
1291 * any time. If a peer disconnects, the application MUST call
1292 * "GNUNET_CORE_notify_transmit_ready_cancel" on the respective
1293 * transmission request, if one such request is pending.
1291 * 1294 *
1292 * @param handle connection to core service 1295 * @param handle connection to core service
1293 * @param cork is corking allowed for this transmission? 1296 * @param cork is corking allowed for this transmission?
@@ -1295,11 +1298,14 @@ run_request_next_transmission (void *cls,
1295 * @param maxdelay how long can the message wait? 1298 * @param maxdelay how long can the message wait?
1296 * @param target who should receive the message, never NULL (can be this peer's identity for loopback) 1299 * @param target who should receive the message, never NULL (can be this peer's identity for loopback)
1297 * @param notify_size how many bytes of buffer space does notify want? 1300 * @param notify_size how many bytes of buffer space does notify want?
1298 * @param notify function to call when buffer space is available 1301 * @param notify function to call when buffer space is available;
1302 * will be called with NULL on timeout; clients MUST cancel
1303 * all pending transmission requests DURING the disconnect
1304 * handler
1299 * @param notify_cls closure for notify 1305 * @param notify_cls closure for notify
1300 * @return non-NULL if the notify callback was queued, 1306 * @return non-NULL if the notify callback was queued,
1301 * NULL if we can not even queue the request (insufficient 1307 * NULL if we can not even queue the request (request already pending);
1302 * memory); if NULL is returned, "notify" will NOT be called. 1308 * if NULL is returned, "notify" will NOT be called.
1303 */ 1309 */
1304struct GNUNET_CORE_TransmitHandle * 1310struct GNUNET_CORE_TransmitHandle *
1305GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, 1311GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index 37d166983..d1591328f 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -299,7 +299,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
299 OKPP; 299 OKPP;
300 /* connect p2 */ 300 /* connect p2 */
301 p2.ch = 301 p2.ch =
302 GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, 302 GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify,
303 &disconnect_notify, &inbound_notify, GNUNET_YES, 303 &disconnect_notify, &inbound_notify, GNUNET_YES,
304 &outbound_notify, GNUNET_YES, handlers); 304 &outbound_notify, GNUNET_YES, handlers);
305 } 305 }
@@ -346,7 +346,7 @@ run (void *cls, char *const *args, const char *cfgfile,
346 (GNUNET_TIME_UNIT_SECONDS, 300), 346 (GNUNET_TIME_UNIT_SECONDS, 300),
347 &terminate_task_error, NULL); 347 &terminate_task_error, NULL);
348 p1.ch = 348 p1.ch =
349 GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, 349 GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify,
350 &disconnect_notify, &inbound_notify, GNUNET_YES, 350 &disconnect_notify, &inbound_notify, GNUNET_YES,
351 &outbound_notify, GNUNET_YES, handlers); 351 &outbound_notify, GNUNET_YES, handlers);
352} 352}
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index e18d8c4fd..682424f89 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -384,7 +384,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
384 GNUNET_assert (ok == 2); 384 GNUNET_assert (ok == 2);
385 OKPP; 385 OKPP;
386 /* connect p2 */ 386 /* connect p2 */
387 GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, 387 GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify,
388 &disconnect_notify, &inbound_notify, GNUNET_YES, 388 &disconnect_notify, &inbound_notify, GNUNET_YES,
389 &outbound_notify, GNUNET_YES, handlers); 389 &outbound_notify, GNUNET_YES, handlers);
390 } 390 }
@@ -450,7 +450,7 @@ run (void *cls, char *const *args, const char *cfgfile,
450 setup_peer (&p2, "test_core_api_peer2.conf"); 450 setup_peer (&p2, "test_core_api_peer2.conf");
451 err_task = 451 err_task =
452 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL); 452 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
453 GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, 453 GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify,
454 &disconnect_notify, &inbound_notify, GNUNET_YES, 454 &disconnect_notify, &inbound_notify, GNUNET_YES,
455 &outbound_notify, GNUNET_YES, handlers); 455 &outbound_notify, GNUNET_YES, handlers);
456} 456}
diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c
index b1340dcfb..3827cdb77 100644
--- a/src/core/test_core_api_send_to_self.c
+++ b/src/core/test_core_api_send_to_self.c
@@ -182,7 +182,7 @@ run (void *cls, char *const *args, const char *cfgfile,
182 "test_core_api_peer1.conf")); 182 "test_core_api_peer1.conf"));
183 183
184 core = 184 core =
185 GNUNET_CORE_connect (core_cfg, 42, NULL, &init, &connect_cb, NULL, NULL, 185 GNUNET_CORE_connect (core_cfg, NULL, &init, &connect_cb, NULL, NULL,
186 0, NULL, 0, handlers); 186 0, NULL, 0, handlers);
187 187
188 die_task = 188 die_task =
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c
index 8c8132043..308814b21 100644
--- a/src/core/test_core_api_start_only.c
+++ b/src/core/test_core_api_start_only.c
@@ -129,7 +129,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
129 { 129 {
130 /* connect p2 */ 130 /* connect p2 */
131 p2.ch = 131 p2.ch =
132 GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, 132 GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify,
133 &disconnect_notify, &inbound_notify, GNUNET_YES, 133 &disconnect_notify, &inbound_notify, GNUNET_YES,
134 &outbound_notify, GNUNET_YES, handlers); 134 &outbound_notify, GNUNET_YES, handlers);
135 } 135 }
@@ -191,7 +191,7 @@ run (void *cls, char *const *args, const char *cfgfile,
191 (GNUNET_TIME_UNIT_MINUTES, TIMEOUT), 191 (GNUNET_TIME_UNIT_MINUTES, TIMEOUT),
192 &timeout_task, NULL); 192 &timeout_task, NULL);
193 p1.ch = 193 p1.ch =
194 GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, 194 GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify,
195 &disconnect_notify, &inbound_notify, GNUNET_YES, 195 &disconnect_notify, &inbound_notify, GNUNET_YES,
196 &outbound_notify, GNUNET_YES, handlers); 196 &outbound_notify, GNUNET_YES, handlers);
197} 197}
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index df602b37f..bee8c02b4 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -527,7 +527,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
527 OKPP; 527 OKPP;
528 /* connect p2 */ 528 /* connect p2 */
529 p2.ch = 529 p2.ch =
530 GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, 530 GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify,
531 &disconnect_notify, &inbound_notify, GNUNET_YES, 531 &disconnect_notify, &inbound_notify, GNUNET_YES,
532 &outbound_notify, GNUNET_YES, handlers); 532 &outbound_notify, GNUNET_YES, handlers);
533 } 533 }
@@ -629,7 +629,7 @@ run (void *cls, char *const *args, const char *cfgfile,
629 &current_quota_p2_out)); 629 &current_quota_p2_out));
630 630
631 p1.ch = 631 p1.ch =
632 GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, 632 GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify,
633 &disconnect_notify, &inbound_notify, GNUNET_YES, 633 &disconnect_notify, &inbound_notify, GNUNET_YES,
634 &outbound_notify, GNUNET_YES, handlers); 634 &outbound_notify, GNUNET_YES, handlers);
635} 635}