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/gns/gnunet-service-gns_resolver.c | |
parent | 9e94c69b299f74ac88b14f92b7a01bba0c33a776 (diff) | |
download | gnunet-3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8.tar.gz gnunet-3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8.zip |
-eliminating duplicate struct definitions
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index a5db51db3..327986415 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -39,9 +39,7 @@ | |||
39 | #include "gnunet_dns_service.h" | 39 | #include "gnunet_dns_service.h" |
40 | #include "gnunet_resolver_service.h" | 40 | #include "gnunet_resolver_service.h" |
41 | #include "gnunet_dnsparser_lib.h" | 41 | #include "gnunet_dnsparser_lib.h" |
42 | #include "gns_protocol.h" | ||
43 | #include "gnunet_gns_service.h" | 42 | #include "gnunet_gns_service.h" |
44 | #include "gns_common.h" | ||
45 | #include "gns.h" | 43 | #include "gns.h" |
46 | #include "gnunet-service-gns_resolver.h" | 44 | #include "gnunet-service-gns_resolver.h" |
47 | #include "gnunet_vpn_service.h" | 45 | #include "gnunet_vpn_service.h" |
@@ -1168,7 +1166,7 @@ resolve_record_dns (struct ResolverHandle *rh, | |||
1168 | struct RecordLookupHandle *rlh = rh->proc_cls; | 1166 | struct RecordLookupHandle *rlh = rh->proc_cls; |
1169 | struct GNUNET_DNSPARSER_Query query; | 1167 | struct GNUNET_DNSPARSER_Query query; |
1170 | struct GNUNET_DNSPARSER_Packet packet; | 1168 | struct GNUNET_DNSPARSER_Packet packet; |
1171 | struct GNUNET_DNSPARSER_Flags flags; | 1169 | struct GNUNET_TUN_DnsFlags flags; |
1172 | struct in_addr dnsip; | 1170 | struct in_addr dnsip; |
1173 | struct sockaddr_in addr; | 1171 | struct sockaddr_in addr; |
1174 | struct sockaddr *sa; | 1172 | struct sockaddr *sa; |
@@ -1242,7 +1240,7 @@ resolve_record_dns (struct ResolverHandle *rh, | |||
1242 | } | 1240 | } |
1243 | query.name = rh->dns_name; | 1241 | query.name = rh->dns_name; |
1244 | query.type = rlh->record_type; | 1242 | query.type = rlh->record_type; |
1245 | query.class = GNUNET_DNSPARSER_CLASS_INTERNET; | 1243 | query.class = GNUNET_TUN_DNS_CLASS_INTERNET; |
1246 | memset (&flags, 0, sizeof (flags)); | 1244 | memset (&flags, 0, sizeof (flags)); |
1247 | flags.recursion_desired = 1; | 1245 | flags.recursion_desired = 1; |
1248 | flags.checking_disabled = 1; | 1246 | flags.checking_disabled = 1; |
@@ -1293,7 +1291,7 @@ resolve_record_vpn (struct ResolverHandle *rh, | |||
1293 | { | 1291 | { |
1294 | struct RecordLookupHandle *rlh = rh->proc_cls; | 1292 | struct RecordLookupHandle *rlh = rh->proc_cls; |
1295 | struct GNUNET_HashCode serv_desc; | 1293 | struct GNUNET_HashCode serv_desc; |
1296 | struct vpn_data* vpn; | 1294 | struct GNUNET_TUN_GnsVpnRecord* vpn; |
1297 | int af; | 1295 | int af; |
1298 | 1296 | ||
1299 | /* We cancel here as to not include the ns lookup in the timeout */ | 1297 | /* We cancel here as to not include the ns lookup in the timeout */ |
@@ -1313,7 +1311,7 @@ resolve_record_vpn (struct ResolverHandle *rh, | |||
1313 | rh->priv_key); | 1311 | rh->priv_key); |
1314 | } | 1312 | } |
1315 | 1313 | ||
1316 | vpn = (struct vpn_data*)rd->data; | 1314 | vpn = (struct GNUNET_TUN_GnsVpnRecord*)rd->data; |
1317 | GNUNET_CRYPTO_hash ((char*)&vpn[1], | 1315 | GNUNET_CRYPTO_hash ((char*)&vpn[1], |
1318 | strlen ((char*)&vpn[1]) + 1, | 1316 | strlen ((char*)&vpn[1]) + 1, |
1319 | &serv_desc); | 1317 | &serv_desc); |
@@ -1788,10 +1786,10 @@ finish_lookup (struct ResolverHandle *rh, | |||
1788 | char new_mx_data[MAX_MX_LENGTH]; | 1786 | char new_mx_data[MAX_MX_LENGTH]; |
1789 | char new_soa_data[MAX_SOA_LENGTH]; | 1787 | char new_soa_data[MAX_SOA_LENGTH]; |
1790 | char new_srv_data[MAX_SRV_LENGTH]; | 1788 | char new_srv_data[MAX_SRV_LENGTH]; |
1791 | struct srv_data *old_srv; | 1789 | struct GNUNET_TUN_DnsSrvRecord *old_srv; |
1792 | struct srv_data *new_srv; | 1790 | struct GNUNET_TUN_DnsSrvRecord *new_srv; |
1793 | struct soa_data *old_soa; | 1791 | struct GNUNET_TUN_DnsSoaRecord *old_soa; |
1794 | struct soa_data *new_soa; | 1792 | struct GNUNET_TUN_DnsSoaRecord *new_soa; |
1795 | struct GNUNET_NAMESTORE_RecordData p_rd[rd_count]; | 1793 | struct GNUNET_NAMESTORE_RecordData p_rd[rd_count]; |
1796 | char* repl_string; | 1794 | char* repl_string; |
1797 | char* pos; | 1795 | char* pos; |
@@ -1853,8 +1851,8 @@ finish_lookup (struct ResolverHandle *rh, | |||
1853 | /* | 1851 | /* |
1854 | * Prio, weight and port | 1852 | * Prio, weight and port |
1855 | */ | 1853 | */ |
1856 | new_srv = (struct srv_data*)new_srv_data; | 1854 | new_srv = (struct GNUNET_TUN_DnsSrvRecord*)new_srv_data; |
1857 | old_srv = (struct srv_data*)rd[i].data; | 1855 | old_srv = (struct GNUNET_TUN_DnsSrvRecord*)rd[i].data; |
1858 | new_srv->prio = old_srv->prio; | 1856 | new_srv->prio = old_srv->prio; |
1859 | new_srv->weight = old_srv->weight; | 1857 | new_srv->weight = old_srv->weight; |
1860 | new_srv->port = old_srv->port; | 1858 | new_srv->port = old_srv->port; |
@@ -1862,14 +1860,14 @@ finish_lookup (struct ResolverHandle *rh, | |||
1862 | expand_plus((char*)&new_srv[1], (char*)&old_srv[1], | 1860 | expand_plus((char*)&new_srv[1], (char*)&old_srv[1], |
1863 | repl_string); | 1861 | repl_string); |
1864 | p_rd[i].data = new_srv_data; | 1862 | p_rd[i].data = new_srv_data; |
1865 | p_rd[i].data_size = sizeof (struct srv_data) + strlen ((char*)&new_srv[1]) + 1; | 1863 | p_rd[i].data_size = sizeof (struct GNUNET_TUN_DnsSrvRecord) + strlen ((char*)&new_srv[1]) + 1; |
1866 | } | 1864 | } |
1867 | else if (GNUNET_DNSPARSER_TYPE_SOA == rd[i].record_type) | 1865 | else if (GNUNET_DNSPARSER_TYPE_SOA == rd[i].record_type) |
1868 | { | 1866 | { |
1869 | /* expand mname and rname */ | 1867 | /* expand mname and rname */ |
1870 | old_soa = (struct soa_data*)rd[i].data; | 1868 | old_soa = (struct GNUNET_TUN_DnsSoaRecord*)rd[i].data; |
1871 | new_soa = (struct soa_data*)new_soa_data; | 1869 | new_soa = (struct GNUNET_TUN_DnsSoaRecord*)new_soa_data; |
1872 | memcpy (new_soa, old_soa, sizeof (struct soa_data)); | 1870 | memcpy (new_soa, old_soa, sizeof (struct GNUNET_TUN_DnsSoaRecord)); |
1873 | // FIXME: how do we know that 'new_soa[1]' has enough space for the new name? | 1871 | // FIXME: how do we know that 'new_soa[1]' has enough space for the new name? |
1874 | expand_plus((char*)&new_soa[1], (char*)&old_soa[1], repl_string); | 1872 | expand_plus((char*)&new_soa[1], (char*)&old_soa[1], repl_string); |
1875 | offset = strlen ((char*)&new_soa[1]) + 1; | 1873 | offset = strlen ((char*)&new_soa[1]) + 1; |
@@ -1877,7 +1875,7 @@ finish_lookup (struct ResolverHandle *rh, | |||
1877 | expand_plus((char*)&new_soa[1] + offset, | 1875 | expand_plus((char*)&new_soa[1] + offset, |
1878 | (char*)&old_soa[1] + strlen ((char*)&old_soa[1]) + 1, | 1876 | (char*)&old_soa[1] + strlen ((char*)&old_soa[1]) + 1, |
1879 | repl_string); | 1877 | repl_string); |
1880 | p_rd[i].data_size = sizeof (struct soa_data) | 1878 | p_rd[i].data_size = sizeof (struct GNUNET_TUN_DnsSoaRecord) |
1881 | + offset | 1879 | + offset |
1882 | + strlen ((char*)&new_soa[1] + offset); | 1880 | + strlen ((char*)&new_soa[1] + offset); |
1883 | p_rd[i].data = new_soa_data; | 1881 | p_rd[i].data = new_soa_data; |
@@ -2889,13 +2887,13 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) | |||
2889 | query = GNUNET_new (struct GNUNET_DNSPARSER_Query); | 2887 | query = GNUNET_new (struct GNUNET_DNSPARSER_Query); |
2890 | query->name = GNUNET_strdup (ac->label); | 2888 | query->name = GNUNET_strdup (ac->label); |
2891 | query->type = rh->record_type; | 2889 | query->type = rh->record_type; |
2892 | query->class = GNUNET_DNSPARSER_CLASS_INTERNET; | 2890 | query->class = GNUNET_TUN_DNS_CLASS_INTERNET; |
2893 | p = GNUNET_new (struct GNUNET_DNSPARSER_Packet); | 2891 | p = GNUNET_new (struct GNUNET_DNSPARSER_Packet); |
2894 | p->queries = query; | 2892 | p->queries = query; |
2895 | p->num_queries = 1; | 2893 | p->num_queries = 1; |
2896 | p->id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | 2894 | p->id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, |
2897 | UINT16_MAX); | 2895 | UINT16_MAX); |
2898 | p->flags.opcode = GNUNET_DNSPARSER_OPCODE_QUERY; | 2896 | p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY; |
2899 | p->flags.recursion_desired = 1; | 2897 | p->flags.recursion_desired = 1; |
2900 | if (GNUNET_OK != | 2898 | if (GNUNET_OK != |
2901 | GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length)) | 2899 | GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length)) |