diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-26 15:54:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-26 15:54:54 +0000 |
commit | 7706f0a08b2425622121c23a7d2054794f2d677c (patch) | |
tree | d4b658006d8b0418b2afabe51bfae14c3f59bb97 /src/include/gnunet_namestore_service.h | |
parent | 133a5ecf306d35f9e86fb5a1f8b120783f6afdf9 (diff) | |
download | gnunet-7706f0a08b2425622121c23a7d2054794f2d677c.tar.gz gnunet-7706f0a08b2425622121c23a7d2054794f2d677c.zip |
-removing unnecessary key from regex blocks, compacting some of the other fields
Diffstat (limited to 'src/include/gnunet_namestore_service.h')
-rw-r--r-- | src/include/gnunet_namestore_service.h | 118 |
1 files changed, 76 insertions, 42 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 38083ed9c..418813734 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -1,10 +1,10 @@ | |||
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 |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -225,9 +225,8 @@ struct GNUNET_NAMESTORE_RecordData | |||
225 | 225 | ||
226 | /** | 226 | /** |
227 | * Store an item in the namestore. If the item is already present, | 227 | * Store an item in the namestore. If the item is already present, |
228 | * the expiration time is updated to the max of the existing time and | 228 | * it is replaced with the new record. Use an empty array to |
229 | * the new time. This API is used when we cache signatures from other | 229 | * remove all records under the given name. |
230 | * authorities. | ||
231 | * | 230 | * |
232 | * @param h handle to the namestore | 231 | * @param h handle to the namestore |
233 | * @param zone_key public key of the zone | 232 | * @param zone_key public key of the zone |
@@ -276,49 +275,26 @@ GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_EccPublicKeyBinary | |||
276 | 275 | ||
277 | /** | 276 | /** |
278 | * Store an item in the namestore. If the item is already present, | 277 | * Store an item in the namestore. If the item is already present, |
279 | * the expiration time is updated to the max of the existing time and | 278 | * it is replaced with the new record. Use an empty array to |
280 | * the new time. This API is used by the authority of a zone. | 279 | * remove all records under the given name. |
281 | * FIXME: consider allowing to pass multiple records in one call! | ||
282 | * | 280 | * |
283 | * @param h handle to the namestore | 281 | * @param h handle to the namestore |
284 | * @param pkey private key of the zone | 282 | * @param pkey private key of the zone |
285 | * @param name name that is being mapped (at most 255 characters long) | 283 | * @param name name that is being mapped (at most 255 characters long) |
286 | * @param rd record data to store | 284 | * @param rd_count number of records in the 'rd' array |
287 | * @param cont continuation to call when done | 285 | * @param rd array of records with data to store |
288 | * @param cont_cls closure for cont | ||
289 | * @return handle to abort the request | ||
290 | */ | ||
291 | struct GNUNET_NAMESTORE_QueueEntry * | ||
292 | GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h, | ||
293 | const struct GNUNET_CRYPTO_EccPrivateKey *pkey, | ||
294 | const char *name, | ||
295 | const struct GNUNET_NAMESTORE_RecordData *rd, | ||
296 | GNUNET_NAMESTORE_ContinuationWithStatus cont, | ||
297 | void *cont_cls); | ||
298 | |||
299 | |||
300 | /** | ||
301 | * Explicitly remove some content from the database. The | ||
302 | * "cont"inuation will be called with status "GNUNET_OK" if content | ||
303 | * was removed, "GNUNET_NO" if no matching entry was found and | ||
304 | * "GNUNET_SYSERR" on all other types of errors. | ||
305 | * This API is used by the authority of a zone. | ||
306 | * | ||
307 | * @param h handle to the namestore | ||
308 | * @param pkey private key of the zone | ||
309 | * @param name name that is being mapped (at most 255 characters long) | ||
310 | * @param rd record data, remove specific record, NULL to remove the name and all records | ||
311 | * @param cont continuation to call when done | 286 | * @param cont continuation to call when done |
312 | * @param cont_cls closure for cont | 287 | * @param cont_cls closure for 'cont' |
313 | * @return handle to abort the request | 288 | * @return handle to abort the request |
314 | */ | 289 | */ |
315 | struct GNUNET_NAMESTORE_QueueEntry * | 290 | struct GNUNET_NAMESTORE_QueueEntry * |
316 | GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h, | 291 | GNUNET_NAMESTORE_record_put_by_authority (struct GNUNET_NAMESTORE_Handle *h, |
317 | const struct GNUNET_CRYPTO_EccPrivateKey *pkey, | 292 | const struct GNUNET_CRYPTO_EccPrivateKey *pkey, |
318 | const char *name, | 293 | const char *name, |
319 | const struct GNUNET_NAMESTORE_RecordData *rd, | 294 | unsigned int rd_count, |
320 | GNUNET_NAMESTORE_ContinuationWithStatus cont, | 295 | const struct GNUNET_NAMESTORE_RecordData *rd, |
321 | void *cont_cls); | 296 | GNUNET_NAMESTORE_ContinuationWithStatus cont, |
297 | void *cont_cls); | ||
322 | 298 | ||
323 | 299 | ||
324 | /** | 300 | /** |
@@ -341,7 +317,7 @@ typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | |||
341 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 317 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
342 | struct GNUNET_TIME_Absolute freshness, | 318 | struct GNUNET_TIME_Absolute freshness, |
343 | const char *name, | 319 | const char *name, |
344 | unsigned int rd_len, | 320 | unsigned int rd_count, |
345 | const struct GNUNET_NAMESTORE_RecordData *rd, | 321 | const struct GNUNET_NAMESTORE_RecordData *rd, |
346 | const struct GNUNET_CRYPTO_EccSignature *signature); | 322 | const struct GNUNET_CRYPTO_EccSignature *signature); |
347 | 323 | ||
@@ -462,6 +438,64 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it); | |||
462 | 438 | ||
463 | 439 | ||
464 | /** | 440 | /** |
441 | * Handle for a monitoring activity. | ||
442 | */ | ||
443 | struct GNUNET_NAMESTORE_ZoneMonitor; | ||
444 | |||
445 | |||
446 | /** | ||
447 | * Function called whenever the records for a given name changed. | ||
448 | * | ||
449 | * @param cls closure | ||
450 | * @param was_removed GNUNET_NO if the record was added, GNUNET_YES if it was removed | ||
451 | * @param freshness when does the corresponding block in the DHT expire (until | ||
452 | * when should we never do a DHT lookup for the same name again)?; | ||
453 | * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any type in the namestore, | ||
454 | * or the expiration time of the block in the namestore (even if there are zero | ||
455 | * records matching the desired record type) | ||
456 | * @param name name that is being mapped (at most 255 characters long) | ||
457 | * @param rd_count number of entries in 'rd' array | ||
458 | * @param rd array of records with data to store | ||
459 | * @param signature signature of the record block | ||
460 | */ | ||
461 | typedef void (*GNUNET_NAMESTORE_RecordMonitor)(void *cls, | ||
462 | int was_removed, | ||
463 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | ||
464 | struct GNUNET_TIME_Absolute freshness, | ||
465 | const char *name, | ||
466 | unsigned int rd_len, | ||
467 | const struct GNUNET_NAMESTORE_RecordData *rd, | ||
468 | const struct GNUNET_CRYPTO_EccSignature *signature); | ||
469 | |||
470 | |||
471 | /** | ||
472 | * Begin monitoring a zone for changes. Will first call the 'monitor' function | ||
473 | * on all existing records in the selected zone(s) and then call it whenever | ||
474 | * a record changes. | ||
475 | * | ||
476 | * @param cfg configuration to use to connect to namestore | ||
477 | * @param zone zone to monitor, NULL for all zones | ||
478 | * @param monitor function to call on zone changes | ||
479 | * @param monitor_cls closure for 'monitor' | ||
480 | * @return handle to stop monitoring | ||
481 | */ | ||
482 | struct GNUNET_NAMESTORE_ZoneMonitor * | ||
483 | GNUNET_NAMESTORE_zone_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
484 | const struct GNUNET_CRYPTO_ShortHashCode *zone, | ||
485 | GNUNET_NAMESTORE_RecordMonitor monitor, | ||
486 | void *monitor_cls); | ||
487 | |||
488 | |||
489 | /** | ||
490 | * Stop monitoring a zone for changes. | ||
491 | * | ||
492 | * @param zm handle to the monitor activity to stop | ||
493 | */ | ||
494 | void | ||
495 | GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm); | ||
496 | |||
497 | |||
498 | /** | ||
465 | * Cancel a namestore operation. The final callback from the | 499 | * Cancel a namestore operation. The final callback from the |
466 | * operation must not have been done yet. Must be called on any | 500 | * operation must not have been done yet. Must be called on any |
467 | * namestore operation that has not yet completed prior to calling | 501 | * namestore operation that has not yet completed prior to calling |
@@ -473,7 +507,6 @@ void | |||
473 | GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | 507 | GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); |
474 | 508 | ||
475 | 509 | ||
476 | |||
477 | /* convenience APIs for serializing / deserializing GNS records */ | 510 | /* convenience APIs for serializing / deserializing GNS records */ |
478 | 511 | ||
479 | /** | 512 | /** |
@@ -579,6 +612,7 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type); | |||
579 | /** | 612 | /** |
580 | * Test if a given record is expired. | 613 | * Test if a given record is expired. |
581 | * | 614 | * |
615 | * @param rd record to test | ||
582 | * @return GNUNET_YES if the record is expired, | 616 | * @return GNUNET_YES if the record is expired, |
583 | * GNUNET_NO if not | 617 | * GNUNET_NO if not |
584 | */ | 618 | */ |