diff options
author | t3sserakt <t3ss@posteo.de> | 2023-08-03 10:57:39 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2023-08-03 10:57:39 +0200 |
commit | 55a25efeae2ddfc12e507bc97c57d21f40bf4da4 (patch) | |
tree | 7e5d15322d241c0ab02eb31cb6f74814e8afc047 /src/include | |
parent | 0f8b71280614e9a69d7703d88cc35108e6cec052 (diff) | |
download | gnunet-55a25efeae2ddfc12e507bc97c57d21f40bf4da4.tar.gz gnunet-55a25efeae2ddfc12e507bc97c57d21f40bf4da4.zip |
NEWS: Added api to get notified when hellos are stored with peerstore service.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_peerstore_service.h | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h index 37d3ca7fe..6196d8202 100644 --- a/src/include/gnunet_peerstore_service.h +++ b/src/include/gnunet_peerstore_service.h | |||
@@ -122,6 +122,11 @@ struct GNUNET_PEERSTORE_Handle; | |||
122 | struct GNUNET_PEERSTORE_StoreContext; | 122 | struct GNUNET_PEERSTORE_StoreContext; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Context for the info handler. | ||
126 | */ | ||
127 | struct GNUNET_PEERSTORE_NotifyContext; | ||
128 | |||
129 | /** | ||
125 | * Single PEERSTORE record | 130 | * Single PEERSTORE record |
126 | */ | 131 | */ |
127 | struct GNUNET_PEERSTORE_Record | 132 | struct GNUNET_PEERSTORE_Record |
@@ -185,6 +190,48 @@ typedef void (*GNUNET_PEERSTORE_Processor) ( | |||
185 | const struct GNUNET_PEERSTORE_Record *record, | 190 | const struct GNUNET_PEERSTORE_Record *record, |
186 | const char *emsg); | 191 | const char *emsg); |
187 | 192 | ||
193 | /** | ||
194 | * Function called by PEERSTORE when notifying a client about a changed hello. | ||
195 | * | ||
196 | * @param cls closure | ||
197 | * @param hello_uri Hello uri. | ||
198 | */ | ||
199 | typedef void (*GNUNET_PEERSTORE_hello_notify_cb) ( | ||
200 | void *cls, | ||
201 | const struct GNUNET_PeerIdentity *peer, | ||
202 | const struct GNUNET_MessageHeader *hello, | ||
203 | const char *err_msg); | ||
204 | |||
205 | /** | ||
206 | * Call a method whenever our known information about peers | ||
207 | * changes. Initially calls the given function for all known | ||
208 | * peers and then only signals changes. | ||
209 | * | ||
210 | * If @a include_friend_only is set to #GNUNET_YES peerinfo will include HELLO | ||
211 | * messages which are intended for friend to friend mode and which do not | ||
212 | * have to be gossiped. Otherwise these messages are skipped. //FIXME Not implemented atm! | ||
213 | * | ||
214 | * @param h Handle to the PEERSTORE service | ||
215 | * @param include_friend_only include HELLO messages for friends only (not used at the moment) | ||
216 | * @param callback the method to call for getting the hello. | ||
217 | * @param callback_cls closure for @a callback | ||
218 | * @return NULL on error | ||
219 | */ | ||
220 | struct GNUNET_PEERSTORE_NotifyContext * | ||
221 | GNUNET_PEERSTORE_hello_changed_notify (struct GNUNET_PEERSTORE_Handle *h, | ||
222 | int include_friend_only, | ||
223 | GNUNET_PEERSTORE_hello_notify_cb callback, | ||
224 | void *callback_cls); | ||
225 | |||
226 | |||
227 | /** | ||
228 | * Stop notifying about changes. | ||
229 | * | ||
230 | * @param nc context to stop notifying | ||
231 | */ | ||
232 | void | ||
233 | GNUNET_PEERSTORE_hello_changed_notify_cancel (struct | ||
234 | GNUNET_PEERSTORE_NotifyContext *nc); | ||
188 | 235 | ||
189 | 236 | ||
190 | /** | 237 | /** |
@@ -210,7 +257,8 @@ GNUNET_PEERSTORE_hello_add (struct GNUNET_PEERSTORE_Handle *h, | |||
210 | * @param huc The context for storing a hello. | 257 | * @param huc The context for storing a hello. |
211 | */ | 258 | */ |
212 | void | 259 | void |
213 | GNUNET_PEERSTORE_hello_add_cancel (struct GNUNET_PEERSTORE_StoreHelloContext *huc); | 260 | GNUNET_PEERSTORE_hello_add_cancel (struct |
261 | GNUNET_PEERSTORE_StoreHelloContext *huc); | ||
214 | 262 | ||
215 | 263 | ||
216 | /** | 264 | /** |