diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-15 10:52:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-15 10:52:06 +0000 |
commit | 3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8 (patch) | |
tree | ed49951102400f7086f4db23846fb7aaf32e5eb1 /src/namestore | |
parent | 9e94c69b299f74ac88b14f92b7a01bba0c33a776 (diff) | |
download | gnunet-3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8.tar.gz gnunet-3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8.zip |
-eliminating duplicate struct definitions
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/namestore_api_common.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index 397a649aa..f0f061d0f 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * @author Matthias Wachs | 25 | * @author Matthias Wachs |
26 | * @author Christian Grothoff | 26 | * @author Christian Grothoff |
27 | */ | 27 | */ |
28 | |||
29 | #include "platform.h" | 28 | #include "platform.h" |
30 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_constants.h" | 30 | #include "gnunet_constants.h" |
@@ -33,7 +32,7 @@ | |||
33 | #include "gnunet_arm_service.h" | 32 | #include "gnunet_arm_service.h" |
34 | #include "gnunet_namestore_service.h" | 33 | #include "gnunet_namestore_service.h" |
35 | #include "gnunet_dnsparser_lib.h" | 34 | #include "gnunet_dnsparser_lib.h" |
36 | #include "gns_protocol.h" | 35 | #include "gnunet_tun_lib.h" |
37 | #include "namestore.h" | 36 | #include "namestore.h" |
38 | 37 | ||
39 | 38 | ||
@@ -508,10 +507,10 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
508 | size_t data_size) | 507 | size_t data_size) |
509 | { | 508 | { |
510 | uint16_t mx_pref; | 509 | uint16_t mx_pref; |
511 | const struct soa_data *soa; | 510 | const struct GNUNET_TUN_DnsSoaRecord *soa; |
512 | const struct vpn_data *vpn; | 511 | const struct GNUNET_TUN_GnsVpnRecord *vpn; |
513 | const struct srv_data *srv; | 512 | const struct GNUNET_TUN_DnsSrvRecord *srv; |
514 | const struct tlsa_data *tlsa; | 513 | const struct GNUNET_TUN_DnsTlsaRecord *tlsa; |
515 | struct GNUNET_CRYPTO_HashAsciiEncoded s_peer; | 514 | struct GNUNET_CRYPTO_HashAsciiEncoded s_peer; |
516 | const char *cdata; | 515 | const char *cdata; |
517 | char* vpn_str; | 516 | char* vpn_str; |
@@ -537,16 +536,16 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
537 | case GNUNET_DNSPARSER_TYPE_CNAME: | 536 | case GNUNET_DNSPARSER_TYPE_CNAME: |
538 | return GNUNET_strndup (data, data_size); | 537 | return GNUNET_strndup (data, data_size); |
539 | case GNUNET_DNSPARSER_TYPE_SOA: | 538 | case GNUNET_DNSPARSER_TYPE_SOA: |
540 | if (data_size <= sizeof (struct soa_data)) | 539 | if (data_size <= sizeof (struct GNUNET_TUN_DnsSoaRecord)) |
541 | return NULL; | 540 | return NULL; |
542 | soa = data; | 541 | soa = data; |
543 | soa_rname = (const char*) &soa[1]; | 542 | soa_rname = (const char*) &soa[1]; |
544 | soa_mname = memchr (soa_rname, 0, data_size - sizeof (struct soa_data) - 1); | 543 | soa_mname = memchr (soa_rname, 0, data_size - sizeof (struct GNUNET_TUN_DnsSoaRecord) - 1); |
545 | if (NULL == soa_mname) | 544 | if (NULL == soa_mname) |
546 | return NULL; | 545 | return NULL; |
547 | soa_mname++; | 546 | soa_mname++; |
548 | if (NULL == memchr (soa_mname, 0, | 547 | if (NULL == memchr (soa_mname, 0, |
549 | data_size - (sizeof (struct soa_data) + strlen (soa_rname) + 1))) | 548 | data_size - (sizeof (struct GNUNET_TUN_DnsSoaRecord) + strlen (soa_rname) + 1))) |
550 | return NULL; | 549 | return NULL; |
551 | GNUNET_asprintf (&result, | 550 | GNUNET_asprintf (&result, |
552 | "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", | 551 | "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", |
@@ -587,7 +586,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
587 | return GNUNET_strndup (data, data_size); | 586 | return GNUNET_strndup (data, data_size); |
588 | case GNUNET_NAMESTORE_TYPE_VPN: | 587 | case GNUNET_NAMESTORE_TYPE_VPN: |
589 | cdata = data; | 588 | cdata = data; |
590 | if ( (data_size <= sizeof (struct vpn_data)) || | 589 | if ( (data_size <= sizeof (struct GNUNET_TUN_GnsVpnRecord)) || |
591 | ('\0' != cdata[data_size - 1]) ) | 590 | ('\0' != cdata[data_size - 1]) ) |
592 | return NULL; /* malformed */ | 591 | return NULL; /* malformed */ |
593 | vpn = data; | 592 | vpn = data; |
@@ -603,7 +602,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
603 | return vpn_str; | 602 | return vpn_str; |
604 | case GNUNET_DNSPARSER_TYPE_SRV: | 603 | case GNUNET_DNSPARSER_TYPE_SRV: |
605 | cdata = data; | 604 | cdata = data; |
606 | if ( (data_size <= sizeof (struct srv_data)) || | 605 | if ( (data_size <= sizeof (struct GNUNET_TUN_DnsSrvRecord)) || |
607 | ('\0' != cdata[data_size - 1]) ) | 606 | ('\0' != cdata[data_size - 1]) ) |
608 | return NULL; /* malformed */ | 607 | return NULL; /* malformed */ |
609 | srv = data; | 608 | srv = data; |
@@ -621,7 +620,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
621 | return srv_str; | 620 | return srv_str; |
622 | case GNUNET_DNSPARSER_TYPE_TLSA: | 621 | case GNUNET_DNSPARSER_TYPE_TLSA: |
623 | cdata = data; | 622 | cdata = data; |
624 | if ( (data_size <= sizeof (struct tlsa_data)) || | 623 | if ( (data_size <= sizeof (struct GNUNET_TUN_DnsTlsaRecord)) || |
625 | ('\0' != cdata[data_size - 1]) ) | 624 | ('\0' != cdata[data_size - 1]) ) |
626 | return NULL; /* malformed */ | 625 | return NULL; /* malformed */ |
627 | tlsa = data; | 626 | tlsa = data; |
@@ -663,9 +662,9 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
663 | struct in_addr value_a; | 662 | struct in_addr value_a; |
664 | struct in6_addr value_aaaa; | 663 | struct in6_addr value_aaaa; |
665 | struct GNUNET_CRYPTO_EccPublicKey pkey; | 664 | struct GNUNET_CRYPTO_EccPublicKey pkey; |
666 | struct soa_data *soa; | 665 | struct GNUNET_TUN_DnsSoaRecord *soa; |
667 | struct vpn_data *vpn; | 666 | struct GNUNET_TUN_GnsVpnRecord *vpn; |
668 | struct tlsa_data *tlsa; | 667 | struct GNUNET_TUN_DnsTlsaRecord *tlsa; |
669 | char result[253 + 1]; | 668 | char result[253 + 1]; |
670 | char soa_rname[253 + 1]; | 669 | char soa_rname[253 + 1]; |
671 | char soa_mname[253 + 1]; | 670 | char soa_mname[253 + 1]; |
@@ -720,9 +719,9 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
720 | s); | 719 | s); |
721 | return GNUNET_SYSERR; | 720 | return GNUNET_SYSERR; |
722 | } | 721 | } |
723 | *data_size = sizeof (struct soa_data)+strlen(soa_rname)+strlen(soa_mname)+2; | 722 | *data_size = sizeof (struct GNUNET_TUN_DnsSoaRecord)+strlen(soa_rname)+strlen(soa_mname)+2; |
724 | *data = GNUNET_malloc (*data_size); | 723 | *data = GNUNET_malloc (*data_size); |
725 | soa = (struct soa_data*)*data; | 724 | soa = (struct GNUNET_TUN_DnsSoaRecord*)*data; |
726 | soa->serial = htonl(soa_serial); | 725 | soa->serial = htonl(soa_serial); |
727 | soa->refresh = htonl(soa_refresh); | 726 | soa->refresh = htonl(soa_refresh); |
728 | soa->retry = htonl(soa_retry); | 727 | soa->retry = htonl(soa_retry); |
@@ -795,7 +794,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
795 | s); | 794 | s); |
796 | return GNUNET_SYSERR; | 795 | return GNUNET_SYSERR; |
797 | } | 796 | } |
798 | *data_size = sizeof (struct vpn_data) + strlen (s_serv) + 1; | 797 | *data_size = sizeof (struct GNUNET_TUN_GnsVpnRecord) + strlen (s_serv) + 1; |
799 | *data = vpn = GNUNET_malloc (*data_size); | 798 | *data = vpn = GNUNET_malloc (*data_size); |
800 | if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char*)&s_peer, | 799 | if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char*)&s_peer, |
801 | &vpn->peer)) | 800 | &vpn->peer)) |
@@ -808,7 +807,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
808 | strcpy ((char*)&vpn[1], s_serv); | 807 | strcpy ((char*)&vpn[1], s_serv); |
809 | return GNUNET_OK; | 808 | return GNUNET_OK; |
810 | case GNUNET_DNSPARSER_TYPE_TLSA: | 809 | case GNUNET_DNSPARSER_TYPE_TLSA: |
811 | *data_size = sizeof (struct tlsa_data) + strlen (s) - 6; | 810 | *data_size = sizeof (struct GNUNET_TUN_DnsTlsaRecord) + strlen (s) - 6; |
812 | *data = tlsa = GNUNET_malloc (*data_size); | 811 | *data = tlsa = GNUNET_malloc (*data_size); |
813 | if (4 != SSCANF (s, "%c %c %c %s", | 812 | if (4 != SSCANF (s, "%c %c %c %s", |
814 | &tlsa->usage, | 813 | &tlsa->usage, |