diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-30 19:21:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-30 19:21:05 +0000 |
commit | 17de5c9d798109f55059190c886609ba377e4eb6 (patch) | |
tree | 07f2b4241f433b18baf02d5bf189307ad2308166 /src/namestore/namestore.h | |
parent | fd87b25438487e1215c68bdb9f1bcac2d7012bc2 (diff) | |
download | gnunet-17de5c9d798109f55059190c886609ba377e4eb6.tar.gz gnunet-17de5c9d798109f55059190c886609ba377e4eb6.zip |
-towards implementing improved namestore API
Diffstat (limited to 'src/namestore/namestore.h')
-rw-r--r-- | src/namestore/namestore.h | 151 |
1 files changed, 1 insertions, 150 deletions
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index b0d3ffad0..0c1ec9be3 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h | |||
@@ -31,59 +31,9 @@ | |||
31 | */ | 31 | */ |
32 | #define MAX_NAME_LEN 256 | 32 | #define MAX_NAME_LEN 256 |
33 | 33 | ||
34 | /** | 34 | GNUNET_NETWORK_STRUCT_BEGIN |
35 | * Convert a UTF-8 string to UTF-8 lowercase | ||
36 | * @param src source string | ||
37 | * @return converted result | ||
38 | */ | ||
39 | char * | ||
40 | GNUNET_NAMESTORE_normalize_string (const char *src); | ||
41 | |||
42 | /** | ||
43 | * Convert a short hash to a string (for printing debug messages). | ||
44 | * This is one of the very few calls in the entire API that is | ||
45 | * NOT reentrant! | ||
46 | * | ||
47 | * @param hc the short hash code | ||
48 | * @return string form; will be overwritten by next call to GNUNET_h2s. | ||
49 | */ | ||
50 | const char * | ||
51 | GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc); | ||
52 | |||
53 | |||
54 | /** | ||
55 | * Sign name and records | ||
56 | * | ||
57 | * @param key the private key | ||
58 | * @param expire block expiration | ||
59 | * @param name the name | ||
60 | * @param rd record data | ||
61 | * @param rd_count number of records | ||
62 | * | ||
63 | * @return the signature | ||
64 | */ | ||
65 | struct GNUNET_CRYPTO_EccSignature * | ||
66 | GNUNET_NAMESTORE_create_signature (const struct GNUNET_CRYPTO_EccPrivateKey *key, | ||
67 | struct GNUNET_TIME_Absolute expire, | ||
68 | const char *name, | ||
69 | const struct GNUNET_NAMESTORE_RecordData *rd, | ||
70 | unsigned int rd_count); | ||
71 | |||
72 | |||
73 | /** | ||
74 | * Compares if two records are equal | ||
75 | * | ||
76 | * @param a Record a | ||
77 | * @param b Record b | ||
78 | * | ||
79 | * @return GNUNET_YES or GNUNET_NO | ||
80 | */ | ||
81 | int | ||
82 | GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a, | ||
83 | const struct GNUNET_NAMESTORE_RecordData *b); | ||
84 | 35 | ||
85 | 36 | ||
86 | GNUNET_NETWORK_STRUCT_BEGIN | ||
87 | /** | 37 | /** |
88 | * A GNS record serialized for network transmission. | 38 | * A GNS record serialized for network transmission. |
89 | * | 39 | * |
@@ -352,105 +302,6 @@ struct RecordCreateResponseMessage | |||
352 | 302 | ||
353 | 303 | ||
354 | /** | 304 | /** |
355 | * Remove a record from the namestore | ||
356 | * Memory layout: | ||
357 | */ | ||
358 | struct RecordRemoveMessage | ||
359 | { | ||
360 | /** | ||
361 | * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE | ||
362 | */ | ||
363 | struct GNUNET_NAMESTORE_Header gns_header; | ||
364 | |||
365 | /** | ||
366 | * Name length | ||
367 | */ | ||
368 | uint16_t name_len; | ||
369 | |||
370 | /** | ||
371 | * Length of serialized rd data | ||
372 | */ | ||
373 | uint16_t rd_len; | ||
374 | |||
375 | /** | ||
376 | * Number of records contained | ||
377 | */ | ||
378 | uint16_t rd_count; | ||
379 | |||
380 | /** | ||
381 | * Length of private key | ||
382 | */ | ||
383 | uint16_t pkey_len; | ||
384 | |||
385 | /* followed by: | ||
386 | * GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private key with length pkey_len | ||
387 | * name with length name_len | ||
388 | * serialized record data with length rd_len | ||
389 | * */ | ||
390 | }; | ||
391 | |||
392 | |||
393 | /** | ||
394 | * Removal of the record succeeded. | ||
395 | */ | ||
396 | #define RECORD_REMOVE_RESULT_SUCCESS 0 | ||
397 | |||
398 | /** | ||
399 | * There are NO records for the given name. | ||
400 | */ | ||
401 | #define RECORD_REMOVE_RESULT_NO_RECORDS 1 | ||
402 | |||
403 | /** | ||
404 | * The specific record that was to be removed was | ||
405 | * not found. | ||
406 | */ | ||
407 | #define RECORD_REMOVE_RESULT_RECORD_NOT_FOUND 2 | ||
408 | |||
409 | /** | ||
410 | * Internal error, failed to sign the remaining records. | ||
411 | * (Note: not used?) | ||
412 | */ | ||
413 | #define RECORD_REMOVE_RESULT_FAILED_TO_SIGN 3 | ||
414 | |||
415 | /** | ||
416 | * Internal error, failed to store the updated record set | ||
417 | */ | ||
418 | #define RECORD_REMOVE_RESULT_FAILED_TO_PUT_UPDATE 4 | ||
419 | |||
420 | /** | ||
421 | * Internal error, failed to remove records from database | ||
422 | */ | ||
423 | #define RECORD_REMOVE_RESULT_FAILED_TO_REMOVE 5 | ||
424 | |||
425 | /** | ||
426 | * Internal error, failed to access database | ||
427 | */ | ||
428 | #define RECORD_REMOVE_RESULT_FAILED_ACCESS_DATABASE 6 | ||
429 | |||
430 | /** | ||
431 | * Internal error, failed to access database | ||
432 | */ | ||
433 | #define RECORD_REMOVE_RESULT_FAILED_INTERNAL_ERROR 7 | ||
434 | |||
435 | |||
436 | /** | ||
437 | * Remove a record from the namestore response | ||
438 | */ | ||
439 | struct RecordRemoveResponseMessage | ||
440 | { | ||
441 | /** | ||
442 | * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE | ||
443 | */ | ||
444 | struct GNUNET_NAMESTORE_Header gns_header; | ||
445 | |||
446 | /** | ||
447 | * Result code (see RECORD_REMOVE_RESULT_*). In network byte order. | ||
448 | */ | ||
449 | int32_t op_result; | ||
450 | }; | ||
451 | |||
452 | |||
453 | /** | ||
454 | * Lookup a name for a zone hash | 305 | * Lookup a name for a zone hash |
455 | */ | 306 | */ |
456 | struct ZoneToNameMessage | 307 | struct ZoneToNameMessage |