aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ats-tests/ats-testing-traffic.c13
-rw-r--r--src/core/core_api.c16
-rw-r--r--src/core/gnunet-service-core.h3
-rw-r--r--src/core/gnunet-service-core_clients.c8
-rw-r--r--src/core/test_core_api.c3
-rw-r--r--src/core/test_core_api_reliability.c9
-rw-r--r--src/core/test_core_quota_compliance.c9
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c12
-rw-r--r--src/dv/gnunet-service-dv.c4
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_nodes.c6
-rw-r--r--src/fs/gnunet-service-fs_cp.c8
-rw-r--r--src/hostlist/hostlist-server.c3
-rw-r--r--src/include/gnunet_core_service.h59
-rw-r--r--src/mesh/gnunet-service-mesh_peer.c9
-rw-r--r--src/nse/gnunet-service-nse.c5
-rw-r--r--src/topology/gnunet-daemon-topology.c3
16 files changed, 110 insertions, 60 deletions
diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c
index 9163d2cd1..ecee76816 100644
--- a/src/ats-tests/ats-testing-traffic.c
+++ b/src/ats-tests/ats-testing-traffic.c
@@ -104,7 +104,9 @@ comm_schedule_send (void *cls,
104 if (GNUNET_YES == top->test_core) 104 if (GNUNET_YES == top->test_core)
105 { 105 {
106 p->cth = GNUNET_CORE_notify_transmit_ready ( 106 p->cth = GNUNET_CORE_notify_transmit_ready (
107 p->me->ch, GNUNET_NO, 0, GNUNET_TIME_UNIT_MINUTES, &p->dest->id, 107 p->me->ch, GNUNET_NO,
108 GNUNET_CORE_PRIO_BEST_EFFORT,
109 GNUNET_TIME_UNIT_MINUTES, &p->dest->id,
108 TEST_MESSAGE_SIZE, &send_ping_ready_cb, p); 110 TEST_MESSAGE_SIZE, &send_ping_ready_cb, p);
109 } 111 }
110 else 112 else
@@ -159,9 +161,12 @@ GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p)
159 { 161 {
160 GNUNET_assert (NULL == p->cth); 162 GNUNET_assert (NULL == p->cth);
161 163
162 p->cth = GNUNET_CORE_notify_transmit_ready (p->me->ch, GNUNET_NO, 0, 164 p->cth
163 GNUNET_TIME_UNIT_MINUTES, &p->dest->id, TEST_MESSAGE_SIZE, 165 = GNUNET_CORE_notify_transmit_ready (p->me->ch, GNUNET_NO,
164 &comm_send_pong_ready, p); 166 GNUNET_CORE_PRIO_BEST_EFFORT,
167 GNUNET_TIME_UNIT_MINUTES,
168 &p->dest->id, TEST_MESSAGE_SIZE,
169 &comm_send_pong_ready, p);
165 } 170 }
166 else 171 else
167 { 172 {
diff --git a/src/core/core_api.c b/src/core/core_api.c
index c69e3fe1d..56bd29df3 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -71,7 +71,7 @@ struct GNUNET_CORE_TransmitHandle
71 /** 71 /**
72 * How important is this message? 72 * How important is this message?
73 */ 73 */
74 uint32_t priority; 74 enum GNUNET_CORE_Priority priority;
75 75
76 /** 76 /**
77 * Size of this request. 77 * Size of this request.
@@ -517,7 +517,7 @@ request_next_transmission (struct PeerRecord *pr)
517 smr = (struct SendMessageRequest *) &cm[1]; 517 smr = (struct SendMessageRequest *) &cm[1];
518 smr->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST); 518 smr->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST);
519 smr->header.size = htons (sizeof (struct SendMessageRequest)); 519 smr->header.size = htons (sizeof (struct SendMessageRequest));
520 smr->priority = htonl (th->priority); 520 smr->priority = htonl ((uint32_t) th->priority);
521 smr->deadline = GNUNET_TIME_absolute_hton (th->timeout); 521 smr->deadline = GNUNET_TIME_absolute_hton (th->timeout);
522 smr->peer = pr->peer; 522 smr->peer = pr->peer;
523 smr->reserved = htonl (0); 523 smr->reserved = htonl (0);
@@ -653,7 +653,7 @@ transmit_message (void *cls, size_t size, void *buf)
653 GNUNET_i2s (&pr->peer), (unsigned int) th->msize); 653 GNUNET_i2s (&pr->peer), (unsigned int) th->msize);
654 sm = (struct SendMessage *) buf; 654 sm = (struct SendMessage *) buf;
655 sm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND); 655 sm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND);
656 sm->priority = htonl (th->priority); 656 sm->priority = htonl ((uint32_t) th->priority);
657 sm->deadline = GNUNET_TIME_absolute_hton (th->timeout); 657 sm->deadline = GNUNET_TIME_absolute_hton (th->timeout);
658 sm->peer = pr->peer; 658 sm->peer = pr->peer;
659 sm->cork = htonl ((uint32_t) th->cork); 659 sm->cork = htonl ((uint32_t) th->cork);
@@ -1187,7 +1187,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1187 1187
1188/** 1188/**
1189 * Disconnect from the core service. This function can only 1189 * Disconnect from the core service. This function can only
1190 * be called *after* all pending 'GNUNET_CORE_notify_transmit_ready' 1190 * be called *after* all pending #GNUNET_CORE_notify_transmit_ready()
1191 * requests have been explicitly canceled. 1191 * requests have been explicitly canceled.
1192 * 1192 *
1193 * @param handle connection to core to disconnect 1193 * @param handle connection to core to disconnect
@@ -1279,7 +1279,7 @@ run_request_next_transmission (void *cls,
1279 */ 1279 */
1280struct GNUNET_CORE_TransmitHandle * 1280struct GNUNET_CORE_TransmitHandle *
1281GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, 1281GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
1282 uint32_t priority, 1282 enum GNUNET_CORE_Priority priority,
1283 struct GNUNET_TIME_Relative maxdelay, 1283 struct GNUNET_TIME_Relative maxdelay,
1284 const struct GNUNET_PeerIdentity *target, 1284 const struct GNUNET_PeerIdentity *target,
1285 size_t notify_size, 1285 size_t notify_size,
@@ -1289,9 +1289,6 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
1289 struct PeerRecord *pr; 1289 struct PeerRecord *pr;
1290 struct GNUNET_CORE_TransmitHandle *th; 1290 struct GNUNET_CORE_TransmitHandle *th;
1291 1291
1292 GNUNET_assert (NULL != handle);
1293 GNUNET_assert (NULL != target);
1294
1295 if (notify_size > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE) 1292 if (notify_size > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE)
1296 { 1293 {
1297 GNUNET_break (0); 1294 GNUNET_break (0);
@@ -1329,7 +1326,8 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
1329 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task); 1326 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task);
1330 pr->ntr_task = 1327 pr->ntr_task =
1331 GNUNET_SCHEDULER_add_now (&run_request_next_transmission, pr); 1328 GNUNET_SCHEDULER_add_now (&run_request_next_transmission, pr);
1332 LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmission request added to queue\n"); 1329 LOG (GNUNET_ERROR_TYPE_DEBUG,
1330 "Transmission request added to queue\n");
1333 return th; 1331 return th;
1334} 1332}
1335 1333
diff --git a/src/core/gnunet-service-core.h b/src/core/gnunet-service-core.h
index e48ad8bad..8d3e8ee2a 100644
--- a/src/core/gnunet-service-core.h
+++ b/src/core/gnunet-service-core.h
@@ -27,6 +27,7 @@
27#define GNUNET_SERVICE_CORE_H 27#define GNUNET_SERVICE_CORE_H
28 28
29#include "gnunet_statistics_service.h" 29#include "gnunet_statistics_service.h"
30#include "gnunet_core_service.h"
30#include "core.h" 31#include "core.h"
31 32
32/** 33/**
@@ -73,7 +74,7 @@ struct GSC_ClientActiveRequest
73 /** 74 /**
74 * How important is this request. 75 * How important is this request.
75 */ 76 */
76 uint32_t priority; 77 enum GNUNET_CORE_Priority priority;
77 78
78 /** 79 /**
79 * Has this request been solicited yet? 80 * Has this request been solicited yet?
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c
index f6574b7f9..f153ac397 100644
--- a/src/core/gnunet-service-core_clients.c
+++ b/src/core/gnunet-service-core_clients.c
@@ -374,7 +374,7 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
374 } 374 }
375 375
376 car = GNUNET_CONTAINER_multipeermap_get (c->requests, &req->peer); 376 car = GNUNET_CONTAINER_multipeermap_get (c->requests, &req->peer);
377 if (car == NULL) 377 if (NULL == car)
378 { 378 {
379 /* create new entry */ 379 /* create new entry */
380 car = GNUNET_new (struct GSC_ClientActiveRequest); 380 car = GNUNET_new (struct GSC_ClientActiveRequest);
@@ -391,7 +391,7 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
391 } 391 }
392 car->target = req->peer; 392 car->target = req->peer;
393 car->deadline = GNUNET_TIME_absolute_ntoh (req->deadline); 393 car->deadline = GNUNET_TIME_absolute_ntoh (req->deadline);
394 car->priority = ntohl (req->priority); 394 car->priority = (enum GNUNET_CORE_Priority) ntohl (req->priority);
395 car->msize = ntohs (req->size); 395 car->msize = ntohs (req->size);
396 car->smr_id = req->smr_id; 396 car->smr_id = req->smr_id;
397 car->was_solicited = GNUNET_NO; 397 car->was_solicited = GNUNET_NO;
@@ -503,7 +503,7 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client,
503 * or other CLIENT (for loopback). 503 * or other CLIENT (for loopback).
504 * 504 *
505 * @param cls closure 505 * @param cls closure
506 * @param client reservation request ('struct GSC_ClientActiveRequest') 506 * @param client reservation request (`struct GSC_ClientActiveRequest`)
507 * @param message the actual message 507 * @param message the actual message
508 */ 508 */
509static int 509static int
@@ -560,7 +560,7 @@ client_tokenizer_callback (void *cls, void *client,
560 * 560 *
561 * @param cls NULL 561 * @param cls NULL
562 * @param key identity of peer for which this is an active request 562 * @param key identity of peer for which this is an active request
563 * @param value the 'struct GSC_ClientActiveRequest' to free 563 * @param value the `struct GSC_ClientActiveRequest` to free
564 * @return #GNUNET_YES (continue iteration) 564 * @return #GNUNET_YES (continue iteration)
565 */ 565 */
566static int 566static int
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index af2b98e41..b3674fdec 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -174,7 +174,8 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
174 "Asking core (1) for transmission to peer `%4s'\n", 174 "Asking core (1) for transmission to peer `%4s'\n",
175 GNUNET_i2s (&p2.id)); 175 GNUNET_i2s (&p2.id));
176 if (NULL == 176 if (NULL ==
177 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_YES, 0, 177 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_YES,
178 GNUNET_CORE_PRIO_BEST_EFFORT,
178 GNUNET_TIME_relative_multiply 179 GNUNET_TIME_relative_multiply
179 (GNUNET_TIME_UNIT_SECONDS, 145), 180 (GNUNET_TIME_UNIT_SECONDS, 145),
180 &p2.id, 181 &p2.id,
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index 97006fe95..cb05fa9e5 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -189,7 +189,8 @@ transmit_ready (void *cls, size_t size, void *buf)
189 { 189 {
190 if (p1.ch != NULL) 190 if (p1.ch != NULL)
191 GNUNET_break (NULL != 191 GNUNET_break (NULL !=
192 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0, 192 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
193 GNUNET_CORE_PRIO_BEST_EFFORT,
193 FAST_TIMEOUT, &p2.id, 194 FAST_TIMEOUT, &p2.id,
194 get_size (tr_n), 195 get_size (tr_n),
195 &transmit_ready, &p1)); 196 &transmit_ready, &p1));
@@ -250,7 +251,8 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
250 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL); 251 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
251 start_time = GNUNET_TIME_absolute_get (); 252 start_time = GNUNET_TIME_absolute_get ();
252 GNUNET_break (NULL != 253 GNUNET_break (NULL !=
253 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0, 254 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
255 GNUNET_CORE_PRIO_BEST_EFFORT,
254 TIMEOUT, &p2.id, 256 TIMEOUT, &p2.id,
255 get_size (0), 257 get_size (0),
256 &transmit_ready, &p1)); 258 &transmit_ready, &p1));
@@ -340,7 +342,8 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
340 { 342 {
341 if (n == tr_n) 343 if (n == tr_n)
342 GNUNET_break (NULL != 344 GNUNET_break (NULL !=
343 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0, 345 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
346 GNUNET_CORE_PRIO_BEST_EFFORT,
344 FAST_TIMEOUT, &p2.id, 347 FAST_TIMEOUT, &p2.id,
345 get_size (tr_n), 348 get_size (tr_n),
346 &transmit_ready, &p1)); 349 &transmit_ready, &p1));
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 91ba1d621..0e74fbef5 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -325,7 +325,8 @@ transmit_ready (void *cls, size_t size, void *buf)
325 if ((p1.ch != NULL) && (p1.connect_status == 1)) 325 if ((p1.ch != NULL) && (p1.connect_status == 1))
326 GNUNET_break (NULL != 326 GNUNET_break (NULL !=
327 (p1.nth = 327 (p1.nth =
328 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0, 328 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
329 GNUNET_CORE_PRIO_BEST_EFFORT,
329 FAST_TIMEOUT, &p2.id, 330 FAST_TIMEOUT, &p2.id,
330 MESSAGESIZE, 331 MESSAGESIZE,
331 &transmit_ready, &p1))); 332 &transmit_ready, &p1)));
@@ -392,7 +393,8 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
392 393
393 GNUNET_break (NULL != 394 GNUNET_break (NULL !=
394 (p1.nth = 395 (p1.nth =
395 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0, 396 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
397 GNUNET_CORE_PRIO_BEST_EFFORT,
396 TIMEOUT, &p2.id, 398 TIMEOUT, &p2.id,
397 MESSAGESIZE, 399 MESSAGESIZE,
398 &transmit_ready, &p1))); 400 &transmit_ready, &p1)));
@@ -488,7 +490,8 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
488 490
489 if (running == GNUNET_YES) 491 if (running == GNUNET_YES)
490 GNUNET_break (NULL != 492 GNUNET_break (NULL !=
491 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0, 493 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
494 GNUNET_CORE_PRIO_BEST_EFFORT,
492 FAST_TIMEOUT, &p2.id, 495 FAST_TIMEOUT, &p2.id,
493 MESSAGESIZE, 496 MESSAGESIZE,
494 &transmit_ready, &p1)); 497 &transmit_ready, &p1));
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index d15af4ee6..25aa0c7b5 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -793,16 +793,16 @@ core_transmit_notify (void *cls, size_t size, void *buf)
793 GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending); 793 GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending);
794 GNUNET_free (pending); 794 GNUNET_free (pending);
795 } 795 }
796 if (pending == NULL) 796 if (NULL == pending)
797 { 797 {
798 /* no messages pending */ 798 /* no messages pending */
799 return 0; 799 return 0;
800 } 800 }
801 if (buf == NULL) 801 if (NULL == buf)
802 { 802 {
803 peer->th = 803 peer->th =
804 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, 804 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO,
805 pending->importance, 805 GNUNET_CORE_PRIO_BEST_EFFORT,
806 GNUNET_TIME_absolute_get_remaining 806 GNUNET_TIME_absolute_get_remaining
807 (pending->timeout), &peer->id, 807 (pending->timeout), &peer->id,
808 ntohs (pending->msg->size), 808 ntohs (pending->msg->size),
@@ -828,7 +828,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
828 { 828 {
829 peer->th = 829 peer->th =
830 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, 830 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO,
831 pending->importance, 831 GNUNET_CORE_PRIO_BEST_EFFORT,
832 GNUNET_TIME_absolute_get_remaining 832 GNUNET_TIME_absolute_get_remaining
833 (pending->timeout), &peer->id, msize, 833 (pending->timeout), &peer->id, msize,
834 &core_transmit_notify, peer); 834 &core_transmit_notify, peer);
@@ -858,7 +858,7 @@ process_peer_queue (struct PeerInfo *peer)
858 ntohs (pending->msg->size), GNUNET_NO); 858 ntohs (pending->msg->size), GNUNET_NO);
859 peer->th = 859 peer->th =
860 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, 860 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO,
861 pending->importance, 861 GNUNET_CORE_PRIO_BEST_EFFORT,
862 GNUNET_TIME_absolute_get_remaining 862 GNUNET_TIME_absolute_get_remaining
863 (pending->timeout), &peer->id, 863 (pending->timeout), &peer->id,
864 ntohs (pending->msg->size), 864 ntohs (pending->msg->size),
@@ -2224,4 +2224,4 @@ GDS_NEIGHBOURS_get_id ()
2224} 2224}
2225 2225
2226 2226
2227/* end of gnunet-service-dht_neighbours.c */ \ No newline at end of file 2227/* end of gnunet-service-dht_neighbours.c */
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index 70a55494c..a3d6e4942 100644
--- a/src/dv/gnunet-service-dv.c
+++ b/src/dv/gnunet-service-dv.c
@@ -637,7 +637,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
637 dn->cth = 637 dn->cth =
638 GNUNET_CORE_notify_transmit_ready (core_api, 638 GNUNET_CORE_notify_transmit_ready (core_api,
639 GNUNET_YES /* cork */, 639 GNUNET_YES /* cork */,
640 0 /* priority */, 640 GNUNET_CORE_PRIO_BEST_EFFORT,
641 GNUNET_TIME_UNIT_FOREVER_REL, 641 GNUNET_TIME_UNIT_FOREVER_REL,
642 &dn->peer, 642 &dn->peer,
643 msize, 643 msize,
@@ -705,7 +705,7 @@ forward_payload (struct DirectNeighbor *target,
705 if (NULL == target->cth) 705 if (NULL == target->cth)
706 target->cth = GNUNET_CORE_notify_transmit_ready (core_api, 706 target->cth = GNUNET_CORE_notify_transmit_ready (core_api,
707 GNUNET_YES /* cork */, 707 GNUNET_YES /* cork */,
708 0 /* priority */, 708 GNUNET_CORE_PRIO_BEST_EFFORT,
709 GNUNET_TIME_UNIT_FOREVER_REL, 709 GNUNET_TIME_UNIT_FOREVER_REL,
710 &target->peer, 710 &target->peer,
711 msize, 711 msize,
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c
index 65b2d9c38..1c4152793 100644
--- a/src/experimentation/gnunet-daemon-experimentation_nodes.c
+++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c
@@ -210,7 +210,9 @@ schedule_transmisson (struct NodeComCtx *e_ctx)
210 if (NULL != e_ctx->n->cth) 210 if (NULL != e_ctx->n->cth)
211 return; 211 return;
212 212
213 e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT, 213 e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO,
214 GNUNET_CORE_PRIO_BEST_EFFORT,
215 FAST_TIMEOUT,
214 &e_ctx->n->id, e_ctx->size, 216 &e_ctx->n->id, e_ctx->size,
215 transmit_read_wrapper, e_ctx); 217 transmit_read_wrapper, e_ctx);
216 if (NULL == e_ctx->n->cth) 218 if (NULL == e_ctx->n->cth)
@@ -281,7 +283,7 @@ send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
281 size_t ri_size = sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) * my_issuer_count; 283 size_t ri_size = sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) * my_issuer_count;
282 size_t total_size = msg_size + ri_size; 284 size_t total_size = msg_size + ri_size;
283 struct GNUNET_CRYPTO_EddsaPublicKey *issuers; 285 struct GNUNET_CRYPTO_EddsaPublicKey *issuers;
284 286
285 n->cth = NULL; 287 n->cth = NULL;
286 if (NULL == buf) 288 if (NULL == buf)
287 { 289 {
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index a586ea503..82b1f5867 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -268,7 +268,7 @@ struct GSF_ConnectedPeer
268 268
269 /** 269 /**
270 * Set to 1 if we're currently in the process of calling 270 * Set to 1 if we're currently in the process of calling
271 * 'GNUNET_CORE_notify_transmit_ready' (so while cth is 271 * #GNUNET_CORE_notify_transmit_ready() (so while cth is
272 * NULL, we should not call notify_transmit_ready for this 272 * NULL, we should not call notify_transmit_ready for this
273 * handle right now). 273 * handle right now).
274 */ 274 */
@@ -439,7 +439,8 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
439 GNUNET_assert (NULL == cp->cth); 439 GNUNET_assert (NULL == cp->cth);
440 cp->cth_in_progress++; 440 cp->cth_in_progress++;
441 cp->cth = 441 cp->cth =
442 GNUNET_CORE_notify_transmit_ready (GSF_core, GNUNET_YES, pth->priority, 442 GNUNET_CORE_notify_transmit_ready (GSF_core, GNUNET_YES,
443 GNUNET_CORE_PRIO_BACKGROUND,
443 GNUNET_TIME_absolute_get_remaining 444 GNUNET_TIME_absolute_get_remaining
444 (pth->timeout), &target, pth->size, 445 (pth->timeout), &target, pth->size,
445 &peer_transmit_ready_cb, cp); 446 &peer_transmit_ready_cb, cp);
@@ -558,7 +559,8 @@ ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
558 /* reservation success, try transmission now! */ 559 /* reservation success, try transmission now! */
559 cp->cth_in_progress++; 560 cp->cth_in_progress++;
560 cp->cth = 561 cp->cth =
561 GNUNET_CORE_notify_transmit_ready (GSF_core, GNUNET_YES, pth->priority, 562 GNUNET_CORE_notify_transmit_ready (GSF_core, GNUNET_YES,
563 GNUNET_CORE_PRIO_BACKGROUND,
562 GNUNET_TIME_absolute_get_remaining 564 GNUNET_TIME_absolute_get_remaining
563 (pth->timeout), peer, pth->size, 565 (pth->timeout), peer, pth->size,
564 &peer_transmit_ready_cb, cp); 566 &peer_transmit_ready_cb, cp);
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c
index ef4debc05..2564991d5 100644
--- a/src/hostlist/hostlist-server.c
+++ b/src/hostlist/hostlist-server.c
@@ -381,7 +381,8 @@ connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer)
381 "Asked core to transmit advertisement message with a size of %u bytes to peer `%s'\n", 381 "Asked core to transmit advertisement message with a size of %u bytes to peer `%s'\n",
382 size, GNUNET_i2s (peer)); 382 size, GNUNET_i2s (peer));
383 if (NULL == 383 if (NULL ==
384 GNUNET_CORE_notify_transmit_ready (core, GNUNET_YES, 0, 384 GNUNET_CORE_notify_transmit_ready (core, GNUNET_YES,
385 GNUNET_CORE_PRIO_BEST_EFFORT,
385 GNUNET_ADV_TIMEOUT, peer, size, 386 GNUNET_ADV_TIMEOUT, peer, size,
386 &adv_transmit_ready, NULL)) 387 &adv_transmit_ready, NULL))
387 { 388 {
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index 4eca0cc03..6c68a6833 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -46,6 +46,34 @@ extern "C"
46 */ 46 */
47#define GNUNET_CORE_VERSION 0x00000001 47#define GNUNET_CORE_VERSION 0x00000001
48 48
49/**
50 * Traffic priorities.
51 */
52enum GNUNET_CORE_Priority
53{
54
55 /**
56 * Highest priority, control traffic (i.e. NSE, Core/Mesh KX).
57 */
58 GNUNET_CORE_PRIO_CRITICAL_CONTROL = 0,
59
60 /**
61 * Urgent traffic (local peer, i.e. conversation).
62 */
63 GNUNET_CORE_PRIO_URGENT = 1,
64
65 /**
66 * Normal traffic (i.e. mesh/dv relay, DHT)
67 */
68 GNUNET_CORE_PRIO_BEST_EFFORT = 2,
69
70 /**
71 * Background traffic (i.e. fs)
72 */
73 GNUNET_CORE_PRIO_BACKGROUND = 3
74
75};
76
49 77
50/** 78/**
51 * Opaque handle to the service. 79 * Opaque handle to the service.
@@ -59,8 +87,9 @@ struct GNUNET_CORE_Handle;
59 * @param cls closure 87 * @param cls closure
60 * @param peer peer identity this notification is about 88 * @param peer peer identity this notification is about
61 */ 89 */
62typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, 90typedef void
63 const struct GNUNET_PeerIdentity *peer); 91(*GNUNET_CORE_ConnectEventHandler) (void *cls,
92 const struct GNUNET_PeerIdentity *peer);
64 93
65 94
66/** 95/**
@@ -69,8 +98,9 @@ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls,
69 * @param cls closure 98 * @param cls closure
70 * @param peer peer identity this notification is about 99 * @param peer peer identity this notification is about
71 */ 100 */
72typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, 101typedef void
73 const struct GNUNET_PeerIdentity *peer); 102(*GNUNET_CORE_DisconnectEventHandler) (void *cls,
103 const struct GNUNET_PeerIdentity *peer);
74 104
75 105
76/** 106/**
@@ -84,11 +114,10 @@ typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls,
84 * @return #GNUNET_OK to keep the connection open, 114 * @return #GNUNET_OK to keep the connection open,
85 * #GNUNET_SYSERR to close connection to the peer (signal serious error) 115 * #GNUNET_SYSERR to close connection to the peer (signal serious error)
86 */ 116 */
87typedef int (*GNUNET_CORE_MessageCallback) (void *cls, 117typedef int
88 const struct GNUNET_PeerIdentity * 118(*GNUNET_CORE_MessageCallback) (void *cls,
89 other, 119 const struct GNUNET_PeerIdentity *other,
90 const struct GNUNET_MessageHeader * 120 const struct GNUNET_MessageHeader *message);
91 message);
92 121
93 122
94/** 123/**
@@ -98,7 +127,7 @@ typedef int (*GNUNET_CORE_MessageCallback) (void *cls,
98struct GNUNET_CORE_MessageHandler 127struct GNUNET_CORE_MessageHandler
99{ 128{
100 /** 129 /**
101 * Function to call for messages of "type". 130 * Function to call for messages of @e type.
102 */ 131 */
103 GNUNET_CORE_MessageCallback callback; 132 GNUNET_CORE_MessageCallback callback;
104 133
@@ -129,8 +158,9 @@ struct GNUNET_CORE_MessageHandler
129 * @param cls closure 158 * @param cls closure
130 * @param my_identity ID of this peer, NULL if we failed 159 * @param my_identity ID of this peer, NULL if we failed
131 */ 160 */
132typedef void (*GNUNET_CORE_StartupCallback) (void *cls, 161typedef void
133 const struct GNUNET_PeerIdentity *my_identity); 162(*GNUNET_CORE_StartupCallback) (void *cls,
163 const struct GNUNET_PeerIdentity *my_identity);
134 164
135 165
136/** 166/**
@@ -233,8 +263,9 @@ struct GNUNET_CORE_TransmitHandle;
233 * if NULL is returned, "notify" will NOT be called. 263 * if NULL is returned, "notify" will NOT be called.
234 */ 264 */
235struct GNUNET_CORE_TransmitHandle * 265struct GNUNET_CORE_TransmitHandle *
236GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, 266GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle,
237 uint32_t priority, 267 int cork,
268 enum GNUNET_CORE_Priority priority,
238 struct GNUNET_TIME_Relative maxdelay, 269 struct GNUNET_TIME_Relative maxdelay,
239 const struct GNUNET_PeerIdentity *target, 270 const struct GNUNET_PeerIdentity *target,
240 size_t notify_size, 271 size_t notify_size,
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c
index 3e4c2acab..7d499f953 100644
--- a/src/mesh/gnunet-service-mesh_peer.c
+++ b/src/mesh/gnunet-service-mesh_peer.c
@@ -838,7 +838,7 @@ queue_send (void *cls, size_t size, void *buf)
838 peer->core_transmit = 838 peer->core_transmit =
839 GNUNET_CORE_notify_transmit_ready (core_handle, 839 GNUNET_CORE_notify_transmit_ready (core_handle,
840 GNUNET_NO, 840 GNUNET_NO,
841 0, 841 GNUNET_CORE_PRIO_CRITICAL_CONTROL,
842 GNUNET_TIME_UNIT_FOREVER_REL, 842 GNUNET_TIME_UNIT_FOREVER_REL,
843 dst_id, 843 dst_id,
844 queue->size, 844 queue->size,
@@ -910,7 +910,8 @@ queue_send (void *cls, size_t size, void *buf)
910 { 910 {
911 peer->core_transmit = 911 peer->core_transmit =
912 GNUNET_CORE_notify_transmit_ready (core_handle, 912 GNUNET_CORE_notify_transmit_ready (core_handle,
913 GNUNET_NO, 0, 913 GNUNET_NO,
914 GNUNET_CORE_PRIO_CRITICAL_CONTROL,
914 GNUNET_TIME_UNIT_FOREVER_REL, 915 GNUNET_TIME_UNIT_FOREVER_REL,
915 dst_id, 916 dst_id,
916 queue->size, 917 queue->size,
@@ -1079,7 +1080,7 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size,
1079 peer->core_transmit = 1080 peer->core_transmit =
1080 GNUNET_CORE_notify_transmit_ready (core_handle, 1081 GNUNET_CORE_notify_transmit_ready (core_handle,
1081 GNUNET_NO, 1082 GNUNET_NO,
1082 0, 1083 GNUNET_CORE_PRIO_CRITICAL_CONTROL,
1083 GNUNET_TIME_UNIT_FOREVER_REL, 1084 GNUNET_TIME_UNIT_FOREVER_REL,
1084 GNUNET_PEER_resolve2 (peer->id), 1085 GNUNET_PEER_resolve2 (peer->id),
1085 size, 1086 size,
@@ -1196,7 +1197,7 @@ GMP_queue_unlock (struct MeshPeer *peer, struct MeshConnection *c)
1196 peer->core_transmit = 1197 peer->core_transmit =
1197 GNUNET_CORE_notify_transmit_ready (core_handle, 1198 GNUNET_CORE_notify_transmit_ready (core_handle,
1198 GNUNET_NO, 1199 GNUNET_NO,
1199 0, 1200 GNUNET_CORE_PRIO_CRITICAL_CONTROL,
1200 GNUNET_TIME_UNIT_FOREVER_REL, 1201 GNUNET_TIME_UNIT_FOREVER_REL,
1201 GNUNET_PEER_resolve2 (peer->id), 1202 GNUNET_PEER_resolve2 (peer->id),
1202 size, 1203 size,
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 3cda2b114..7ad08a917 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -70,7 +70,7 @@
70/** 70/**
71 * Message priority to use. 71 * Message priority to use.
72 */ 72 */
73#define NSE_PRIORITY 5 73#define NSE_PRIORITY GNUNET_CORE_PRIO_CRITICAL_CONTROL
74 74
75#if FREEBSD 75#if FREEBSD
76#define log2(a) (log(a)/log(2)) 76#define log2(a) (log(a)/log(2))
@@ -660,7 +660,8 @@ transmit_task_cb (void *cls,
660 660
661 GNUNET_assert (NULL == peer_entry->th); 661 GNUNET_assert (NULL == peer_entry->th);
662 peer_entry->th = 662 peer_entry->th =
663 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, NSE_PRIORITY, 663 GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO,
664 NSE_PRIORITY,
664 GNUNET_TIME_UNIT_FOREVER_REL, 665 GNUNET_TIME_UNIT_FOREVER_REL,
665 &peer_entry->id, 666 &peer_entry->id,
666 sizeof (struct 667 sizeof (struct
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index e4e9808e4..db9177be8 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -641,7 +641,8 @@ schedule_next_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
641 { 641 {
642 /* now! */ 642 /* now! */
643 pl->hello_req = 643 pl->hello_req =
644 GNUNET_CORE_notify_transmit_ready (handle, GNUNET_YES, 0, 644 GNUNET_CORE_notify_transmit_ready (handle, GNUNET_YES,
645 GNUNET_CORE_PRIO_BEST_EFFORT,
645 GNUNET_CONSTANTS_SERVICE_TIMEOUT, 646 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
646 &pl->pid, next_want, 647 &pl->pid, next_want,
647 &hello_advertising_ready, pl); 648 &hello_advertising_ready, pl);