diff options
author | Gabor X Toth <*@tg-x.net> | 2013-06-26 17:12:59 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-06-26 17:12:59 +0000 |
commit | 2fc296b9df9bb7559f044a1769da8d2e43771b39 (patch) | |
tree | 6adb5c64011a15ca08e22eec3f5afc1ea6faad2c /src/include/gnunet_psycstore_service.h | |
parent | d74bfc8a7987f457a1f4380108fd3296581bf52e (diff) | |
download | gnunet-2fc296b9df9bb7559f044a1769da8d2e43771b39.tar.gz gnunet-2fc296b9df9bb7559f044a1769da8d2e43771b39.zip |
psyc apis: use more doxygen syntax, added some missing docs
Diffstat (limited to 'src/include/gnunet_psycstore_service.h')
-rw-r--r-- | src/include/gnunet_psycstore_service.h | 134 |
1 files changed, 112 insertions, 22 deletions
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h index 701f6940f..30671cda2 100644 --- a/src/include/gnunet_psycstore_service.h +++ b/src/include/gnunet_psycstore_service.h | |||
@@ -18,10 +18,10 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_psycstore_service.h | 22 | * @file include/gnunet_psycstore_service.h |
23 | * @brief PSYCstore service; implements persistent storage for the PSYC service | 23 | * @brief PSYCstore service; implements persistent storage for the PSYC service |
24 | * @author tg | 24 | * @author tg(x) |
25 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
26 | */ | 26 | */ |
27 | #ifndef GNUNET_PSYCSTORE_SERVICE_H | 27 | #ifndef GNUNET_PSYCSTORE_SERVICE_H |
@@ -37,18 +37,18 @@ extern "C" | |||
37 | 37 | ||
38 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Version number of GNUnet PSYCstore API. | 41 | * Version number of GNUnet PSYCstore API. |
42 | */ | 42 | */ |
43 | #define GNUNET_PSYCSTORE_VERSION 0x00000000 | 43 | #define GNUNET_PSYCSTORE_VERSION 0x00000000 |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Handle for a PSYCstore | 46 | * Handle for a PSYCstore |
47 | */ | 47 | */ |
48 | struct GNUNET_PSYCSTORE_Handle; | 48 | struct GNUNET_PSYCSTORE_Handle; |
49 | 49 | ||
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Connect to the PSYCstore service. | 52 | * Connect to the PSYCstore service. |
53 | * | 53 | * |
54 | * @param cfg Configuration to use. | 54 | * @param cfg Configuration to use. |
@@ -59,7 +59,7 @@ struct GNUNET_PSYCSTORE_Handle * | |||
59 | GNUNET_PSYCSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | 59 | GNUNET_PSYCSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); |
60 | 60 | ||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Disconnect from the PSYCstore service. | 63 | * Disconnect from the PSYCstore service. |
64 | * | 64 | * |
65 | * @param h Handle for the connection. | 65 | * @param h Handle for the connection. |
@@ -68,22 +68,23 @@ void | |||
68 | GNUNET_PSYCSTORE_disconnect (struct GNUNET_PSYCSTORE_Handle *h); | 68 | GNUNET_PSYCSTORE_disconnect (struct GNUNET_PSYCSTORE_Handle *h); |
69 | 69 | ||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Handle for an operation on the PSYCSTORE (useful to cancel the operation). | 72 | * Handle for an operation on the PSYCSTORE (useful to cancel the operation). |
73 | */ | 73 | */ |
74 | struct GNUNET_PSYCSTORE_OperationHandle; | 74 | struct GNUNET_PSYCSTORE_OperationHandle; |
75 | 75 | ||
76 | 76 | ||
77 | /** | 77 | /** |
78 | * | 78 | * Function called with the result of an asynchronous operation. |
79 | * @param result GNUNET_SYSERR on error, | 79 | ; * |
80 | * GNUNET_YES on success or if the peer was a member, | 80 | * @param result #GNUNET_SYSERR on error, |
81 | * GNUNET_NO if the peer was not a member | 81 | * #GNUNET_YES on success or if the peer was a member, |
82 | * #GNUNET_NO if the peer was not a member | ||
82 | */ | 83 | */ |
83 | typedef void (*GNUNET_PSYCSTORE_ContinuationCallback)(void *cls, | 84 | typedef void (*GNUNET_PSYCSTORE_ContinuationCallback)(void *cls, |
84 | int result); | 85 | int result); |
85 | 86 | ||
86 | /** | 87 | /** |
87 | * Store join/leave events for a PSYC channel in order to be able to answer | 88 | * Store join/leave events for a PSYC channel in order to be able to answer |
88 | * membership test queries later. | 89 | * membership test queries later. |
89 | * | 90 | * |
@@ -91,7 +92,7 @@ typedef void (*GNUNET_PSYCSTORE_ContinuationCallback)(void *cls, | |||
91 | * @param channel_id ID of the channel where the event happened. | 92 | * @param channel_id ID of the channel where the event happened. |
92 | * @param message_id ID of the message in which this event was announced. | 93 | * @param message_id ID of the message in which this event was announced. |
93 | * @param peer Identity of joining/leaving peer. | 94 | * @param peer Identity of joining/leaving peer. |
94 | * @param did_join GNUNET_YES on join, GNUNET_NO on leave. | 95 | * @param did_join #GNUNET_YES on join, #GNUNET_NO on leave. |
95 | * @param ccb Callback to call with the result of the storage operation. | 96 | * @param ccb Callback to call with the result of the storage operation. |
96 | * @param ccb_cls Closure for the callback. | 97 | * @param ccb_cls Closure for the callback. |
97 | * | 98 | * |
@@ -107,11 +108,12 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
107 | void *ccb_cls); | 108 | void *ccb_cls); |
108 | 109 | ||
109 | 110 | ||
110 | /** | 111 | /** |
111 | * Test if a peer was a member of the channel when the message with the | 112 | * Test if a peer was a member of the channel when the message with the |
112 | * specified ID was sent to the channel. This is useful in case of | 113 | * specified ID was sent to the channel. |
113 | * retransmissions to check if the peer was authorized to see the requested | 114 | * |
114 | * message. | 115 | * This is useful in case of retransmissions to check if the peer was authorized |
116 | * to see the requested message. | ||
115 | * | 117 | * |
116 | * @param h Handle for the PSYCstore. | 118 | * @param h Handle for the PSYCstore. |
117 | * @param channel_id The channel we are interested in. | 119 | * @param channel_id The channel we are interested in. |
@@ -121,7 +123,8 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
121 | * @param ccb_cls Closure for the callback. | 123 | * @param ccb_cls Closure for the callback. |
122 | * | 124 | * |
123 | * @return Operation handle that can be used to cancel the operation. | 125 | * @return Operation handle that can be used to cancel the operation. |
124 | */struct GNUNET_PSYCSTORE_OperationHandle * | 126 | */ |
127 | struct GNUNET_PSYCSTORE_OperationHandle * | ||
125 | GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, | 128 | GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, |
126 | const struct GNUNET_HashCode *channel_id, | 129 | const struct GNUNET_HashCode *channel_id, |
127 | uint64_t message_id, | 130 | uint64_t message_id, |
@@ -130,6 +133,17 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, | |||
130 | void *ccb_cls); | 133 | void *ccb_cls); |
131 | 134 | ||
132 | 135 | ||
136 | /** | ||
137 | * Store a message sent to a channel. | ||
138 | * | ||
139 | * @param h Handle for the PSYCstore. | ||
140 | * @param channel_id The channel the message belongs to. | ||
141 | * @param message_id Message ID to store. | ||
142 | * @param ccb Callback to call with the result of the operation. | ||
143 | * @param ccb_cls Closure for the callback. | ||
144 | * | ||
145 | * @return Handle that can be used to cancel the operation. | ||
146 | */ | ||
133 | struct GNUNET_PSYCSTORE_OperationHandle * | 147 | struct GNUNET_PSYCSTORE_OperationHandle * |
134 | GNUNET_PSYCSTORE_message_store (struct GNUNET_PSYCSTORE_Handle *h, | 148 | GNUNET_PSYCSTORE_message_store (struct GNUNET_PSYCSTORE_Handle *h, |
135 | const struct GNUNET_HashCode *channel_id, | 149 | const struct GNUNET_HashCode *channel_id, |
@@ -138,11 +152,29 @@ GNUNET_PSYCSTORE_message_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
138 | void *ccb_cls); | 152 | void *ccb_cls); |
139 | 153 | ||
140 | 154 | ||
155 | /** | ||
156 | * Function called with the result of a GNUNET_PSYCSTORE_message_get() call. | ||
157 | * | ||
158 | * @param cls Closure. | ||
159 | * @param message_id ID of the message. | ||
160 | * @param message The retrieved message. | ||
161 | */ | ||
141 | typedef void (*GNUNET_PSYCSTORE_MessageResultCallback)(void *cls, | 162 | typedef void (*GNUNET_PSYCSTORE_MessageResultCallback)(void *cls, |
142 | uint64_t message_id, | 163 | uint64_t message_id, |
143 | const struct GNUNET_MULTICAST_MessageHeader *message); | 164 | const struct GNUNET_MULTICAST_MessageHeader *message); |
144 | 165 | ||
145 | 166 | ||
167 | /** | ||
168 | * Retrieve a message by ID. | ||
169 | * | ||
170 | * @param h Handle for the PSYCstore. | ||
171 | * @param channel_id The channel we are interested in. | ||
172 | * @param message_id Message ID to check. | ||
173 | * @param rcb Callback to call with the result of the operation. | ||
174 | * @param rcb_cls Closure for the callback. | ||
175 | * | ||
176 | * @return Handle that can be used to cancel the operation. | ||
177 | */ | ||
146 | struct GNUNET_PSYCSTORE_OperationHandle * | 178 | struct GNUNET_PSYCSTORE_OperationHandle * |
147 | GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | 179 | GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, |
148 | const struct GNUNET_HashCode *channel_id, | 180 | const struct GNUNET_HashCode *channel_id, |
@@ -151,6 +183,16 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
151 | void *rcb_cls); | 183 | void *rcb_cls); |
152 | 184 | ||
153 | 185 | ||
186 | /** | ||
187 | * Get latest message sent to a channel. | ||
188 | * | ||
189 | * @param h Handle for the PSYCstore. | ||
190 | * @param channel_id The channel we are interested in. | ||
191 | * @param rcb Callback to call with the result of the operation. | ||
192 | * @param rcb_cls Closure for the callback. | ||
193 | * | ||
194 | * @return Handle that can be used to cancel the operation. | ||
195 | */ | ||
154 | struct GNUNET_PSYCSTORE_OperationHandle * | 196 | struct GNUNET_PSYCSTORE_OperationHandle * |
155 | GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | 197 | GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, |
156 | const struct GNUNET_HashCode *channel_id, | 198 | const struct GNUNET_HashCode *channel_id, |
@@ -158,30 +200,73 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | |||
158 | void *rcb_cls); | 200 | void *rcb_cls); |
159 | 201 | ||
160 | 202 | ||
203 | /** | ||
204 | * Store a state variable. | ||
205 | * | ||
206 | * @param h Handle for the PSYCstore. | ||
207 | * @param channel_id The channel we are interested in. | ||
208 | * @param name Name of variable. | ||
209 | * @param size Size of @a value. | ||
210 | * @param value Value of variable. | ||
211 | * @param ccb Callback to call with the result of the operation. | ||
212 | * @param ccb_cls Closure for the callback. | ||
213 | * | ||
214 | * @return Handle that can be used to cancel the operation. | ||
215 | */ | ||
161 | struct GNUNET_PSYCSTORE_OperationHandle * | 216 | struct GNUNET_PSYCSTORE_OperationHandle * |
162 | GNUNET_PSYCSTORE_state_set (struct GNUNET_PSYCSTORE_Handle *h, | 217 | GNUNET_PSYCSTORE_state_set (struct GNUNET_PSYCSTORE_Handle *h, |
163 | const struct GNUNET_HashCode *channel_id, | 218 | const struct GNUNET_HashCode *channel_id, |
164 | const char *state_name, | 219 | const char *name, |
165 | size_t size, | 220 | size_t size, |
166 | const void *value, | 221 | const void *value, |
167 | GNUNET_PSYCSTORE_ContinuationCallback ccb, | 222 | GNUNET_PSYCSTORE_ContinuationCallback ccb, |
168 | void *ccb_cls); | 223 | void *ccb_cls); |
169 | 224 | ||
170 | 225 | ||
226 | /** | ||
227 | * Function called with the value of a state variable. | ||
228 | * | ||
229 | * @param cls Closure. | ||
230 | * @param name Name of variable. | ||
231 | * @param size Size of @a value. | ||
232 | * @param value Value of variable. | ||
233 | t * | ||
234 | */ | ||
171 | typedef void (*GNUNET_PSYCSTORE_StateResultCallback)(void *cls, | 235 | typedef void (*GNUNET_PSYCSTORE_StateResultCallback)(void *cls, |
172 | const char *state_name, | 236 | const char *name, |
173 | size_t size, | 237 | size_t size, |
174 | const void *value); | 238 | const void *value); |
175 | 239 | ||
176 | 240 | ||
241 | /** | ||
242 | * Retrieve the given state variable for a channel. | ||
243 | * | ||
244 | * @param h Handle for the PSYCstore. | ||
245 | * @param channel_id The channel we are interested in. | ||
246 | * @param name Name of variable to get. | ||
247 | * @param rcb Callback to call with the result. | ||
248 | * @param rcb_cls Closure for the callback. | ||
249 | * | ||
250 | * @return Handle that can be used to cancel the operation. | ||
251 | */ | ||
177 | struct GNUNET_PSYCSTORE_OperationHandle * | 252 | struct GNUNET_PSYCSTORE_OperationHandle * |
178 | GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, | 253 | GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, |
179 | const struct GNUNET_HashCode *channel_id, | 254 | const struct GNUNET_HashCode *channel_id, |
180 | const char *state_name, | 255 | const char *name, |
181 | GNUNET_PSYCSTORE_StateResultCallback rcb, | 256 | GNUNET_PSYCSTORE_StateResultCallback rcb, |
182 | void *rcb_cls); | 257 | void *rcb_cls); |
183 | 258 | ||
184 | 259 | ||
260 | /** | ||
261 | * Retrieve all state variables for a channel. | ||
262 | * | ||
263 | * @param h Handle for the PSYCstore. | ||
264 | * @param channel_id The channel we are interested in. | ||
265 | * @param rcb Callback to call with the result. | ||
266 | * @param rcb_cls Closure for the callback. | ||
267 | * | ||
268 | * @return Handle that can be used to cancel the operation. | ||
269 | */ | ||
185 | struct GNUNET_PSYCSTORE_OperationHandle * | 270 | struct GNUNET_PSYCSTORE_OperationHandle * |
186 | GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, | 271 | GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, |
187 | const struct GNUNET_HashCode *channel_id, | 272 | const struct GNUNET_HashCode *channel_id, |
@@ -189,6 +274,11 @@ GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, | |||
189 | void *rcb_cls); | 274 | void *rcb_cls); |
190 | 275 | ||
191 | 276 | ||
277 | /** | ||
278 | * Cancel an operation. | ||
279 | * | ||
280 | * @param oh Handle for the operation to cancel. | ||
281 | */ | ||
192 | void | 282 | void |
193 | GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *oh); | 283 | GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *oh); |
194 | 284 | ||