diff options
-rwxr-xr-x | contrib/gnunet-gns-import.sh | 2 | ||||
-rw-r--r-- | src/include/gnunet_namestore_plugin.h | 8 | ||||
-rw-r--r-- | src/include/gnunet_namestore_service.h | 11 | ||||
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 9 | ||||
-rw-r--r-- | src/namestore/namestore.h | 2 | ||||
-rw-r--r-- | src/namestore/namestore_api.c | 20 | ||||
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 2 |
7 files changed, 31 insertions, 23 deletions
diff --git a/contrib/gnunet-gns-import.sh b/contrib/gnunet-gns-import.sh index e0956ffcd..eb1a4defa 100755 --- a/contrib/gnunet-gns-import.sh +++ b/contrib/gnunet-gns-import.sh | |||
@@ -3,7 +3,7 @@ | |||
3 | # namestore. | 3 | # namestore. |
4 | # | 4 | # |
5 | # By default, we create three GNS zones: | 5 | # By default, we create three GNS zones: |
6 | gnunet-identity -C master-zone | 6 | gnunet-identity -C master-zone |
7 | gnunet-identity -C short-zone | 7 | gnunet-identity -C short-zone |
8 | gnunet-identity -C private-zone | 8 | gnunet-identity -C private-zone |
9 | 9 | ||
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index 5ab374ed0..c40d95451 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h | |||
@@ -95,7 +95,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
95 | * @param cls closure (internal context for the plugin) | 95 | * @param cls closure (internal context for the plugin) |
96 | * @param query hash of public key derived from the zone and the label | 96 | * @param query hash of public key derived from the zone and the label |
97 | * @param iter function to call with the result | 97 | * @param iter function to call with the result |
98 | * @param iter_cls closure for iter | 98 | * @param iter_cls closure for @a iter |
99 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error | 99 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
100 | */ | 100 | */ |
101 | int (*lookup_block) (void *cls, | 101 | int (*lookup_block) (void *cls, |
@@ -127,10 +127,10 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
127 | * datastore. Will return at most one result to the iterator. | 127 | * datastore. Will return at most one result to the iterator. |
128 | * | 128 | * |
129 | * @param cls closure (internal context for the plugin) | 129 | * @param cls closure (internal context for the plugin) |
130 | * @param zone private key of the zone | 130 | * @param zone private key of the zone, NULL for all zones |
131 | * @param offset offset in the list of all matching records | 131 | * @param offset offset in the list of all matching records |
132 | * @param iter function to call with the result | 132 | * @param iter function to call with the result |
133 | * @param iter_cls closure for iter | 133 | * @param iter_cls closure for @a iter |
134 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error | 134 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
135 | */ | 135 | */ |
136 | int (*iterate_records) (void *cls, | 136 | int (*iterate_records) (void *cls, |
@@ -147,7 +147,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
147 | * @param zone private key of the zone to look up in, never NULL | 147 | * @param zone private key of the zone to look up in, never NULL |
148 | * @param value_zone public key of the target zone (value), never NULL | 148 | * @param value_zone public key of the target zone (value), never NULL |
149 | * @param iter function to call with the result | 149 | * @param iter function to call with the result |
150 | * @param iter_cls closure for iter | 150 | * @param iter_cls closure for @a iter |
151 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error | 151 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
152 | */ | 152 | */ |
153 | int (*zone_to_name) (void *cls, | 153 | int (*zone_to_name) (void *cls, |
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 759b53581..0f6730d62 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -393,15 +393,18 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | |||
393 | 393 | ||
394 | /** | 394 | /** |
395 | * Starts a new zone iteration (used to periodically PUT all of our | 395 | * Starts a new zone iteration (used to periodically PUT all of our |
396 | * records into our DHT). @a proc will be called once immediately, and | 396 | * records into our DHT). This MUST lock the struct GNUNET_NAMESTORE_Handle |
397 | * then again after #GNUNET_NAMESTORE_zone_iterator_next is invoked. | 397 | * for any other calls than #GNUNET_NAMESTORE_zone_iterator_next and |
398 | * #GNUNET_NAMESTORE_zone_iteration_stop. @a proc will be called once | ||
399 | * immediately, and then again after | ||
400 | * #GNUNET_NAMESTORE_zone_iterator_next is invoked. | ||
398 | * | 401 | * |
399 | * @param h handle to the namestore | 402 | * @param h handle to the namestore |
400 | * @param zone zone to access | 403 | * @param zone zone to access, NULL for all zones |
401 | * @param proc function to call on each name from the zone; it | 404 | * @param proc function to call on each name from the zone; it |
402 | * will be called repeatedly with a value (if available) | 405 | * will be called repeatedly with a value (if available) |
403 | * and always once at the end with a name of NULL. | 406 | * and always once at the end with a name of NULL. |
404 | * @param proc_cls closure for proc | 407 | * @param proc_cls closure for @a proc |
405 | * @return an iterator handle to use for iteration | 408 | * @return an iterator handle to use for iteration |
406 | */ | 409 | */ |
407 | struct GNUNET_NAMESTORE_ZoneIterator * | 410 | struct GNUNET_NAMESTORE_ZoneIterator * |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 194ceaa04..a1ce120d8 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -862,7 +862,7 @@ enum ZoneIterationResult | |||
862 | 862 | ||
863 | /** | 863 | /** |
864 | * Context for record remove operations passed from | 864 | * Context for record remove operations passed from |
865 | * 'run_zone_iteration_round' to 'zone_iteraterate_proc' as closure | 865 | * #run_zone_iteration_round to #zone_iteraterate_proc as closure |
866 | */ | 866 | */ |
867 | struct ZoneIterationProcResult | 867 | struct ZoneIterationProcResult |
868 | { | 868 | { |
@@ -934,6 +934,7 @@ zone_iteraterate_proc (void *cls, | |||
934 | static void | 934 | static void |
935 | run_zone_iteration_round (struct ZoneIteration *zi) | 935 | run_zone_iteration_round (struct ZoneIteration *zi) |
936 | { | 936 | { |
937 | static struct GNUNET_CRYPTO_EccPrivateKey zero; | ||
937 | struct ZoneIterationProcResult proc; | 938 | struct ZoneIterationProcResult proc; |
938 | struct RecordResultMessage rrm; | 939 | struct RecordResultMessage rrm; |
939 | int ret; | 940 | int ret; |
@@ -945,7 +946,9 @@ run_zone_iteration_round (struct ZoneIteration *zi) | |||
945 | { | 946 | { |
946 | if (GNUNET_SYSERR == | 947 | if (GNUNET_SYSERR == |
947 | (ret = GSN_database->iterate_records (GSN_database->cls, | 948 | (ret = GSN_database->iterate_records (GSN_database->cls, |
948 | &zi->zone, | 949 | (0 == memcmp (&zi->zone, &zero, sizeof (zero))) |
950 | ? NULL | ||
951 | : &zi->zone, | ||
949 | zi->offset, | 952 | zi->offset, |
950 | &zone_iteraterate_proc, &proc))) | 953 | &zone_iteraterate_proc, &proc))) |
951 | { | 954 | { |
@@ -982,7 +985,7 @@ run_zone_iteration_round (struct ZoneIteration *zi) | |||
982 | * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START message | 985 | * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START message |
983 | * | 986 | * |
984 | * @param cls unused | 987 | * @param cls unused |
985 | * @param client GNUNET_SERVER_Client sending the message | 988 | * @param client the client sending the message |
986 | * @param message message of type 'struct ZoneIterationStartMessage' | 989 | * @param message message of type 'struct ZoneIterationStartMessage' |
987 | */ | 990 | */ |
988 | static void | 991 | static void |
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index d54ab12a8..7d406df61 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h | |||
@@ -347,7 +347,7 @@ struct ZoneIterationStartMessage | |||
347 | struct GNUNET_NAMESTORE_Header gns_header; | 347 | struct GNUNET_NAMESTORE_Header gns_header; |
348 | 348 | ||
349 | /** | 349 | /** |
350 | * Zone key. | 350 | * Zone key. All zeros for "all zones". |
351 | */ | 351 | */ |
352 | struct GNUNET_CRYPTO_EccPrivateKey zone; | 352 | struct GNUNET_CRYPTO_EccPrivateKey zone; |
353 | 353 | ||
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 112b71ba8..9e2e13066 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -1185,18 +1185,18 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | |||
1185 | 1185 | ||
1186 | /** | 1186 | /** |
1187 | * Starts a new zone iteration (used to periodically PUT all of our | 1187 | * Starts a new zone iteration (used to periodically PUT all of our |
1188 | * records into our DHT). This MUST lock the GNUNET_NAMESTORE_Handle | 1188 | * records into our DHT). This MUST lock the struct GNUNET_NAMESTORE_Handle |
1189 | * for any other calls than GNUNET_NAMESTORE_zone_iterator_next and | 1189 | * for any other calls than #GNUNET_NAMESTORE_zone_iterator_next and |
1190 | * GNUNET_NAMESTORE_zone_iteration_stop. "proc" will be called once | 1190 | * #GNUNET_NAMESTORE_zone_iteration_stop. @a proc will be called once |
1191 | * immediately, and then again after | 1191 | * immediately, and then again after |
1192 | * "GNUNET_NAMESTORE_zone_iterator_next" is invoked. | 1192 | * #GNUNET_NAMESTORE_zone_iterator_next is invoked. |
1193 | * | 1193 | * |
1194 | * @param h handle to the namestore | 1194 | * @param h handle to the namestore |
1195 | * @param zone zone to access | 1195 | * @param zone zone to access, NULL for all zones |
1196 | * @param proc function to call on each name from the zone; it | 1196 | * @param proc function to call on each name from the zone; it |
1197 | * will be called repeatedly with a value (if available) | 1197 | * will be called repeatedly with a value (if available) |
1198 | * and always once at the end with a name of NULL. | 1198 | * and always once at the end with a name of NULL. |
1199 | * @param proc_cls closure for proc | 1199 | * @param proc_cls closure for @a proc |
1200 | * @return an iterator handle to use for iteration | 1200 | * @return an iterator handle to use for iteration |
1201 | */ | 1201 | */ |
1202 | struct GNUNET_NAMESTORE_ZoneIterator * | 1202 | struct GNUNET_NAMESTORE_ZoneIterator * |
@@ -1218,7 +1218,8 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | |||
1218 | it->proc = proc; | 1218 | it->proc = proc; |
1219 | it->proc_cls = proc_cls; | 1219 | it->proc_cls = proc_cls; |
1220 | it->op_id = rid; | 1220 | it->op_id = rid; |
1221 | it->zone = *zone; | 1221 | if (NULL != zone) |
1222 | it->zone = *zone; | ||
1222 | GNUNET_CONTAINER_DLL_insert_tail (h->z_head, h->z_tail, it); | 1223 | GNUNET_CONTAINER_DLL_insert_tail (h->z_head, h->z_tail, it); |
1223 | 1224 | ||
1224 | msg_size = sizeof (struct ZoneIterationStartMessage); | 1225 | msg_size = sizeof (struct ZoneIterationStartMessage); |
@@ -1228,7 +1229,8 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | |||
1228 | msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); | 1229 | msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); |
1229 | msg->gns_header.header.size = htons (msg_size); | 1230 | msg->gns_header.header.size = htons (msg_size); |
1230 | msg->gns_header.r_id = htonl (rid); | 1231 | msg->gns_header.r_id = htonl (rid); |
1231 | msg->zone = *zone; | 1232 | if (NULL != zone) |
1233 | msg->zone = *zone; | ||
1232 | GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); | 1234 | GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); |
1233 | do_transmit(h); | 1235 | do_transmit(h); |
1234 | return it; | 1236 | return it; |
@@ -1236,7 +1238,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | |||
1236 | 1238 | ||
1237 | 1239 | ||
1238 | /** | 1240 | /** |
1239 | * Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start | 1241 | * Calls the record processor specified in #GNUNET_NAMESTORE_zone_iteration_start |
1240 | * for the next record. | 1242 | * for the next record. |
1241 | * | 1243 | * |
1242 | * @param it the iterator | 1244 | * @param it the iterator |
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 0a3da174b..437a2efd6 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -762,7 +762,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
762 | sqlite3_stmt *stmt; | 762 | sqlite3_stmt *stmt; |
763 | 763 | ||
764 | stmt = plugin->iterate_zone; | 764 | stmt = plugin->iterate_zone; |
765 | 765 | // FIXME: does not hanlde NULL for zone! | |
766 | if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, | 766 | if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, |
767 | zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), | 767 | zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), |
768 | SQLITE_STATIC)) || | 768 | SQLITE_STATIC)) || |