diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-31 07:37:22 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-31 07:37:22 +0000 |
commit | 0bcdd97c38f467001fa3723d9de22f8f135a2d5a (patch) | |
tree | 9eb8f4584e52742b0a3109a209eff7658731e769 /src/namestore | |
parent | 6429ccfb2ffb8c44a1d10a28a545b72f64c0b6da (diff) | |
download | gnunet-0bcdd97c38f467001fa3723d9de22f8f135a2d5a.tar.gz gnunet-0bcdd97c38f467001fa3723d9de22f8f135a2d5a.zip |
-tlsa rr added to namestore
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/namestore_common.c | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c index 8b095eb26..f5c039c3b 100644 --- a/src/namestore/namestore_common.c +++ b/src/namestore/namestore_common.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "gnunet_arm_service.h" | 32 | #include "gnunet_arm_service.h" |
33 | #include "gnunet_namestore_service.h" | 33 | #include "gnunet_namestore_service.h" |
34 | #include "gnunet_dnsparser_lib.h" | 34 | #include "gnunet_dnsparser_lib.h" |
35 | #include "../dns/dnsparser.h" | 35 | #include "gns_protocol.h" |
36 | #include "namestore.h" | 36 | #include "namestore.h" |
37 | 37 | ||
38 | 38 | ||
@@ -348,19 +348,20 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
348 | const void *data, | 348 | const void *data, |
349 | size_t data_size) | 349 | size_t data_size) |
350 | { | 350 | { |
351 | char tmp[INET6_ADDRSTRLEN]; | ||
352 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded enc; | ||
353 | uint16_t mx_pref; | 351 | uint16_t mx_pref; |
354 | char* result; | ||
355 | char* soa_rname; | ||
356 | char* soa_mname; | ||
357 | struct soa_data *soa; | 352 | struct soa_data *soa; |
358 | |||
359 | struct vpn_data *vpn; | 353 | struct vpn_data *vpn; |
354 | struct srv_data *srv; | ||
355 | struct tlsa_data *tlsa; | ||
356 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded enc; | ||
357 | struct GNUNET_CRYPTO_HashAsciiEncoded s_peer; | ||
360 | char* vpn_str; | 358 | char* vpn_str; |
361 | char* srv_str; | 359 | char* srv_str; |
362 | struct GNUNET_CRYPTO_HashAsciiEncoded s_peer; | 360 | char* tlsa_str; |
363 | struct srv_data *srv; | 361 | char* result; |
362 | char* soa_rname; | ||
363 | char* soa_mname; | ||
364 | char tmp[INET6_ADDRSTRLEN]; | ||
364 | 365 | ||
365 | switch (type) | 366 | switch (type) |
366 | { | 367 | { |
@@ -434,6 +435,16 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
434 | (char*)&srv[1])) | 435 | (char*)&srv[1])) |
435 | return NULL; | 436 | return NULL; |
436 | return srv_str; | 437 | return srv_str; |
438 | case GNUNET_DNSPARSER_TYPE_TLSA: | ||
439 | tlsa = (struct tlsa_data*)data; | ||
440 | |||
441 | if (GNUNET_OK != GNUNET_asprintf (&tlsa_str, "%c %c %c %s", | ||
442 | tlsa->usage, | ||
443 | tlsa->selector, | ||
444 | tlsa->matching_type, | ||
445 | tlsa[1])) | ||
446 | return NULL; | ||
447 | return tlsa_str; | ||
437 | default: | 448 | default: |
438 | GNUNET_break (0); | 449 | GNUNET_break (0); |
439 | } | 450 | } |
@@ -461,20 +472,21 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
461 | struct in_addr value_a; | 472 | struct in_addr value_a; |
462 | struct in6_addr value_aaaa; | 473 | struct in6_addr value_aaaa; |
463 | struct GNUNET_CRYPTO_ShortHashCode pkey; | 474 | struct GNUNET_CRYPTO_ShortHashCode pkey; |
464 | uint16_t mx_pref; | ||
465 | uint16_t mx_pref_n; | ||
466 | struct soa_data *soa; | 475 | struct soa_data *soa; |
476 | struct vpn_data *vpn; | ||
477 | struct tlsa_data *tlsa; | ||
467 | char result[253]; | 478 | char result[253]; |
468 | char soa_rname[63]; | 479 | char soa_rname[63]; |
469 | char soa_mname[63]; | 480 | char soa_mname[63]; |
481 | char s_peer[104]; | ||
482 | char s_serv[253]; | ||
470 | uint32_t soa_serial; | 483 | uint32_t soa_serial; |
471 | uint32_t soa_refresh; | 484 | uint32_t soa_refresh; |
472 | uint32_t soa_retry; | 485 | uint32_t soa_retry; |
473 | uint32_t soa_expire; | 486 | uint32_t soa_expire; |
474 | uint32_t soa_min; | 487 | uint32_t soa_min; |
475 | char s_peer[104]; | 488 | uint16_t mx_pref; |
476 | char s_serv[253]; | 489 | uint16_t mx_pref_n; |
477 | struct vpn_data* vpn; | ||
478 | uint16_t proto; | 490 | uint16_t proto; |
479 | int ret; | 491 | int ret; |
480 | 492 | ||
@@ -582,6 +594,26 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
582 | vpn->proto = htons (proto); | 594 | vpn->proto = htons (proto); |
583 | strcpy ((char*)&vpn[1], s_serv); | 595 | strcpy ((char*)&vpn[1], s_serv); |
584 | return GNUNET_OK; | 596 | return GNUNET_OK; |
597 | case GNUNET_DNSPARSER_TYPE_TLSA: | ||
598 | tlsa = (struct tlsa_data*)*data; | ||
599 | *data_size = sizeof (struct tlsa_data) + strlen (s) - 6; | ||
600 | tlsa = GNUNET_malloc (*data_size); | ||
601 | ret = SSCANF (s, "%c %c %c %s", | ||
602 | &tlsa->usage, | ||
603 | &tlsa->selector, | ||
604 | &tlsa->matching_type, | ||
605 | (char*)&tlsa[1]); | ||
606 | |||
607 | if (4 != ret) | ||
608 | { | ||
609 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
610 | "Unable to parse TLSA record string %s\n", s); | ||
611 | *data_size = 0; | ||
612 | GNUNET_free (tlsa); | ||
613 | return GNUNET_SYSERR; | ||
614 | } | ||
615 | |||
616 | return GNUNET_OK; | ||
585 | default: | 617 | default: |
586 | GNUNET_break (0); | 618 | GNUNET_break (0); |
587 | } | 619 | } |