aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_cp.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-31 21:23:23 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-31 21:23:23 +0000
commita78990b412db2c0ead2da8061c4f454f068991d1 (patch)
tree2e87adae62fd1ca3cd5a9f4c69248986f78bb106 /src/fs/gnunet-service-fs_cp.h
parent406c7d2d2d126c994a1fff13470b1f96439c6f9d (diff)
downloadgnunet-a78990b412db2c0ead2da8061c4f454f068991d1.tar.gz
gnunet-a78990b412db2c0ead2da8061c4f454f068991d1.zip
converting FS to new MQ-based core API
Diffstat (limited to 'src/fs/gnunet-service-fs_cp.h')
-rw-r--r--src/fs/gnunet-service-fs_cp.h94
1 files changed, 33 insertions, 61 deletions
diff --git a/src/fs/gnunet-service-fs_cp.h b/src/fs/gnunet-service-fs_cp.h
index 491ab34e3..3aba5c6a6 100644
--- a/src/fs/gnunet-service-fs_cp.h
+++ b/src/fs/gnunet-service-fs_cp.h
@@ -120,11 +120,16 @@ struct GSF_PeerPerformanceData
120 double avg_priority; 120 double avg_priority;
121 121
122 /** 122 /**
123 * The peer's identity. 123 * The peer's identity (interned version).
124 */ 124 */
125 GNUNET_PEER_Id pid; 125 GNUNET_PEER_Id pid;
126 126
127 /** 127 /**
128 * The peer's identity (pointer).
129 */
130 const struct GNUNET_PeerIdentity *peer;
131
132 /**
128 * Respect rating for this peer 133 * Respect rating for this peer
129 */ 134 */
130 uint32_t respect; 135 uint32_t respect;
@@ -185,17 +190,6 @@ typedef void
185 190
186 191
187/** 192/**
188 * Function called after the creation of a connected peer record is complete.
189 *
190 * @param cls closure
191 * @param cp handle to the newly created connected peer record
192 */
193typedef void
194(*GSF_ConnectedPeerCreationCallback) (void *cls,
195 struct GSF_ConnectedPeer *cp);
196
197
198/**
199 * Handle to cancel a transmission request. 193 * Handle to cancel a transmission request.
200 */ 194 */
201struct GSF_PeerTransmitHandle; 195struct GSF_PeerTransmitHandle;
@@ -205,14 +199,15 @@ struct GSF_PeerTransmitHandle;
205 * A peer connected to us. Setup the connected peer 199 * A peer connected to us. Setup the connected peer
206 * records. 200 * records.
207 * 201 *
202 * @param cls NULL
208 * @param peer identity of peer that connected 203 * @param peer identity of peer that connected
209 * @param creation_cb callback function when the record is created. 204 * @param mq queue for sending messages to @a peer
210 * @param creation_cb_cls closure for @creation_cb 205 * @return internal handle for the peer
211 */ 206 */
212void 207void *
213GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, 208GSF_peer_connect_handler (void *cls,
214 GSF_ConnectedPeerCreationCallback creation_cb, 209 const struct GNUNET_PeerIdentity *peer,
215 void *creation_cb_cls); 210 struct GNUNET_MQ_Handle *mq);
216 211
217 212
218/** 213/**
@@ -242,30 +237,15 @@ GSF_update_peer_latency_ (const struct GNUNET_PeerIdentity *id,
242 * the callback is invoked with a 'NULL' buffer. 237 * the callback is invoked with a 'NULL' buffer.
243 * 238 *
244 * @param cp target peer 239 * @param cp target peer
245 * @param is_query is this a query (GNUNET_YES) or content (GNUNET_NO) 240 * @param is_query is this a query (#GNUNET_YES) or content (#GNUNET_NO)
246 * @param priority how important is this request? 241 * @param priority how important is this request?
247 * @param timeout when does this request timeout (call gmc with error) 242 * @param env envelope of message to send
248 * @param size number of bytes we would like to send to the peer
249 * @param gmc function to call to get the message
250 * @param gmc_cls closure for gmc
251 * @return handle to cancel request
252 */ 243 */
253struct GSF_PeerTransmitHandle * 244void
254GSF_peer_transmit_ (struct GSF_ConnectedPeer *cp, 245GSF_peer_transmit_ (struct GSF_ConnectedPeer *cp,
255 int is_query, 246 int is_query,
256 uint32_t priority, 247 uint32_t priority,
257 struct GNUNET_TIME_Relative timeout, 248 struct GNUNET_MQ_Envelope *env);
258 size_t size, GSF_GetMessageCallback gmc,
259 void *gmc_cls);
260
261
262/**
263 * Cancel an earlier request for transmission.
264 *
265 * @param pth request to cancel
266 */
267void
268GSF_peer_transmit_cancel_ (struct GSF_PeerTransmitHandle *pth);
269 249
270 250
271/** 251/**
@@ -307,35 +287,25 @@ GSF_peer_update_responder_peer_ (struct GSF_ConnectedPeer *cp,
307 287
308 288
309/** 289/**
310 * Handle P2P "MIGRATION_STOP" message. 290 * Handle P2P #GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP message.
311 * 291 *
312 * @param cls closure, always NULL 292 * @param cls closure, the `struct GSF_ConnectedPeer`
313 * @param other the other peer involved (sender or receiver, NULL 293 * @param msm the actual message
314 * for loopback messages where we are both sender and receiver)
315 * @param message the actual message
316 * @return #GNUNET_OK to keep the connection open,
317 * #GNUNET_SYSERR to close it (signal serious error)
318 */ 294 */
319int 295void
320GSF_handle_p2p_migration_stop_ (void *cls, 296handle_p2p_migration_stop (void *cls,
321 const struct GNUNET_PeerIdentity *other, 297 const struct MigrationStopMessage *message);
322 const struct GNUNET_MessageHeader *message);
323 298
324 299
325/** 300/**
326 * Handle P2P "QUERY" message. Only responsible for creating the 301 * Handle P2P "QUERY" message.
327 * request entry itself and setting up reply callback and cancellation
328 * on peer disconnect. Does NOT execute the actual request strategy
329 * (planning) or local database operations.
330 * 302 *
331 * @param other the other peer involved (sender or receiver, NULL 303 * @param cls the `struct GSF_ConnectedPeer` of the other sender
332 * for loopback messages where we are both sender and receiver) 304 * @param gm the actual message
333 * @param message the actual message
334 * @return pending request handle, NULL on error
335 */ 305 */
336struct GSF_PendingRequest * 306void
337GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, 307handle_p2p_get (void *cls,
338 const struct GNUNET_MessageHeader *message); 308 const struct GetMessage *gm);
339 309
340 310
341/** 311/**
@@ -366,10 +336,12 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
366 * 336 *
367 * @param cls unused 337 * @param cls unused
368 * @param peer identity of peer that connected 338 * @param peer identity of peer that connected
339 * @param internal_cls our `struct GSF_ConnectedPeer` for @a peer
369 */ 340 */
370void 341void
371GSF_peer_disconnect_handler_ (void *cls, 342GSF_peer_disconnect_handler (void *cls,
372 const struct GNUNET_PeerIdentity *peer); 343 const struct GNUNET_PeerIdentity *peer,
344 void *internal_cls);
373 345
374 346
375/** 347/**