diff options
-rw-r--r-- | src/gns/gnunet-service-gns.c | 136 | ||||
-rw-r--r-- | src/gns/test_gns_simple_lookup.conf | 1 |
2 files changed, 77 insertions, 60 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 923f4e8f0..072c349da 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -66,13 +66,27 @@ struct AuthorityChain | |||
66 | int fresh; | 66 | int fresh; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | /* handle to a resolution process */ | ||
69 | struct GNUNET_GNS_ResolverHandle; | 70 | struct GNUNET_GNS_ResolverHandle; |
70 | 71 | ||
72 | /** | ||
73 | * processor for a resultion result | ||
74 | * | ||
75 | * @param cls the closure | ||
76 | * @param rh the resolution handle | ||
77 | * @param rd_count number of results | ||
78 | * @pram rd resukt data | ||
79 | */ | ||
71 | typedef void (*ResolutionResultProcessor) (void *cls, | 80 | typedef void (*ResolutionResultProcessor) (void *cls, |
72 | struct GNUNET_GNS_ResolverHandle *rh, | 81 | struct GNUNET_GNS_ResolverHandle *rh, |
73 | uint32_t rd_count, | 82 | uint32_t rd_count, |
74 | const struct GNUNET_NAMESTORE_RecordData *rd); | 83 | const struct GNUNET_NAMESTORE_RecordData *rd); |
75 | 84 | ||
85 | /** | ||
86 | * Resoltion status indicator | ||
87 | * EXISTS: the name to lookup exists | ||
88 | * EXPIRED: the name in the record expired | ||
89 | */ | ||
76 | enum ResolutionStatus | 90 | enum ResolutionStatus |
77 | { | 91 | { |
78 | EXISTS = 1, | 92 | EXISTS = 1, |
@@ -87,8 +101,6 @@ struct GNUNET_GNS_ResolverHandle | |||
87 | /* The name to resolve */ | 101 | /* The name to resolve */ |
88 | char *name; | 102 | char *name; |
89 | 103 | ||
90 | |||
91 | |||
92 | /* has this query been answered? how many matches */ | 104 | /* has this query been answered? how many matches */ |
93 | int answered; | 105 | int answered; |
94 | 106 | ||
@@ -116,9 +128,13 @@ struct GNUNET_GNS_ResolverHandle | |||
116 | /* closure passed to proc */ | 128 | /* closure passed to proc */ |
117 | void* proc_cls; | 129 | void* proc_cls; |
118 | 130 | ||
131 | /* DLL to store the authority chain */ | ||
119 | struct AuthorityChain *authority_chain_head; | 132 | struct AuthorityChain *authority_chain_head; |
120 | struct AuthorityChain *authority_chain_tail; | ||
121 | 133 | ||
134 | /* DLL to store the authority chain */ | ||
135 | struct AuthorityChain *authority_chain_tail; | ||
136 | |||
137 | /* status of the resolution result */ | ||
122 | enum ResolutionStatus status; | 138 | enum ResolutionStatus status; |
123 | 139 | ||
124 | }; | 140 | }; |
@@ -195,6 +211,7 @@ struct InterceptLookupHandle | |||
195 | struct GNUNET_DNSPARSER_Query *query; | 211 | struct GNUNET_DNSPARSER_Query *query; |
196 | }; | 212 | }; |
197 | 213 | ||
214 | |||
198 | /** | 215 | /** |
199 | * Our handle to the DNS handler library | 216 | * Our handle to the DNS handler library |
200 | */ | 217 | */ |
@@ -245,11 +262,17 @@ const char* gnunet_tld = ".gnunet"; | |||
245 | * Useful for zone update for DHT put | 262 | * Useful for zone update for DHT put |
246 | */ | 263 | */ |
247 | static int num_public_records = 3600; | 264 | static int num_public_records = 3600; |
248 | struct GNUNET_TIME_Relative dht_update_interval; | 265 | |
266 | /* dht update interval FIXME define? */ | ||
267 | static struct GNUNET_TIME_Relative dht_update_interval; | ||
268 | |||
269 | /* zone update task */ | ||
249 | GNUNET_SCHEDULER_TaskIdentifier zone_update_taskid = GNUNET_SCHEDULER_NO_TASK; | 270 | GNUNET_SCHEDULER_TaskIdentifier zone_update_taskid = GNUNET_SCHEDULER_NO_TASK; |
250 | 271 | ||
251 | /** | 272 | /** |
252 | * Helper function to free resolver handle | 273 | * Helper function to free resolver handle |
274 | * | ||
275 | * @rh the handle to free | ||
253 | */ | 276 | */ |
254 | static void | 277 | static void |
255 | free_resolver_handle(struct GNUNET_GNS_ResolverHandle* rh) | 278 | free_resolver_handle(struct GNUNET_GNS_ResolverHandle* rh) |
@@ -277,8 +300,9 @@ free_resolver_handle(struct GNUNET_GNS_ResolverHandle* rh) | |||
277 | 300 | ||
278 | 301 | ||
279 | /** | 302 | /** |
280 | * Reply to client with the result from our lookup. | 303 | * Reply to dns request with the result from our lookup. |
281 | * | 304 | * |
305 | * @param cls the closure to the request (an InterceptLookupHandle) | ||
282 | * @param rh the request handle of the lookup | 306 | * @param rh the request handle of the lookup |
283 | * @param rd_count the number of records to return | 307 | * @param rd_count the number of records to return |
284 | * @param rd the record data | 308 | * @param rd the record data |
@@ -414,6 +438,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
414 | GNUNET_DHT_disconnect(dht_handle); | 438 | GNUNET_DHT_disconnect(dht_handle); |
415 | } | 439 | } |
416 | 440 | ||
441 | |||
417 | /** | 442 | /** |
418 | * Callback when record data is put into namestore | 443 | * Callback when record data is put into namestore |
419 | * | 444 | * |
@@ -442,6 +467,7 @@ on_namestore_record_put_result(void *cls, | |||
442 | "Error putting records into namestore: %s\n", emsg); | 467 | "Error putting records into namestore: %s\n", emsg); |
443 | } | 468 | } |
444 | 469 | ||
470 | |||
445 | /** | 471 | /** |
446 | * Handle timeout for DHT requests | 472 | * Handle timeout for DHT requests |
447 | * | 473 | * |
@@ -462,10 +488,9 @@ dht_lookup_timeout(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
462 | } | 488 | } |
463 | 489 | ||
464 | 490 | ||
465 | |||
466 | /** | 491 | /** |
467 | * Function called when we get a result from the dht | 492 | * Function called when we get a result from the dht |
468 | * for our query | 493 | * for our record query |
469 | * | 494 | * |
470 | * @param cls the request handle | 495 | * @param cls the request handle |
471 | * @param exp lifetime | 496 | * @param exp lifetime |
@@ -585,10 +610,9 @@ process_record_dht_result(void* cls, | |||
585 | * rh->authority's zone | 610 | * rh->authority's zone |
586 | * | 611 | * |
587 | * @param rh the pending gns query context | 612 | * @param rh the pending gns query context |
588 | * @param name the name to query record | ||
589 | */ | 613 | */ |
590 | static void | 614 | static void |
591 | resolve_record_from_dht(struct GNUNET_GNS_ResolverHandle *rh) | 615 | resolve_record_dht(struct GNUNET_GNS_ResolverHandle *rh) |
592 | { | 616 | { |
593 | uint32_t xquery; | 617 | uint32_t xquery; |
594 | GNUNET_HashCode name_hash; | 618 | GNUNET_HashCode name_hash; |
@@ -673,8 +697,6 @@ process_record_lookup_ns(void* cls, | |||
673 | */ | 697 | */ |
674 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 698 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
675 | "Namestore lookup for %s terminated without results\n", name); | 699 | "Namestore lookup for %s terminated without results\n", name); |
676 | |||
677 | |||
678 | 700 | ||
679 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 701 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
680 | "Record %s unknown in namestore\n", | 702 | "Record %s unknown in namestore\n", |
@@ -727,16 +749,19 @@ process_record_lookup_ns(void* cls, | |||
727 | } | 749 | } |
728 | } | 750 | } |
729 | 751 | ||
752 | |||
730 | /** | 753 | /** |
731 | * The final phase of resolution. | 754 | * The final phase of resolution. |
732 | * This is a name that is canonical and we do not have a delegation. | 755 | * rh->name is a name that is canonical and we do not have a delegation. |
756 | * Query namestore for this record | ||
733 | * | 757 | * |
734 | * @param rh the pending lookup | 758 | * @param rh the pending lookup |
735 | */ | 759 | */ |
736 | static void | 760 | static void |
737 | resolve_record_from_ns(struct GNUNET_GNS_ResolverHandle *rh) | 761 | resolve_record_ns(struct GNUNET_GNS_ResolverHandle *rh) |
738 | { | 762 | { |
739 | struct RecordLookupHandle *rlh = (struct RecordLookupHandle *)rh->proc_cls; | 763 | struct RecordLookupHandle *rlh = (struct RecordLookupHandle *)rh->proc_cls; |
764 | |||
740 | /** | 765 | /** |
741 | * Try to resolve this record in our namestore. | 766 | * Try to resolve this record in our namestore. |
742 | * The name to resolve is now in rh->authority_name | 767 | * The name to resolve is now in rh->authority_name |
@@ -749,7 +774,6 @@ resolve_record_from_ns(struct GNUNET_GNS_ResolverHandle *rh) | |||
749 | rlh->record_type, | 774 | rlh->record_type, |
750 | &process_record_lookup_ns, | 775 | &process_record_lookup_ns, |
751 | rh); | 776 | rh); |
752 | |||
753 | } | 777 | } |
754 | 778 | ||
755 | 779 | ||
@@ -780,12 +804,12 @@ dht_authority_lookup_timeout(void *cls, | |||
780 | rh->proc(rh->proc_cls, rh, 0, NULL); | 804 | rh->proc(rh->proc_cls, rh, 0, NULL); |
781 | } | 805 | } |
782 | 806 | ||
783 | // Prototype | 807 | /* Prototype */ |
784 | static void resolve_delegation_from_dht(struct GNUNET_GNS_ResolverHandle *rh); | 808 | static void resolve_delegation_dht(struct GNUNET_GNS_ResolverHandle *rh); |
785 | 809 | ||
786 | /** | 810 | /** |
787 | * Function called when we get a result from the dht | 811 | * Function called when we get a result from the dht |
788 | * for our query. Recursively tries to resolve PKEYs | 812 | * for our query. Recursively tries to resolve authorities |
789 | * for name in DHT. | 813 | * for name in DHT. |
790 | * | 814 | * |
791 | * @param cls the request handle | 815 | * @param cls the request handle |
@@ -800,7 +824,7 @@ static void resolve_delegation_from_dht(struct GNUNET_GNS_ResolverHandle *rh); | |||
800 | * @param data the record data | 824 | * @param data the record data |
801 | */ | 825 | */ |
802 | static void | 826 | static void |
803 | process_authority_dht_result(void* cls, | 827 | process_delegation_result_dht(void* cls, |
804 | struct GNUNET_TIME_Absolute exp, | 828 | struct GNUNET_TIME_Absolute exp, |
805 | const GNUNET_HashCode * key, | 829 | const GNUNET_HashCode * key, |
806 | const struct GNUNET_PeerIdentity *get_path, | 830 | const struct GNUNET_PeerIdentity *get_path, |
@@ -905,11 +929,14 @@ process_authority_dht_result(void* cls, | |||
905 | if (rh->answered) | 929 | if (rh->answered) |
906 | { | 930 | { |
907 | rh->answered = 0; | 931 | rh->answered = 0; |
908 | /* delegate */ | 932 | /** |
933 | * delegate | ||
934 | * FIXME in this case. should we ask namestore again? | ||
935 | */ | ||
909 | if (strcmp(rh->name, "") == 0) | 936 | if (strcmp(rh->name, "") == 0) |
910 | rh->proc(rh->proc_cls, rh, 0, NULL); | 937 | rh->proc(rh->proc_cls, rh, 0, NULL); |
911 | else | 938 | else |
912 | resolve_delegation_from_dht(rh); | 939 | resolve_delegation_dht(rh); |
913 | return; | 940 | return; |
914 | } | 941 | } |
915 | 942 | ||
@@ -917,7 +944,6 @@ process_authority_dht_result(void* cls, | |||
917 | * should never get here unless false dht key/put | 944 | * should never get here unless false dht key/put |
918 | * block plugin should handle this | 945 | * block plugin should handle this |
919 | **/ | 946 | **/ |
920 | |||
921 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DHT authority lookup error!\n"); | 947 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DHT authority lookup error!\n"); |
922 | GNUNET_break(0); | 948 | GNUNET_break(0); |
923 | } | 949 | } |
@@ -945,7 +971,6 @@ process_record_result_dht(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
945 | rh->name); | 971 | rh->name); |
946 | /* give up, cannot resolve */ | 972 | /* give up, cannot resolve */ |
947 | rlh->proc(rlh->proc_cls, rh, 0, NULL); | 973 | rlh->proc(rlh->proc_cls, rh, 0, NULL); |
948 | //reply_to_dns(NULL, rh, 0, NULL); | ||
949 | return; | 974 | return; |
950 | } | 975 | } |
951 | 976 | ||
@@ -953,7 +978,6 @@ process_record_result_dht(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
953 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 978 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
954 | "Record resolved from namestore!"); | 979 | "Record resolved from namestore!"); |
955 | rlh->proc(rlh->proc_cls, rh, rd_count, rd); | 980 | rlh->proc(rlh->proc_cls, rh, rd_count, rd); |
956 | //reply_to_dns(NULL, rh, rd_count, rd); | ||
957 | 981 | ||
958 | } | 982 | } |
959 | 983 | ||
@@ -979,12 +1003,11 @@ process_record_result_ns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
979 | if (rh->status & (EXPIRED | !EXISTS)) | 1003 | if (rh->status & (EXPIRED | !EXISTS)) |
980 | { | 1004 | { |
981 | rh->proc = &process_record_result_dht; | 1005 | rh->proc = &process_record_result_dht; |
982 | resolve_record_from_dht(rh); | 1006 | resolve_record_dht(rh); |
983 | return; | 1007 | return; |
984 | } | 1008 | } |
985 | /* give up, cannot resolve */ | 1009 | /* give up, cannot resolve */ |
986 | rlh->proc(rlh->proc_cls, rh, 0, NULL); | 1010 | rlh->proc(rlh->proc_cls, rh, 0, NULL); |
987 | //reply_to_dns(NULL, rh, 0, NULL); | ||
988 | return; | 1011 | return; |
989 | } | 1012 | } |
990 | 1013 | ||
@@ -992,7 +1015,6 @@ process_record_result_ns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
992 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1015 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
993 | "Record resolved from namestore!"); | 1016 | "Record resolved from namestore!"); |
994 | rlh->proc(rlh->proc_cls, rh, rd_count, rd); | 1017 | rlh->proc(rlh->proc_cls, rh, rd_count, rd); |
995 | //reply_to_dns(NULL, rh, rd_count, rd); | ||
996 | 1018 | ||
997 | } | 1019 | } |
998 | 1020 | ||
@@ -1063,7 +1085,7 @@ pop_tld(char* name, char* dest) | |||
1063 | * @param rd record data (always NULL) | 1085 | * @param rd record data (always NULL) |
1064 | */ | 1086 | */ |
1065 | static void | 1087 | static void |
1066 | process_dht_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | 1088 | process_delegation_dht(void* cls, struct GNUNET_GNS_ResolverHandle *rh, |
1067 | unsigned int rd_count, | 1089 | unsigned int rd_count, |
1068 | const struct GNUNET_NAMESTORE_RecordData *rd) | 1090 | const struct GNUNET_NAMESTORE_RecordData *rd) |
1069 | { | 1091 | { |
@@ -1076,7 +1098,7 @@ process_dht_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1076 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1098 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1077 | "Resolved full name for delegation via DHT. resolving record '' in ns\n"); | 1099 | "Resolved full name for delegation via DHT. resolving record '' in ns\n"); |
1078 | rh->proc = &process_record_result_ns; | 1100 | rh->proc = &process_record_result_ns; |
1079 | resolve_record_from_ns(rh); | 1101 | resolve_record_ns(rh); |
1080 | return; | 1102 | return; |
1081 | } | 1103 | } |
1082 | 1104 | ||
@@ -1088,7 +1110,7 @@ process_dht_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1088 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1110 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1089 | "Resolving canonical record %s in ns\n", rh->name); | 1111 | "Resolving canonical record %s in ns\n", rh->name); |
1090 | rh->proc = &process_record_result_ns; | 1112 | rh->proc = &process_record_result_ns; |
1091 | resolve_record_from_ns(rh); | 1113 | resolve_record_ns(rh); |
1092 | return; | 1114 | return; |
1093 | } | 1115 | } |
1094 | /* give up, cannot resolve */ | 1116 | /* give up, cannot resolve */ |
@@ -1096,7 +1118,6 @@ process_dht_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1096 | "Cannot fully resolve delegation for %s via DHT!\n", | 1118 | "Cannot fully resolve delegation for %s via DHT!\n", |
1097 | rh->name); | 1119 | rh->name); |
1098 | rlh->proc(rlh->proc_cls, rh, 0, NULL); | 1120 | rlh->proc(rlh->proc_cls, rh, 0, NULL); |
1099 | //reply_to_dns(NULL, rh, 0, NULL); | ||
1100 | } | 1121 | } |
1101 | 1122 | ||
1102 | 1123 | ||
@@ -1108,7 +1129,7 @@ process_dht_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1108 | * @param name the name of the PKEY record | 1129 | * @param name the name of the PKEY record |
1109 | */ | 1130 | */ |
1110 | static void | 1131 | static void |
1111 | resolve_delegation_from_dht(struct GNUNET_GNS_ResolverHandle *rh) | 1132 | resolve_delegation_dht(struct GNUNET_GNS_ResolverHandle *rh) |
1112 | { | 1133 | { |
1113 | uint32_t xquery; | 1134 | uint32_t xquery; |
1114 | GNUNET_HashCode name_hash; | 1135 | GNUNET_HashCode name_hash; |
@@ -1133,7 +1154,7 @@ resolve_delegation_from_dht(struct GNUNET_GNS_ResolverHandle *rh) | |||
1133 | GNUNET_DHT_RO_NONE, | 1154 | GNUNET_DHT_RO_NONE, |
1134 | &xquery, | 1155 | &xquery, |
1135 | sizeof(xquery), | 1156 | sizeof(xquery), |
1136 | &process_authority_dht_result, | 1157 | &process_delegation_result_dht, |
1137 | rh); | 1158 | rh); |
1138 | 1159 | ||
1139 | } | 1160 | } |
@@ -1148,7 +1169,7 @@ resolve_delegation_from_dht(struct GNUNET_GNS_ResolverHandle *rh) | |||
1148 | * @param rd record data (always NULL) | 1169 | * @param rd record data (always NULL) |
1149 | */ | 1170 | */ |
1150 | static void | 1171 | static void |
1151 | process_ns_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | 1172 | process_delegation_ns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, |
1152 | unsigned int rd_count, | 1173 | unsigned int rd_count, |
1153 | const struct GNUNET_NAMESTORE_RecordData *rd) | 1174 | const struct GNUNET_NAMESTORE_RecordData *rd) |
1154 | { | 1175 | { |
@@ -1161,7 +1182,7 @@ process_ns_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1161 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1182 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1162 | "Resolved full name for delegation. resolving record ''\n"); | 1183 | "Resolved full name for delegation. resolving record ''\n"); |
1163 | rh->proc = &process_record_result_ns; | 1184 | rh->proc = &process_record_result_ns; |
1164 | resolve_record_from_ns(rh); | 1185 | resolve_record_ns(rh); |
1165 | return; | 1186 | return; |
1166 | } | 1187 | } |
1167 | 1188 | ||
@@ -1176,7 +1197,7 @@ process_ns_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1176 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1197 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1177 | "Resolving canonical record %s\n", rh->name); | 1198 | "Resolving canonical record %s\n", rh->name); |
1178 | rh->proc = &process_record_result_ns; | 1199 | rh->proc = &process_record_result_ns; |
1179 | resolve_record_from_ns(rh); | 1200 | resolve_record_ns(rh); |
1180 | } | 1201 | } |
1181 | else | 1202 | else |
1182 | { | 1203 | { |
@@ -1185,7 +1206,6 @@ process_ns_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1185 | "Cannot fully resolve delegation for %s!\n", | 1206 | "Cannot fully resolve delegation for %s!\n", |
1186 | rh->name); | 1207 | rh->name); |
1187 | rlh->proc(rlh->proc_cls, rh, 0, NULL); | 1208 | rlh->proc(rlh->proc_cls, rh, 0, NULL); |
1188 | //reply_to_dns(NULL, rh, 0, NULL); | ||
1189 | } | 1209 | } |
1190 | return; | 1210 | return; |
1191 | } | 1211 | } |
@@ -1193,12 +1213,12 @@ process_ns_delegation_dns(void* cls, struct GNUNET_GNS_ResolverHandle *rh, | |||
1193 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1213 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1194 | "Trying to resolve delegation for %s via DHT\n", | 1214 | "Trying to resolve delegation for %s via DHT\n", |
1195 | rh->name); | 1215 | rh->name); |
1196 | rh->proc = &process_dht_delegation_dns; | 1216 | rh->proc = &process_delegation_dht; |
1197 | resolve_delegation_from_dht(rh); | 1217 | resolve_delegation_dht(rh); |
1198 | } | 1218 | } |
1199 | 1219 | ||
1200 | //Prototype | 1220 | //Prototype |
1201 | static void resolve_delegation_from_ns(struct GNUNET_GNS_ResolverHandle *rh); | 1221 | static void resolve_delegation_ns(struct GNUNET_GNS_ResolverHandle *rh); |
1202 | 1222 | ||
1203 | /** | 1223 | /** |
1204 | * This is a callback function that should give us only PKEY | 1224 | * This is a callback function that should give us only PKEY |
@@ -1215,7 +1235,7 @@ static void resolve_delegation_from_ns(struct GNUNET_GNS_ResolverHandle *rh); | |||
1215 | * @param signature the signature of the authority for the record data | 1235 | * @param signature the signature of the authority for the record data |
1216 | */ | 1236 | */ |
1217 | static void | 1237 | static void |
1218 | process_authority_lookup_ns(void* cls, | 1238 | process_delegation_result_ns(void* cls, |
1219 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, | 1239 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, |
1220 | struct GNUNET_TIME_Absolute expiration, | 1240 | struct GNUNET_TIME_Absolute expiration, |
1221 | const char *name, | 1241 | const char *name, |
@@ -1338,7 +1358,7 @@ process_authority_lookup_ns(void* cls, | |||
1338 | if (strcmp(rh->name, "") == 0) | 1358 | if (strcmp(rh->name, "") == 0) |
1339 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1359 | rh->proc(rh->proc_cls, rh, 0, NULL); |
1340 | else | 1360 | else |
1341 | resolve_delegation_from_ns(rh); | 1361 | resolve_delegation_ns(rh); |
1342 | return; | 1362 | return; |
1343 | } | 1363 | } |
1344 | 1364 | ||
@@ -1352,12 +1372,12 @@ process_authority_lookup_ns(void* cls, | |||
1352 | 1372 | ||
1353 | 1373 | ||
1354 | /** | 1374 | /** |
1355 | * Resolve the delegation chain for the request | 1375 | * Resolve the delegation chain for the request in our namestore |
1356 | * | 1376 | * |
1357 | * @param rh the resolver handle | 1377 | * @param rh the resolver handle |
1358 | */ | 1378 | */ |
1359 | static void | 1379 | static void |
1360 | resolve_delegation_from_ns(struct GNUNET_GNS_ResolverHandle *rh) | 1380 | resolve_delegation_ns(struct GNUNET_GNS_ResolverHandle *rh) |
1361 | { | 1381 | { |
1362 | 1382 | ||
1363 | pop_tld(rh->name, rh->authority_name); | 1383 | pop_tld(rh->name, rh->authority_name); |
@@ -1365,7 +1385,7 @@ resolve_delegation_from_ns(struct GNUNET_GNS_ResolverHandle *rh) | |||
1365 | &rh->authority, | 1385 | &rh->authority, |
1366 | rh->authority_name, | 1386 | rh->authority_name, |
1367 | GNUNET_GNS_RECORD_PKEY, | 1387 | GNUNET_GNS_RECORD_PKEY, |
1368 | &process_authority_lookup_ns, | 1388 | &process_delegation_result_ns, |
1369 | rh); | 1389 | rh); |
1370 | 1390 | ||
1371 | } | 1391 | } |
@@ -1379,7 +1399,7 @@ resolve_delegation_from_ns(struct GNUNET_GNS_ResolverHandle *rh) | |||
1379 | * @param q the DNS query we received parsed from p | 1399 | * @param q the DNS query we received parsed from p |
1380 | */ | 1400 | */ |
1381 | static void | 1401 | static void |
1382 | start_resolution_from_dns(struct GNUNET_DNS_RequestHandle *request, | 1402 | start_resolution_for_dns(struct GNUNET_DNS_RequestHandle *request, |
1383 | struct GNUNET_DNSPARSER_Packet *p, | 1403 | struct GNUNET_DNSPARSER_Packet *p, |
1384 | struct GNUNET_DNSPARSER_Query *q) | 1404 | struct GNUNET_DNSPARSER_Query *q) |
1385 | { | 1405 | { |
@@ -1407,7 +1427,6 @@ start_resolution_from_dns(struct GNUNET_DNS_RequestHandle *request, | |||
1407 | 1427 | ||
1408 | rh->proc_cls = rlh; | 1428 | rh->proc_cls = rlh; |
1409 | 1429 | ||
1410 | rh->authority = zone_hash; | ||
1411 | rh->name = GNUNET_malloc(strlen(q->name) | 1430 | rh->name = GNUNET_malloc(strlen(q->name) |
1412 | - strlen(gnunet_tld) + 1); | 1431 | - strlen(gnunet_tld) + 1); |
1413 | memset(rh->name, 0, | 1432 | memset(rh->name, 0, |
@@ -1424,8 +1443,8 @@ start_resolution_from_dns(struct GNUNET_DNS_RequestHandle *request, | |||
1424 | rh->authority_chain_head->zone = zone_hash; | 1443 | rh->authority_chain_head->zone = zone_hash; |
1425 | 1444 | ||
1426 | /* Start resolution in our zone */ | 1445 | /* Start resolution in our zone */ |
1427 | rh->proc = &process_ns_delegation_dns; | 1446 | rh->proc = &process_delegation_ns; |
1428 | resolve_delegation_from_ns(rh); | 1447 | resolve_delegation_ns(rh); |
1429 | } | 1448 | } |
1430 | 1449 | ||
1431 | 1450 | ||
@@ -1503,7 +1522,7 @@ handle_dns_request(void *cls, | |||
1503 | 1522 | ||
1504 | if ((i==strlen(gnunet_tld)-1) && (0 == strcmp(tldoffset-i, gnunet_tld))) | 1523 | if ((i==strlen(gnunet_tld)-1) && (0 == strcmp(tldoffset-i, gnunet_tld))) |
1505 | { | 1524 | { |
1506 | start_resolution_from_dns(rh, p, p->queries); | 1525 | start_resolution_for_dns(rh, p, p->queries); |
1507 | } | 1526 | } |
1508 | else | 1527 | else |
1509 | { | 1528 | { |
@@ -1724,10 +1743,9 @@ process_shorten_pseu_lookup_ns(void *cls, | |||
1724 | * rh->authority's zone | 1743 | * rh->authority's zone |
1725 | * | 1744 | * |
1726 | * @param rh the pending gns query | 1745 | * @param rh the pending gns query |
1727 | * @param name the name of the PKEY record | ||
1728 | */ | 1746 | */ |
1729 | static void | 1747 | static void |
1730 | resolve_pseu_from_dht(struct GNUNET_GNS_ResolverHandle *rh) | 1748 | resolve_pseu_dht(struct GNUNET_GNS_ResolverHandle *rh) |
1731 | { | 1749 | { |
1732 | uint32_t xquery; | 1750 | uint32_t xquery; |
1733 | GNUNET_HashCode name_hash; | 1751 | GNUNET_HashCode name_hash; |
@@ -1754,7 +1772,7 @@ resolve_pseu_from_dht(struct GNUNET_GNS_ResolverHandle *rh) | |||
1754 | GNUNET_DHT_RO_NONE, | 1772 | GNUNET_DHT_RO_NONE, |
1755 | &xquery, | 1773 | &xquery, |
1756 | sizeof(xquery), | 1774 | sizeof(xquery), |
1757 | &process_authority_dht_result, | 1775 | &process_delegation_result_dht, |
1758 | rh); | 1776 | rh); |
1759 | 1777 | ||
1760 | } | 1778 | } |
@@ -2024,7 +2042,7 @@ handle_shorten_pseu_ns_result(void* cls, | |||
2024 | */ | 2042 | */ |
2025 | rh->authority = rh->authority_chain_head->zone; | 2043 | rh->authority = rh->authority_chain_head->zone; |
2026 | rh->proc = &handle_shorten_pseu_dht_result; | 2044 | rh->proc = &handle_shorten_pseu_dht_result; |
2027 | resolve_pseu_from_dht(rh); | 2045 | resolve_pseu_dht(rh); |
2028 | 2046 | ||
2029 | } | 2047 | } |
2030 | 2048 | ||
@@ -2103,8 +2121,7 @@ typedef void (*ShortenResponseProc) (void* cls, const char* name); | |||
2103 | * Shorten a given name | 2121 | * Shorten a given name |
2104 | * | 2122 | * |
2105 | * @param name the name to shorten | 2123 | * @param name the name to shorten |
2106 | * @param proc the processor to call when finished | 2124 | * @param csh the shorten handle of the request |
2107 | * @praram cls the closure to the processor | ||
2108 | */ | 2125 | */ |
2109 | static void | 2126 | static void |
2110 | shorten_name(char* name, struct ClientShortenHandle* csh) | 2127 | shorten_name(char* name, struct ClientShortenHandle* csh) |
@@ -2142,16 +2159,15 @@ shorten_name(char* name, struct ClientShortenHandle* csh) | |||
2142 | rh->proc_cls = (void*)csh; | 2159 | rh->proc_cls = (void*)csh; |
2143 | 2160 | ||
2144 | /* Start delegation resolution in our namestore */ | 2161 | /* Start delegation resolution in our namestore */ |
2145 | resolve_delegation_from_ns(rh); | 2162 | resolve_delegation_ns(rh); |
2146 | 2163 | ||
2147 | } | 2164 | } |
2148 | 2165 | ||
2149 | /** | 2166 | /** |
2150 | * Send shorten response back to client | 2167 | * Send shorten response back to client |
2151 | * FIXME this is without .gnunet! | ||
2152 | * | 2168 | * |
2153 | * @param cls the client handle in closure | ||
2154 | * @param name the shortened name result or NULL if cannot be shortened | 2169 | * @param name the shortened name result or NULL if cannot be shortened |
2170 | * @param csh the handle to the shorten request | ||
2155 | */ | 2171 | */ |
2156 | static void | 2172 | static void |
2157 | send_shorten_response(const char* name, struct ClientShortenHandle *csh) | 2173 | send_shorten_response(const char* name, struct ClientShortenHandle *csh) |
@@ -2321,8 +2337,8 @@ lookup_name(char* name, struct ClientLookupHandle* clh) | |||
2321 | rh->authority_chain_head->zone = zone_hash; | 2337 | rh->authority_chain_head->zone = zone_hash; |
2322 | 2338 | ||
2323 | /* Start resolution in our zone */ | 2339 | /* Start resolution in our zone */ |
2324 | rh->proc = &process_ns_delegation_dns; //FIXME rename | 2340 | rh->proc = &process_delegation_ns; |
2325 | resolve_delegation_from_ns(rh); | 2341 | resolve_delegation_ns(rh); |
2326 | } | 2342 | } |
2327 | 2343 | ||
2328 | 2344 | ||
diff --git a/src/gns/test_gns_simple_lookup.conf b/src/gns/test_gns_simple_lookup.conf index da61f3d25..96ad5ed3f 100644 --- a/src/gns/test_gns_simple_lookup.conf +++ b/src/gns/test_gns_simple_lookup.conf | |||
@@ -71,6 +71,7 @@ AUTOSTART = YES | |||
71 | DNS_EXIT = 8.8.8.8 | 71 | DNS_EXIT = 8.8.8.8 |
72 | 72 | ||
73 | [gns] | 73 | [gns] |
74 | PREFIX = valgrind -v --leak-check=full --track-origins=yes | ||
74 | AUTOSTART = YES | 75 | AUTOSTART = YES |
75 | BINARY = gnunet-service-gns | 76 | BINARY = gnunet-service-gns |
76 | ZONEKEY = zonekey | 77 | ZONEKEY = zonekey |