summaryrefslogtreecommitdiff
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.h92
1 files changed, 49 insertions, 43 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 5effa855f..f5b2f0dd1 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -144,7 +144,8 @@ extern "C" {
144/** 144/**
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{
148 /** 149 /**
149 * No special options. 150 * No special options.
150 */ 151 */
@@ -192,7 +193,8 @@ enum GNUNET_GNSRECORD_Flags {
192/** 193/**
193 * A GNS record. 194 * A GNS record.
194 */ 195 */
195struct GNUNET_GNSRECORD_Data { 196struct GNUNET_GNSRECORD_Data
197{
196 /** 198 /**
197 * Binary value stored in the DNS record. Note: "data" must never 199 * Binary value stored in the DNS record. Note: "data" must never
198 * be individually 'malloc'ed, but instead always points into some 200 * be individually 'malloc'ed, but instead always points into some
@@ -229,7 +231,8 @@ GNUNET_NETWORK_STRUCT_BEGIN
229/** 231/**
230 * Data stored in a PLACE record. 232 * Data stored in a PLACE record.
231 */ 233 */
232struct GNUNET_GNSRECORD_PlaceData { 234struct GNUNET_GNSRECORD_PlaceData
235{
233 /** 236 /**
234 * Public key of the place. 237 * Public key of the place.
235 */ 238 */
@@ -252,7 +255,8 @@ struct GNUNET_GNSRECORD_PlaceData {
252/** 255/**
253 * Information we have in an encrypted block with record data (i.e. in the DHT). 256 * Information we have in an encrypted block with record data (i.e. in the DHT).
254 */ 257 */
255struct GNUNET_GNSRECORD_Block { 258struct GNUNET_GNSRECORD_Block
259{
256 /** 260 /**
257 * Signature of the block. 261 * Signature of the block.
258 */ 262 */
@@ -288,7 +292,8 @@ struct GNUNET_GNSRECORD_Block {
288 * records do not require a separate network request, thus making TLSA 292 * records do not require a separate network request, thus making TLSA
289 * records inseparable from the "main" A/AAAA/VPN/etc. records. 293 * records inseparable from the "main" A/AAAA/VPN/etc. records.
290 */ 294 */
291struct GNUNET_GNSRECORD_BoxRecord { 295struct GNUNET_GNSRECORD_BoxRecord
296{
292 /** 297 /**
293 * Protocol of the boxed record (6 = TCP, 17 = UDP, etc.). 298 * Protocol of the boxed record (6 = TCP, 17 = UDP, etc.).
294 * Yes, in IP protocols are usually limited to 8 bits. In NBO. 299 * Yes, in IP protocols are usually limited to 8 bits. In NBO.
@@ -315,7 +320,8 @@ struct GNUNET_GNSRECORD_BoxRecord {
315 * the namespace the record belongs to. 320 * the namespace the record belongs to.
316 * It is exclusively found under the label ``+''. 321 * It is exclusively found under the label ``+''.
317 */ 322 */
318struct GNUNET_GNSRECORD_ReverseRecord { 323struct GNUNET_GNSRECORD_ReverseRecord
324{
319 /** 325 /**
320 * The public key of the namespace the is delegating to our namespace 326 * The public key of the namespace the is delegating to our namespace
321 */ 327 */
@@ -355,8 +361,8 @@ typedef void (*GNUNET_GNSRECORD_RecordCallback) (
355 * @return NULL on error, otherwise human-readable representation of the value 361 * @return NULL on error, otherwise human-readable representation of the value
356 */ 362 */
357char * 363char *
358GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data, 364GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data,
359 size_t data_size); 365 size_t data_size);
360 366
361 367
362/** 368/**
@@ -370,8 +376,8 @@ GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data,
370 * @return #GNUNET_OK on success 376 * @return #GNUNET_OK on success
371 */ 377 */
372int 378int
373GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data, 379GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data,
374 size_t *data_size); 380 size_t *data_size);
375 381
376 382
377/** 383/**
@@ -381,7 +387,7 @@ GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data,
381 * @return corresponding number, UINT32_MAX on error 387 * @return corresponding number, UINT32_MAX on error
382 */ 388 */
383uint32_t 389uint32_t
384GNUNET_GNSRECORD_typename_to_number(const char *dns_typename); 390GNUNET_GNSRECORD_typename_to_number (const char *dns_typename);
385 391
386 392
387/** 393/**
@@ -391,7 +397,7 @@ GNUNET_GNSRECORD_typename_to_number(const char *dns_typename);
391 * @return corresponding typestring, NULL on error 397 * @return corresponding typestring, NULL on error
392 */ 398 */
393const char * 399const char *
394GNUNET_GNSRECORD_number_to_typename(uint32_t type); 400GNUNET_GNSRECORD_number_to_typename (uint32_t type);
395 401
396 402
397/* convenience APIs for serializing / deserializing GNS records */ 403/* convenience APIs for serializing / deserializing GNS records */
@@ -405,8 +411,8 @@ GNUNET_GNSRECORD_number_to_typename(uint32_t type);
405 * @return the required size to serialize, -1 on error 411 * @return the required size to serialize, -1 on error
406 */ 412 */
407ssize_t 413ssize_t
408GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, 414GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
409 const struct GNUNET_GNSRECORD_Data *rd); 415 const struct GNUNET_GNSRECORD_Data *rd);
410 416
411 417
412/** 418/**
@@ -419,9 +425,9 @@ GNUNET_GNSRECORD_records_get_size(unsigned int rd_count,
419 * @return the size of serialized records, -1 if records do not fit 425 * @return the size of serialized records, -1 if records do not fit
420 */ 426 */
421ssize_t 427ssize_t
422GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, 428GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
423 const struct GNUNET_GNSRECORD_Data *rd, 429 const struct GNUNET_GNSRECORD_Data *rd,
424 size_t dest_size, char *dest); 430 size_t dest_size, char *dest);
425 431
426 432
427/** 433/**
@@ -434,9 +440,9 @@ GNUNET_GNSRECORD_records_serialize(unsigned int rd_count,
434 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 440 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
435 */ 441 */
436int 442int
437GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src, 443GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src,
438 unsigned int rd_count, 444 unsigned int rd_count,
439 struct GNUNET_GNSRECORD_Data *dest); 445 struct GNUNET_GNSRECORD_Data *dest);
440 446
441 447
442/* ******* general APIs relating to blocks, records and labels ******** */ 448/* ******* general APIs relating to blocks, records and labels ******** */
@@ -450,7 +456,7 @@ GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src,
450 * #GNUNET_NO if not 456 * #GNUNET_NO if not
451 */ 457 */
452int 458int
453GNUNET_GNSRECORD_is_expired(const struct GNUNET_GNSRECORD_Data *rd); 459GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd);
454 460
455 461
456/** 462/**
@@ -459,7 +465,7 @@ GNUNET_GNSRECORD_is_expired(const struct GNUNET_GNSRECORD_Data *rd);
459 * @return converted result 465 * @return converted result
460 */ 466 */
461char * 467char *
462GNUNET_GNSRECORD_string_to_lowercase(const char *src); 468GNUNET_GNSRECORD_string_to_lowercase (const char *src);
463 469
464 470
465/** 471/**
@@ -472,7 +478,7 @@ GNUNET_GNSRECORD_string_to_lowercase(const char *src);
472 * #GNUNET_GNSRECORD_z2s. 478 * #GNUNET_GNSRECORD_z2s.
473 */ 479 */
474const char * 480const char *
475GNUNET_GNSRECORD_z2s(const struct GNUNET_CRYPTO_EcdsaPublicKey *z); 481GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z);
476 482
477 483
478/** 484/**
@@ -486,7 +492,7 @@ GNUNET_GNSRECORD_z2s(const struct GNUNET_CRYPTO_EcdsaPublicKey *z);
486 * key in an encoding suitable for DNS labels. 492 * key in an encoding suitable for DNS labels.
487 */ 493 */
488const char * 494const char *
489GNUNET_GNSRECORD_pkey_to_zkey(const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); 495GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
490 496
491 497
492/** 498/**
@@ -499,8 +505,8 @@ GNUNET_GNSRECORD_pkey_to_zkey(const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
499 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax 505 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
500 */ 506 */
501int 507int
502GNUNET_GNSRECORD_zkey_to_pkey(const char *zkey, 508GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
503 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); 509 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
504 510
505 511
506/** 512/**
@@ -511,7 +517,7 @@ GNUNET_GNSRECORD_zkey_to_pkey(const char *zkey,
511 * @param query hash to use for the query 517 * @param query hash to use for the query
512 */ 518 */
513void 519void
514GNUNET_GNSRECORD_query_from_private_key( 520GNUNET_GNSRECORD_query_from_private_key (
515 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, 521 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label,
516 struct GNUNET_HashCode *query); 522 struct GNUNET_HashCode *query);
517 523
@@ -524,7 +530,7 @@ GNUNET_GNSRECORD_query_from_private_key(
524 * @param query hash to use for the query 530 * @param query hash to use for the query
525 */ 531 */
526void 532void
527GNUNET_GNSRECORD_query_from_public_key( 533GNUNET_GNSRECORD_query_from_public_key (
528 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, 534 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label,
529 struct GNUNET_HashCode *query); 535 struct GNUNET_HashCode *query);
530 536
@@ -539,11 +545,11 @@ GNUNET_GNSRECORD_query_from_public_key(
539 * @param rd_count number of records in @a rd 545 * @param rd_count number of records in @a rd
540 */ 546 */
541struct GNUNET_GNSRECORD_Block * 547struct GNUNET_GNSRECORD_Block *
542GNUNET_GNSRECORD_block_create(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 548GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
543 struct GNUNET_TIME_Absolute expire, 549 struct GNUNET_TIME_Absolute expire,
544 const char *label, 550 const char *label,
545 const struct GNUNET_GNSRECORD_Data *rd, 551 const struct GNUNET_GNSRECORD_Data *rd,
546 unsigned int rd_count); 552 unsigned int rd_count);
547 553
548 554
549/** 555/**
@@ -558,11 +564,11 @@ GNUNET_GNSRECORD_block_create(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
558 * @param rd_count number of records in @a rd 564 * @param rd_count number of records in @a rd
559 */ 565 */
560struct GNUNET_GNSRECORD_Block * 566struct GNUNET_GNSRECORD_Block *
561GNUNET_GNSRECORD_block_create2(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 567GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
562 struct GNUNET_TIME_Absolute expire, 568 struct GNUNET_TIME_Absolute expire,
563 const char *label, 569 const char *label,
564 const struct GNUNET_GNSRECORD_Data *rd, 570 const struct GNUNET_GNSRECORD_Data *rd,
565 unsigned int rd_count); 571 unsigned int rd_count);
566 572
567 573
568/** 574/**
@@ -573,7 +579,7 @@ GNUNET_GNSRECORD_block_create2(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
573 * @return #GNUNET_OK if the signature is valid 579 * @return #GNUNET_OK if the signature is valid
574 */ 580 */
575int 581int
576GNUNET_GNSRECORD_block_verify(const struct GNUNET_GNSRECORD_Block *block); 582GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block);
577 583
578 584
579/** 585/**
@@ -588,7 +594,7 @@ GNUNET_GNSRECORD_block_verify(const struct GNUNET_GNSRECORD_Block *block);
588 * not well-formed 594 * not well-formed
589 */ 595 */
590int 596int
591GNUNET_GNSRECORD_block_decrypt( 597GNUNET_GNSRECORD_block_decrypt (
592 const struct GNUNET_GNSRECORD_Block *block, 598 const struct GNUNET_GNSRECORD_Block *block,
593 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, 599 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label,
594 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); 600 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls);
@@ -602,8 +608,8 @@ GNUNET_GNSRECORD_block_decrypt(
602 * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not. 608 * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not.
603 */ 609 */
604int 610int
605GNUNET_GNSRECORD_records_cmp(const struct GNUNET_GNSRECORD_Data *a, 611GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
606 const struct GNUNET_GNSRECORD_Data *b); 612 const struct GNUNET_GNSRECORD_Data *b);
607 613
608 614
609/** 615/**
@@ -616,7 +622,7 @@ GNUNET_GNSRECORD_records_cmp(const struct GNUNET_GNSRECORD_Data *a,
616 * @return absolute expiration time 622 * @return absolute expiration time
617 */ 623 */
618struct GNUNET_TIME_Absolute 624struct GNUNET_TIME_Absolute
619GNUNET_GNSRECORD_record_get_expiration_time( 625GNUNET_GNSRECORD_record_get_expiration_time (
620 unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); 626 unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd);
621 627
622 628