aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-05-15 13:39:46 +0000
committerChristian Grothoff <christian@grothoff.org>2013-05-15 13:39:46 +0000
commit5cce50f3c8b2d0c54230238de5dd19ab8bd2de3b (patch)
tree060af466361ac4102f2fe24c2d840b1ed6d22ea1
parent80417c48637b498d62f2c6eefb5e1a6fc8d5ed50 (diff)
downloadgnunet-5cce50f3c8b2d0c54230238de5dd19ab8bd2de3b.tar.gz
gnunet-5cce50f3c8b2d0c54230238de5dd19ab8bd2de3b.zip
-comments for Florian
-rw-r--r--src/include/gnunet_set_service.h19
-rw-r--r--src/set/mq.h7
-rw-r--r--src/set/set.h32
-rw-r--r--src/set/test_set.conf4
4 files changed, 40 insertions, 22 deletions
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h
index b76882319..72d7ee521 100644
--- a/src/include/gnunet_set_service.h
+++ b/src/include/gnunet_set_service.h
@@ -86,17 +86,26 @@ enum GNUNET_SET_Status
86 * Everything went ok. 86 * Everything went ok.
87 */ 87 */
88 GNUNET_SET_STATUS_OK, 88 GNUNET_SET_STATUS_OK,
89
89 /** 90 /**
90 * There was a timeout. 91 * There was a timeout.
91 */ 92 */
92 GNUNET_SET_STATUS_TIMEOUT, 93 GNUNET_SET_STATUS_TIMEOUT,
94
93 /** 95 /**
94 * The other peer refused to to the operation with us, 96 * The other peer refused to to the operation with us,
95 * or something went wrong. 97 * or something went wrong.
96 */ 98 */
97 GNUNET_SET_STATUS_FAILURE, 99 GNUNET_SET_STATUS_FAILURE,
100
101 /**
102 * Success, all elements have been returned (but the other
103 * peer might still be receiving some from us, so we are not done).
104 */
105 GNUNET_SET_STATUS_HALF_DONE,
106
98 /** 107 /**
99 * Success, all elements have been sent. 108 * Success, all elements have been sent (and received).
100 */ 109 */
101 GNUNET_SET_STATUS_DONE 110 GNUNET_SET_STATUS_DONE
102}; 111};
@@ -140,7 +149,7 @@ struct GNUNET_SET_Element
140 /** 149 /**
141 * Actual data of the element 150 * Actual data of the element
142 */ 151 */
143 void *data; 152 const void *data;
144}; 153};
145 154
146 155
@@ -161,7 +170,7 @@ typedef void (*GNUNET_SET_Continuation) (void *cls);
161 * @param status see enum GNUNET_SET_Status 170 * @param status see enum GNUNET_SET_Status
162 */ 171 */
163typedef void (*GNUNET_SET_ResultIterator) (void *cls, 172typedef void (*GNUNET_SET_ResultIterator) (void *cls,
164 struct GNUNET_SET_Element *element, 173 const struct GNUNET_SET_Element *element,
165 enum GNUNET_SET_Status status); 174 enum GNUNET_SET_Status status);
166 175
167 176
@@ -258,7 +267,7 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set);
258 * fail due to hash collisions, using a different salt for each operation 267 * fail due to hash collisions, using a different salt for each operation
259 * makes it harder for an attacker to exploit this 268 * makes it harder for an attacker to exploit this
260 * @param timeout result_cb will be called with GNUNET_SET_STATUS_TIMEOUT 269 * @param timeout result_cb will be called with GNUNET_SET_STATUS_TIMEOUT
261 * if the operation is not done after the specified time 270 * if the operation is not done after the specified time; @deprecated
262 * @param result_mode specified how results will be returned, 271 * @param result_mode specified how results will be returned,
263 * see 'GNUNET_SET_ResultMode'. 272 * see 'GNUNET_SET_ResultMode'.
264 * @param result_cb called on error or success 273 * @param result_cb called on error or success
@@ -313,7 +322,7 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh);
313 * 322 *
314 * @param request request to accept 323 * @param request request to accept
315 * @param set set used for the requested operation 324 * @param set set used for the requested operation
316 * @param timeout timeout for the set operation 325 * @param timeout timeout for the set operation, @deprecated
317 * @param result_mode specified how results will be returned, 326 * @param result_mode specified how results will be returned,
318 * see 'GNUNET_SET_ResultMode'. 327 * see 'GNUNET_SET_ResultMode'.
319 * @param result_cb callback for the results 328 * @param result_cb callback for the results
diff --git a/src/set/mq.h b/src/set/mq.h
index 42b755163..b7a89f6e0 100644
--- a/src/set/mq.h
+++ b/src/set/mq.h
@@ -276,7 +276,6 @@ struct GNUNET_MQ_MessageQueue *
276GNUNET_MQ_queue_for_server_client (struct GNUNET_SERVER_Client *client); 276GNUNET_MQ_queue_for_server_client (struct GNUNET_SERVER_Client *client);
277 277
278 278
279
280/** 279/**
281 * Create a message queue for a GNUNET_STREAM_Socket. 280 * Create a message queue for a GNUNET_STREAM_Socket.
282 * If handlers are specfied, receive messages from the stream socket. 281 * If handlers are specfied, receive messages from the stream socket.
@@ -285,12 +284,14 @@ GNUNET_MQ_queue_for_server_client (struct GNUNET_SERVER_Client *client);
285 * @param handlers handlers for receiving messages 284 * @param handlers handlers for receiving messages
286 * @param cls closure for the handlers 285 * @param cls closure for the handlers
287 * @return the message queue 286 * @return the message queue
287 * @deprecated - GNUNET_MQ_queue_create_with_callbacks
288 */ 288 */
289struct GNUNET_MQ_MessageQueue * 289struct GNUNET_MQ_MessageQueue *
290GNUNET_MQ_queue_for_stream_socket (struct GNUNET_STREAM_Socket *socket, 290GNUNET_MQ_queue_for_stream_socket (struct GNUNET_STREAM_Socket *socket,
291 const struct GNUNET_MQ_Handler *handlers, 291 const struct GNUNET_MQ_Handler *handlers,
292 void *cls); 292 void *cls);
293 293
294
294/** 295/**
295 * Replace the handlers of a message queue with new handlers. 296 * Replace the handlers of a message queue with new handlers.
296 * Takes effect immediately, even for messages that already have been received, but for 297 * Takes effect immediately, even for messages that already have been received, but for
@@ -306,7 +307,6 @@ GNUNET_MQ_replace_handlers (struct GNUNET_MQ_MessageQueue *mq,
306 void *cls); 307 void *cls);
307 308
308 309
309
310/** 310/**
311 * Call a callback once the message has been sent, that is, the message 311 * Call a callback once the message has been sent, that is, the message
312 * can not be canceled anymore. 312 * can not be canceled anymore.
@@ -321,6 +321,7 @@ GNUNET_MQ_notify_sent (struct GNUNET_MQ_Message *mqm,
321 GNUNET_MQ_NotifyCallback cb, 321 GNUNET_MQ_NotifyCallback cb,
322 void *cls); 322 void *cls);
323 323
324
324/** 325/**
325 * Call a callback once all messages queued have been sent, 326 * Call a callback once all messages queued have been sent,
326 * i.e. the message queue is empty. 327 * i.e. the message queue is empty.
@@ -328,6 +329,7 @@ GNUNET_MQ_notify_sent (struct GNUNET_MQ_Message *mqm,
328 * @param mqm the message queue to send the notification for 329 * @param mqm the message queue to send the notification for
329 * @param cb the callback to call on an empty queue 330 * @param cb the callback to call on an empty queue
330 * @param cls closure for cb 331 * @param cls closure for cb
332 * @deprecated
331 */ 333 */
332void 334void
333GNUNET_MQ_notify_empty (struct GNUNET_MQ_MessageQueue *mqm, 335GNUNET_MQ_notify_empty (struct GNUNET_MQ_MessageQueue *mqm,
@@ -341,6 +343,7 @@ GNUNET_MQ_notify_empty (struct GNUNET_MQ_MessageQueue *mqm,
341 * @param mqm the message queue to send the notification for 343 * @param mqm the message queue to send the notification for
342 * @param cb the callback to call on a read error 344 * @param cb the callback to call on a read error
343 * @param cls closure for cb 345 * @param cls closure for cb
346 * @deprecated, integrate with queue creation
344 */ 347 */
345void 348void
346GNUNET_MQ_notify_read_error (struct GNUNET_MQ_MessageQueue *mqm, 349GNUNET_MQ_notify_read_error (struct GNUNET_MQ_MessageQueue *mqm,
diff --git a/src/set/set.h b/src/set/set.h
index 33e0aafdd..ad2200de9 100644
--- a/src/set/set.h
+++ b/src/set/set.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2012 Christian Grothoff (and other contributing authors) 3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -49,6 +49,7 @@ struct SetCreateMessage
49 /** 49 /**
50 * Operation type, values of enum GNUNET_SET_OperationType 50 * Operation type, values of enum GNUNET_SET_OperationType
51 */ 51 */
52 // FIXME: use 32_t for 'enum'.
52 uint16_t operation GNUNET_PACKED; 53 uint16_t operation GNUNET_PACKED;
53}; 54};
54 55
@@ -61,14 +62,15 @@ struct ListenMessage
61 struct GNUNET_MessageHeader header; 62 struct GNUNET_MessageHeader header;
62 63
63 /** 64 /**
64 * application id 65 * Operation type, values of enum GNUNET_SET_OperationType
65 */ 66 */
66 struct GNUNET_HashCode app_id; 67 uint16_t operation GNUNET_PACKED;
67 68
68 /** 69 /**
69 * Operation type, values of enum GNUNET_SET_OperationType 70 * application id
70 */ 71 */
71 uint16_t operation GNUNET_PACKED; 72 struct GNUNET_HashCode app_id;
73
72}; 74};
73 75
74 76
@@ -105,16 +107,16 @@ struct RequestMessage
105 struct GNUNET_MessageHeader header; 107 struct GNUNET_MessageHeader header;
106 108
107 /** 109 /**
108 * Identity of the requesting peer.
109 */
110 struct GNUNET_PeerIdentity peer_id;
111
112 /**
113 * ID of the request we want to accept, 110 * ID of the request we want to accept,
114 * chosen by the service. 111 * chosen by the service.
115 */ 112 */
116 uint32_t accept_id GNUNET_PACKED; 113 uint32_t accept_id GNUNET_PACKED;
117 114
115 /**
116 * Identity of the requesting peer.
117 */
118 struct GNUNET_PeerIdentity peer_id;
119
118 /* rest: nested context message */ 120 /* rest: nested context message */
119}; 121};
120 122
@@ -127,6 +129,11 @@ struct EvaluateMessage
127 struct GNUNET_MessageHeader header; 129 struct GNUNET_MessageHeader header;
128 130
129 /** 131 /**
132 * id of our evaluate, chosen by the client
133 */
134 uint32_t request_id GNUNET_PACKED;
135
136 /**
130 * Peer to evaluate the operation with 137 * Peer to evaluate the operation with
131 */ 138 */
132 struct GNUNET_PeerIdentity peer; 139 struct GNUNET_PeerIdentity peer;
@@ -137,11 +144,6 @@ struct EvaluateMessage
137 struct GNUNET_HashCode app_id; 144 struct GNUNET_HashCode app_id;
138 145
139 /** 146 /**
140 * id of our evaluate, chosen by the client
141 */
142 uint32_t request_id GNUNET_PACKED;
143
144 /**
145 * Salt to use for the operation 147 * Salt to use for the operation
146 */ 148 */
147 uint16_t salt GNUNET_PACKED; 149 uint16_t salt GNUNET_PACKED;
diff --git a/src/set/test_set.conf b/src/set/test_set.conf
index c1d5a0f93..34b7a8d2f 100644
--- a/src/set/test_set.conf
+++ b/src/set/test_set.conf
@@ -1,3 +1,7 @@
1# @INLINE@ test_set_defaults.conf
2[PATHS]
3SERVICEHOME = /tmp/test-gnunet-set/
4
1[set] 5[set]
2AUTOSTART = YES 6AUTOSTART = YES
3PORT = 2106 7PORT = 2106