diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-09 14:53:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-09 14:53:44 +0000 |
commit | 7ae3bcd234e062c28f66db9758f61af401d0a707 (patch) | |
tree | adb1da7611b0afd6ff0fa094a6f6bc7ebabd174e /src/include/gnunet_core_service.h | |
parent | 006eb1c4f3307fe89c786c2f1ac866611e33d3cd (diff) | |
download | gnunet-7ae3bcd234e062c28f66db9758f61af401d0a707.tar.gz gnunet-7ae3bcd234e062c28f66db9758f61af401d0a707.zip |
-simplifying core API (#2400)
Diffstat (limited to 'src/include/gnunet_core_service.h')
-rw-r--r-- | src/include/gnunet_core_service.h | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index cb48f4182..c648c3ce0 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -42,7 +42,7 @@ extern "C" | |||
42 | /** | 42 | /** |
43 | * Version number of GNUnet-core API. | 43 | * Version number of GNUnet-core API. |
44 | */ | 44 | */ |
45 | #define GNUNET_CORE_VERSION 0x00000000 | 45 | #define GNUNET_CORE_VERSION 0x00000001 |
46 | 46 | ||
47 | 47 | ||
48 | /** | 48 | /** |
@@ -148,14 +148,13 @@ typedef void (*GNUNET_CORE_StartupCallback) (void *cls, | |||
148 | * (or fail) asynchronously. This function primarily causes the given | 148 | * (or fail) asynchronously. This function primarily causes the given |
149 | * callback notification functions to be invoked whenever the | 149 | * callback notification functions to be invoked whenever the |
150 | * specified event happens. The maximum number of queued | 150 | * specified event happens. The maximum number of queued |
151 | * notifications (queue length) is per client but the queue is shared | 151 | * notifications (queue length) is per client; the queue is shared |
152 | * across all types of notifications. So a slow client that registers | 152 | * across all types of notifications. So a slow client that registers |
153 | * for 'outbound_notify' also risks missing 'inbound_notify' messages. | 153 | * for 'outbound_notify' also risks missing 'inbound_notify' messages. |
154 | * Certain events (such as connect/disconnect notifications) are not | 154 | * Certain events (such as connect/disconnect notifications) are not |
155 | * subject to queue size limitations. | 155 | * subject to queue size limitations. |
156 | * | 156 | * |
157 | * @param cfg configuration to use | 157 | * @param cfg configuration to use |
158 | * @param queue_size size of the per-peer message queue | ||
159 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) | 158 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) |
160 | * @param init callback to call once we have successfully | 159 | * @param init callback to call once we have successfully |
161 | * connected to the core service | 160 | * connected to the core service |
@@ -190,7 +189,7 @@ typedef void (*GNUNET_CORE_StartupCallback) (void *cls, | |||
190 | */ | 189 | */ |
191 | struct GNUNET_CORE_Handle * | 190 | struct GNUNET_CORE_Handle * |
192 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 191 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
193 | unsigned int queue_size, void *cls, | 192 | void *cls, |
194 | GNUNET_CORE_StartupCallback init, | 193 | GNUNET_CORE_StartupCallback init, |
195 | GNUNET_CORE_ConnectEventHandler connects, | 194 | GNUNET_CORE_ConnectEventHandler connects, |
196 | GNUNET_CORE_DisconnectEventHandler disconnects, | 195 | GNUNET_CORE_DisconnectEventHandler disconnects, |
@@ -220,10 +219,13 @@ struct GNUNET_CORE_TransmitHandle; | |||
220 | 219 | ||
221 | /** | 220 | /** |
222 | * Ask the core to call "notify" once it is ready to transmit the | 221 | * Ask the core to call "notify" once it is ready to transmit the |
223 | * given number of bytes to the specified "target". Must only be | 222 | * given number of bytes to the specified "target". Must only be |
224 | * called after a connection to the respective peer has been | 223 | * called after a connection to the respective peer has been |
225 | * established (and the client has been informed about this). | 224 | * established (and the client has been informed about this). You may |
226 | * | 225 | * have one request of this type pending for each connected peer at |
226 | * any time. If a peer disconnects, the application MUST call | ||
227 | * "GNUNET_CORE_notify_transmit_ready_cancel" on the respective | ||
228 | * transmission request, if one such request is pending. | ||
227 | * | 229 | * |
228 | * @param handle connection to core service | 230 | * @param handle connection to core service |
229 | * @param cork is corking allowed for this transmission? | 231 | * @param cork is corking allowed for this transmission? |
@@ -232,18 +234,13 @@ struct GNUNET_CORE_TransmitHandle; | |||
232 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) | 234 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) |
233 | * @param notify_size how many bytes of buffer space does notify want? | 235 | * @param notify_size how many bytes of buffer space does notify want? |
234 | * @param notify function to call when buffer space is available; | 236 | * @param notify function to call when buffer space is available; |
235 | * will be called with NULL on timeout or if the overall queue | 237 | * will be called with NULL on timeout; clients MUST cancel |
236 | * for this peer is larger than queue_size and this is currently | ||
237 | * the message with the lowest priority; will also be called | ||
238 | * with 'NULL' buf if the peer disconnects; since the disconnect | ||
239 | * signal will be emmitted even later, clients MUST cancel | ||
240 | * all pending transmission requests DURING the disconnect | 238 | * all pending transmission requests DURING the disconnect |
241 | * handler (unless they ensure that 'notify' never calls | 239 | * handler |
242 | * 'GNUNET_CORE_notify_transmit_ready'). | ||
243 | * @param notify_cls closure for notify | 240 | * @param notify_cls closure for notify |
244 | * @return non-NULL if the notify callback was queued, | 241 | * @return non-NULL if the notify callback was queued, |
245 | * NULL if we can not even queue the request (insufficient | 242 | * NULL if we can not even queue the request (request already pending); |
246 | * memory); if NULL is returned, "notify" will NOT be called. | 243 | * if NULL is returned, "notify" will NOT be called. |
247 | */ | 244 | */ |
248 | struct GNUNET_CORE_TransmitHandle * | 245 | struct GNUNET_CORE_TransmitHandle * |
249 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, | 246 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, |