aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_gnsrecord_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_gnsrecord_lib.h')
-rw-r--r--src/include/gnunet_gnsrecord_lib.h98
1 files changed, 47 insertions, 51 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index a92cdc2e7..5effa855f 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -16,7 +16,7 @@
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @author Christian Grothoff 22 * @author Christian Grothoff
@@ -145,7 +145,6 @@ extern "C" {
145 * Flags that can be set for a record. 145 * Flags that can be set for a record.
146 */ 146 */
147enum GNUNET_GNSRECORD_Flags { 147enum GNUNET_GNSRECORD_Flags {
148
149 /** 148 /**
150 * No special options. 149 * No special options.
151 */ 150 */
@@ -194,7 +193,6 @@ enum GNUNET_GNSRECORD_Flags {
194 * A GNS record. 193 * A GNS record.
195 */ 194 */
196struct GNUNET_GNSRECORD_Data { 195struct GNUNET_GNSRECORD_Data {
197
198 /** 196 /**
199 * Binary value stored in the DNS record. Note: "data" must never 197 * Binary value stored in the DNS record. Note: "data" must never
200 * be individually 'malloc'ed, but instead always points into some 198 * be individually 'malloc'ed, but instead always points into some
@@ -255,7 +253,6 @@ struct GNUNET_GNSRECORD_PlaceData {
255 * Information we have in an encrypted block with record data (i.e. in the DHT). 253 * Information we have in an encrypted block with record data (i.e. in the DHT).
256 */ 254 */
257struct GNUNET_GNSRECORD_Block { 255struct GNUNET_GNSRECORD_Block {
258
259 /** 256 /**
260 * Signature of the block. 257 * Signature of the block.
261 */ 258 */
@@ -292,7 +289,6 @@ struct GNUNET_GNSRECORD_Block {
292 * records inseparable from the "main" A/AAAA/VPN/etc. records. 289 * records inseparable from the "main" A/AAAA/VPN/etc. records.
293 */ 290 */
294struct GNUNET_GNSRECORD_BoxRecord { 291struct GNUNET_GNSRECORD_BoxRecord {
295
296 /** 292 /**
297 * Protocol of the boxed record (6 = TCP, 17 = UDP, etc.). 293 * Protocol of the boxed record (6 = TCP, 17 = UDP, etc.).
298 * Yes, in IP protocols are usually limited to 8 bits. In NBO. 294 * Yes, in IP protocols are usually limited to 8 bits. In NBO.
@@ -344,7 +340,7 @@ GNUNET_NETWORK_STRUCT_END
344 * @param rd array of records with data to store 340 * @param rd array of records with data to store
345 */ 341 */
346typedef void (*GNUNET_GNSRECORD_RecordCallback) ( 342typedef void (*GNUNET_GNSRECORD_RecordCallback) (
347 void *cls, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); 343 void *cls, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd);
348 344
349 345
350/* ***************** API related to GNSRECORD plugins ************** */ 346/* ***************** API related to GNSRECORD plugins ************** */
@@ -359,8 +355,8 @@ typedef void (*GNUNET_GNSRECORD_RecordCallback) (
359 * @return NULL on error, otherwise human-readable representation of the value 355 * @return NULL on error, otherwise human-readable representation of the value
360 */ 356 */
361char * 357char *
362GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data, 358GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data,
363 size_t data_size); 359 size_t data_size);
364 360
365 361
366/** 362/**
@@ -374,8 +370,8 @@ GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data,
374 * @return #GNUNET_OK on success 370 * @return #GNUNET_OK on success
375 */ 371 */
376int 372int
377GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data, 373GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data,
378 size_t *data_size); 374 size_t *data_size);
379 375
380 376
381/** 377/**
@@ -385,7 +381,7 @@ GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data,
385 * @return corresponding number, UINT32_MAX on error 381 * @return corresponding number, UINT32_MAX on error
386 */ 382 */
387uint32_t 383uint32_t
388GNUNET_GNSRECORD_typename_to_number (const char *dns_typename); 384GNUNET_GNSRECORD_typename_to_number(const char *dns_typename);
389 385
390 386
391/** 387/**
@@ -395,7 +391,7 @@ GNUNET_GNSRECORD_typename_to_number (const char *dns_typename);
395 * @return corresponding typestring, NULL on error 391 * @return corresponding typestring, NULL on error
396 */ 392 */
397const char * 393const char *
398GNUNET_GNSRECORD_number_to_typename (uint32_t type); 394GNUNET_GNSRECORD_number_to_typename(uint32_t type);
399 395
400 396
401/* convenience APIs for serializing / deserializing GNS records */ 397/* convenience APIs for serializing / deserializing GNS records */
@@ -409,8 +405,8 @@ GNUNET_GNSRECORD_number_to_typename (uint32_t type);
409 * @return the required size to serialize, -1 on error 405 * @return the required size to serialize, -1 on error
410 */ 406 */
411ssize_t 407ssize_t
412GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, 408GNUNET_GNSRECORD_records_get_size(unsigned int rd_count,
413 const struct GNUNET_GNSRECORD_Data *rd); 409 const struct GNUNET_GNSRECORD_Data *rd);
414 410
415 411
416/** 412/**
@@ -423,9 +419,9 @@ GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
423 * @return the size of serialized records, -1 if records do not fit 419 * @return the size of serialized records, -1 if records do not fit
424 */ 420 */
425ssize_t 421ssize_t
426GNUNET_GNSRECORD_records_serialize (unsigned int rd_count, 422GNUNET_GNSRECORD_records_serialize(unsigned int rd_count,
427 const struct GNUNET_GNSRECORD_Data *rd, 423 const struct GNUNET_GNSRECORD_Data *rd,
428 size_t dest_size, char *dest); 424 size_t dest_size, char *dest);
429 425
430 426
431/** 427/**
@@ -438,9 +434,9 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
438 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 434 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
439 */ 435 */
440int 436int
441GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src, 437GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src,
442 unsigned int rd_count, 438 unsigned int rd_count,
443 struct GNUNET_GNSRECORD_Data *dest); 439 struct GNUNET_GNSRECORD_Data *dest);
444 440
445 441
446/* ******* general APIs relating to blocks, records and labels ******** */ 442/* ******* general APIs relating to blocks, records and labels ******** */
@@ -454,7 +450,7 @@ GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src,
454 * #GNUNET_NO if not 450 * #GNUNET_NO if not
455 */ 451 */
456int 452int
457GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd); 453GNUNET_GNSRECORD_is_expired(const struct GNUNET_GNSRECORD_Data *rd);
458 454
459 455
460/** 456/**
@@ -463,7 +459,7 @@ GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd);
463 * @return converted result 459 * @return converted result
464 */ 460 */
465char * 461char *
466GNUNET_GNSRECORD_string_to_lowercase (const char *src); 462GNUNET_GNSRECORD_string_to_lowercase(const char *src);
467 463
468 464
469/** 465/**
@@ -476,7 +472,7 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src);
476 * #GNUNET_GNSRECORD_z2s. 472 * #GNUNET_GNSRECORD_z2s.
477 */ 473 */
478const char * 474const char *
479GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); 475GNUNET_GNSRECORD_z2s(const struct GNUNET_CRYPTO_EcdsaPublicKey *z);
480 476
481 477
482/** 478/**
@@ -490,7 +486,7 @@ GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z);
490 * key in an encoding suitable for DNS labels. 486 * key in an encoding suitable for DNS labels.
491 */ 487 */
492const char * 488const char *
493GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); 489GNUNET_GNSRECORD_pkey_to_zkey(const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
494 490
495 491
496/** 492/**
@@ -503,8 +499,8 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
503 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax 499 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
504 */ 500 */
505int 501int
506GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, 502GNUNET_GNSRECORD_zkey_to_pkey(const char *zkey,
507 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); 503 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
508 504
509 505
510/** 506/**
@@ -515,9 +511,9 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
515 * @param query hash to use for the query 511 * @param query hash to use for the query
516 */ 512 */
517void 513void
518GNUNET_GNSRECORD_query_from_private_key ( 514GNUNET_GNSRECORD_query_from_private_key(
519 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, 515 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label,
520 struct GNUNET_HashCode *query); 516 struct GNUNET_HashCode *query);
521 517
522 518
523/** 519/**
@@ -528,9 +524,9 @@ GNUNET_GNSRECORD_query_from_private_key (
528 * @param query hash to use for the query 524 * @param query hash to use for the query
529 */ 525 */
530void 526void
531GNUNET_GNSRECORD_query_from_public_key ( 527GNUNET_GNSRECORD_query_from_public_key(
532 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, 528 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label,
533 struct GNUNET_HashCode *query); 529 struct GNUNET_HashCode *query);
534 530
535 531
536/** 532/**
@@ -543,11 +539,11 @@ GNUNET_GNSRECORD_query_from_public_key (
543 * @param rd_count number of records in @a rd 539 * @param rd_count number of records in @a rd
544 */ 540 */
545struct GNUNET_GNSRECORD_Block * 541struct GNUNET_GNSRECORD_Block *
546GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 542GNUNET_GNSRECORD_block_create(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
547 struct GNUNET_TIME_Absolute expire, 543 struct GNUNET_TIME_Absolute expire,
548 const char *label, 544 const char *label,
549 const struct GNUNET_GNSRECORD_Data *rd, 545 const struct GNUNET_GNSRECORD_Data *rd,
550 unsigned int rd_count); 546 unsigned int rd_count);
551 547
552 548
553/** 549/**
@@ -562,11 +558,11 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
562 * @param rd_count number of records in @a rd 558 * @param rd_count number of records in @a rd
563 */ 559 */
564struct GNUNET_GNSRECORD_Block * 560struct GNUNET_GNSRECORD_Block *
565GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 561GNUNET_GNSRECORD_block_create2(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
566 struct GNUNET_TIME_Absolute expire, 562 struct GNUNET_TIME_Absolute expire,
567 const char *label, 563 const char *label,
568 const struct GNUNET_GNSRECORD_Data *rd, 564 const struct GNUNET_GNSRECORD_Data *rd,
569 unsigned int rd_count); 565 unsigned int rd_count);
570 566
571 567
572/** 568/**
@@ -577,7 +573,7 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
577 * @return #GNUNET_OK if the signature is valid 573 * @return #GNUNET_OK if the signature is valid
578 */ 574 */
579int 575int
580GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block); 576GNUNET_GNSRECORD_block_verify(const struct GNUNET_GNSRECORD_Block *block);
581 577
582 578
583/** 579/**
@@ -592,10 +588,10 @@ GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block);
592 * not well-formed 588 * not well-formed
593 */ 589 */
594int 590int
595GNUNET_GNSRECORD_block_decrypt ( 591GNUNET_GNSRECORD_block_decrypt(
596 const struct GNUNET_GNSRECORD_Block *block, 592 const struct GNUNET_GNSRECORD_Block *block,
597 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, 593 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label,
598 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); 594 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls);
599 595
600 596
601/** 597/**
@@ -606,8 +602,8 @@ GNUNET_GNSRECORD_block_decrypt (
606 * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not. 602 * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not.
607 */ 603 */
608int 604int
609GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, 605GNUNET_GNSRECORD_records_cmp(const struct GNUNET_GNSRECORD_Data *a,
610 const struct GNUNET_GNSRECORD_Data *b); 606 const struct GNUNET_GNSRECORD_Data *b);
611 607
612 608
613/** 609/**
@@ -620,8 +616,8 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
620 * @return absolute expiration time 616 * @return absolute expiration time
621 */ 617 */
622struct GNUNET_TIME_Absolute 618struct GNUNET_TIME_Absolute
623GNUNET_GNSRECORD_record_get_expiration_time ( 619GNUNET_GNSRECORD_record_get_expiration_time(
624 unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); 620 unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd);
625 621
626 622
627#if 0 /* keep Emacsens' auto-indent happy */ 623#if 0 /* keep Emacsens' auto-indent happy */