diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-29 20:31:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-29 20:31:52 +0000 |
commit | 1e2d3aaecc2a4130e35d46a7c03b9d80d34d6673 (patch) | |
tree | 2a1f83390b22383ced0e61d8c847886f3c163601 /src/include/gnunet_core_service.h | |
parent | c23a4218f8a59ad08c82d485db37a897cac4b358 (diff) | |
download | gnunet-1e2d3aaecc2a4130e35d46a7c03b9d80d34d6673.tar.gz gnunet-1e2d3aaecc2a4130e35d46a7c03b9d80d34d6673.zip |
starting point for MQ-core API
Diffstat (limited to 'src/include/gnunet_core_service.h')
-rw-r--r-- | src/include/gnunet_core_service.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index e8709d0f1..16b6aebc9 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -108,6 +108,30 @@ typedef void | |||
108 | 108 | ||
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Method called whenever a given peer connects. | ||
112 | * | ||
113 | * @param cls closure | ||
114 | * @param peer peer identity this notification is about | ||
115 | */ | ||
116 | typedef void * | ||
117 | (*GNUNET_CORE_ConnecTEventHandler) (void *cls, | ||
118 | const struct GNUNET_PeerIdentity *peer, | ||
119 | struct GNUNET_MQ_Handle *mq); | ||
120 | |||
121 | |||
122 | /** | ||
123 | * Method called whenever a peer disconnects. | ||
124 | * | ||
125 | * @param cls closure | ||
126 | * @param peer peer identity this notification is about | ||
127 | */ | ||
128 | typedef void | ||
129 | (*GNUNET_CORE_DisconnecTEventHandler) (void *cls, | ||
130 | const struct GNUNET_PeerIdentity *peer, | ||
131 | void *peer_cls); | ||
132 | |||
133 | |||
134 | /** | ||
111 | * Functions with this signature are called whenever a message is | 135 | * Functions with this signature are called whenever a message is |
112 | * received or transmitted. | 136 | * received or transmitted. |
113 | * | 137 | * |
@@ -225,6 +249,39 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
225 | 249 | ||
226 | 250 | ||
227 | /** | 251 | /** |
252 | * Connect to the core service. Note that the connection may complete | ||
253 | * (or fail) asynchronously. This function primarily causes the given | ||
254 | * callback notification functions to be invoked whenever the | ||
255 | * specified event happens. The maximum number of queued | ||
256 | * notifications (queue length) is per client; the queue is shared | ||
257 | * across all types of notifications. So a slow client that registers | ||
258 | * for @a outbound_notify also risks missing @a inbound_notify messages. | ||
259 | * Certain events (such as connect/disconnect notifications) are not | ||
260 | * subject to queue size limitations. | ||
261 | * | ||
262 | * @param cfg configuration to use | ||
263 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) | ||
264 | * @param init callback to call once we have successfully | ||
265 | * connected to the core service | ||
266 | * @param connects function to call on peer connect, can be NULL | ||
267 | * @param disconnects function to call on peer disconnect / timeout, can be NULL | ||
268 | * @param handlers callbacks for messages we care about, NULL-terminated | ||
269 | * note that the core is allowed to drop notifications about inbound | ||
270 | * messages if the client does not process them fast enough (for this | ||
271 | * notification type, a bounded queue is used) | ||
272 | * @return handle to the core service (only useful for disconnect until @a init is called), | ||
273 | * NULL on error (in this case, init is never called) | ||
274 | */ | ||
275 | struct GNUNET_CORE_Handle * | ||
276 | GNUNET_CORE_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
277 | void *cls, | ||
278 | GNUNET_CORE_StartupCallback init, | ||
279 | GNUNET_CORE_ConnecTEventHandler connects, | ||
280 | GNUNET_CORE_DisconnecTEventHandler disconnects, | ||
281 | const struct GNUNET_MQ_MessageHandler *handlers); | ||
282 | |||
283 | |||
284 | /** | ||
228 | * Disconnect from the core service. This function can only | 285 | * Disconnect from the core service. This function can only |
229 | * be called *after* all pending #GNUNET_CORE_notify_transmit_ready | 286 | * be called *after* all pending #GNUNET_CORE_notify_transmit_ready |
230 | * requests have been explicitly cancelled. | 287 | * requests have been explicitly cancelled. |