diff options
author | Gabor X Toth <*@tg-x.net> | 2015-05-07 12:15:58 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2015-05-07 12:15:58 +0000 |
commit | 4725d59b468f1f30ba2910992333ca157682ce29 (patch) | |
tree | 23715ee20879c94a3363e28ea184370a4a71e44d /src/psycstore | |
parent | a5edf8ac9f03a368c87ea6163994d4ac3d62af06 (diff) | |
download | gnunet-4725d59b468f1f30ba2910992333ca157682ce29.tar.gz gnunet-4725d59b468f1f30ba2910992333ca157682ce29.zip |
psyc/social: request history & state from psycstore; more documentation, tests, cleanup
Diffstat (limited to 'src/psycstore')
-rw-r--r-- | src/psycstore/gnunet-service-psycstore.c | 28 | ||||
-rw-r--r-- | src/psycstore/plugin_psycstore_sqlite.c | 4 | ||||
-rw-r--r-- | src/psycstore/psycstore_api.c | 53 | ||||
-rw-r--r-- | src/psycstore/test_psycstore.c | 44 |
4 files changed, 92 insertions, 37 deletions
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c index 7954de991..1025da8c5 100644 --- a/src/psycstore/gnunet-service-psycstore.c +++ b/src/psycstore/gnunet-service-psycstore.c | |||
@@ -109,7 +109,7 @@ send_result_code (struct GNUNET_SERVER_Client *client, uint64_t op_id, | |||
109 | 109 | ||
110 | if (NULL != err_msg) | 110 | if (NULL != err_msg) |
111 | err_size = strnlen (err_msg, | 111 | err_size = strnlen (err_msg, |
112 | GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*res)) + 1; | 112 | GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*res) - 1) + 1; |
113 | res = GNUNET_malloc (sizeof (struct OperationResult) + err_size); | 113 | res = GNUNET_malloc (sizeof (struct OperationResult) + err_size); |
114 | res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE); | 114 | res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE); |
115 | res->header.size = htons (sizeof (struct OperationResult) + err_size); | 115 | res->header.size = htons (sizeof (struct OperationResult) + err_size); |
@@ -222,7 +222,7 @@ send_state_var (void *cls, const char *name, | |||
222 | struct StateResult *res; | 222 | struct StateResult *res; |
223 | size_t name_size = strlen (name) + 1; | 223 | size_t name_size = strlen (name) + 1; |
224 | 224 | ||
225 | /* FIXME: split up value into 64k chunks */ | 225 | /** @todo FIXME: split up value into 64k chunks */ |
226 | 226 | ||
227 | res = GNUNET_malloc (sizeof (struct StateResult) + name_size + value_size); | 227 | res = GNUNET_malloc (sizeof (struct StateResult) + name_size + value_size); |
228 | res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_STATE); | 228 | res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_STATE); |
@@ -333,7 +333,7 @@ handle_fragment_get (void *cls, | |||
333 | first_fragment_id, last_fragment_id, | 333 | first_fragment_id, last_fragment_id, |
334 | &ret_frags, &send_fragment, &sc); | 334 | &ret_frags, &send_fragment, &sc); |
335 | else | 335 | else |
336 | ret = db->fragment_get_latest (db->cls, &req->channel_key, limit, | 336 | ret = db->fragment_get_latest (db->cls, &req->channel_key, limit, |
337 | &ret_frags, &send_fragment, &sc); | 337 | &ret_frags, &send_fragment, &sc); |
338 | 338 | ||
339 | switch (ret) | 339 | switch (ret) |
@@ -373,6 +373,20 @@ handle_message_get (void *cls, | |||
373 | { | 373 | { |
374 | const struct MessageGetRequest * | 374 | const struct MessageGetRequest * |
375 | req = (const struct MessageGetRequest *) msg; | 375 | req = (const struct MessageGetRequest *) msg; |
376 | uint16_t size = ntohs (msg->size); | ||
377 | const char *method_prefix = (const char *) &req[1]; | ||
378 | |||
379 | if (size < sizeof (*req) + 1 | ||
380 | || '\0' != method_prefix[size - sizeof (*req) - 1]) | ||
381 | { | ||
382 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
383 | "Message get: invalid method prefix. size: %u < %u?\n", | ||
384 | size, sizeof (*req) + 1); | ||
385 | GNUNET_break (0); | ||
386 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
387 | return; | ||
388 | } | ||
389 | |||
376 | struct SendClosure | 390 | struct SendClosure |
377 | sc = { .op_id = req->op_id, .client = client, | 391 | sc = { .op_id = req->op_id, .client = client, |
378 | .channel_key = req->channel_key, .slave_key = req->slave_key, | 392 | .channel_key = req->channel_key, .slave_key = req->slave_key, |
@@ -384,6 +398,7 @@ handle_message_get (void *cls, | |||
384 | uint64_t last_message_id = GNUNET_ntohll (req->last_message_id); | 398 | uint64_t last_message_id = GNUNET_ntohll (req->last_message_id); |
385 | uint64_t limit = GNUNET_ntohll (req->message_limit); | 399 | uint64_t limit = GNUNET_ntohll (req->message_limit); |
386 | 400 | ||
401 | /** @todo method_prefix */ | ||
387 | if (0 == limit) | 402 | if (0 == limit) |
388 | ret = db->message_get (db->cls, &req->channel_key, | 403 | ret = db->message_get (db->cls, &req->channel_key, |
389 | first_message_id, last_message_id, | 404 | first_message_id, last_message_id, |
@@ -478,7 +493,7 @@ handle_counters_get (void *cls, | |||
478 | } | 493 | } |
479 | 494 | ||
480 | 495 | ||
481 | /* FIXME: stop processing further state modify messages after an error */ | 496 | /** @todo FIXME: stop processing further state modify messages after an error */ |
482 | static void | 497 | static void |
483 | handle_state_modify (void *cls, | 498 | handle_state_modify (void *cls, |
484 | struct GNUNET_SERVER_Client *client, | 499 | struct GNUNET_SERVER_Client *client, |
@@ -551,7 +566,7 @@ handle_state_modify (void *cls, | |||
551 | } | 566 | } |
552 | 567 | ||
553 | 568 | ||
554 | /* FIXME: stop processing further state sync messages after an error */ | 569 | /** @todo FIXME: stop processing further state sync messages after an error */ |
555 | static void | 570 | static void |
556 | handle_state_sync (void *cls, | 571 | handle_state_sync (void *cls, |
557 | struct GNUNET_SERVER_Client *client, | 572 | struct GNUNET_SERVER_Client *client, |
@@ -761,8 +776,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
761 | sizeof (struct FragmentGetRequest) }, | 776 | sizeof (struct FragmentGetRequest) }, |
762 | 777 | ||
763 | { &handle_message_get, NULL, | 778 | { &handle_message_get, NULL, |
764 | GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET, | 779 | GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET, 0 }, |
765 | sizeof (struct MessageGetRequest) }, | ||
766 | 780 | ||
767 | { &handle_message_get_fragment, NULL, | 781 | { &handle_message_get_fragment, NULL, |
768 | GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET_FRAGMENT, | 782 | GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET_FRAGMENT, |
diff --git a/src/psycstore/plugin_psycstore_sqlite.c b/src/psycstore/plugin_psycstore_sqlite.c index 04bec6809..542c4bfc9 100644 --- a/src/psycstore/plugin_psycstore_sqlite.c +++ b/src/psycstore/plugin_psycstore_sqlite.c | |||
@@ -376,6 +376,7 @@ database_setup (struct Plugin *plugin) | |||
376 | "CREATE INDEX IF NOT EXISTS idx_membership_channel_id_slave_id " | 376 | "CREATE INDEX IF NOT EXISTS idx_membership_channel_id_slave_id " |
377 | "ON membership (channel_id, slave_id);"); | 377 | "ON membership (channel_id, slave_id);"); |
378 | 378 | ||
379 | /** @todo messages table: add method_name column */ | ||
379 | sql_exec (plugin->dbh, | 380 | sql_exec (plugin->dbh, |
380 | "CREATE TABLE IF NOT EXISTS messages (\n" | 381 | "CREATE TABLE IF NOT EXISTS messages (\n" |
381 | " channel_id INTEGER NOT NULL REFERENCES channels(id),\n" | 382 | " channel_id INTEGER NOT NULL REFERENCES channels(id),\n" |
@@ -468,6 +469,7 @@ database_setup (struct Plugin *plugin) | |||
468 | " AND ? <= fragment_id AND fragment_id <= ?;", | 469 | " AND ? <= fragment_id AND fragment_id <= ?;", |
469 | &plugin->select_fragments); | 470 | &plugin->select_fragments); |
470 | 471 | ||
472 | /** @todo select_messages: add method_prefix filter */ | ||
471 | sql_prepare (plugin->dbh, | 473 | sql_prepare (plugin->dbh, |
472 | "SELECT hop_counter, signature, purpose, fragment_id,\n" | 474 | "SELECT hop_counter, signature, purpose, fragment_id,\n" |
473 | " fragment_offset, message_id, group_generation,\n" | 475 | " fragment_offset, message_id, group_generation,\n" |
@@ -489,6 +491,7 @@ database_setup (struct Plugin *plugin) | |||
489 | "ORDER BY fragment_id;", | 491 | "ORDER BY fragment_id;", |
490 | &plugin->select_latest_fragments); | 492 | &plugin->select_latest_fragments); |
491 | 493 | ||
494 | /** @todo select_latest_messages: add method_prefix filter */ | ||
492 | sql_prepare (plugin->dbh, | 495 | sql_prepare (plugin->dbh, |
493 | "SELECT hop_counter, signature, purpose, fragment_id,\n" | 496 | "SELECT hop_counter, signature, purpose, fragment_id,\n" |
494 | " fragment_offset, message_id, group_generation,\n" | 497 | " fragment_offset, message_id, group_generation,\n" |
@@ -499,6 +502,7 @@ database_setup (struct Plugin *plugin) | |||
499 | " (SELECT message_id\n" | 502 | " (SELECT message_id\n" |
500 | " FROM messages\n" | 503 | " FROM messages\n" |
501 | " WHERE channel_id = (SELECT id FROM channels WHERE pub_key = ?)\n" | 504 | " WHERE channel_id = (SELECT id FROM channels WHERE pub_key = ?)\n" |
505 | " GROUP BY message_id\n" | ||
502 | " ORDER BY message_id\n" | 506 | " ORDER BY message_id\n" |
503 | " DESC LIMIT ?)\n" | 507 | " DESC LIMIT ?)\n" |
504 | "ORDER BY fragment_id;", | 508 | "ORDER BY fragment_id;", |
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c index 0178e9ce6..c319b2e1b 100644 --- a/src/psycstore/psycstore_api.c +++ b/src/psycstore/psycstore_api.c | |||
@@ -283,7 +283,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
283 | return; | 283 | return; |
284 | } | 284 | } |
285 | if (size == sizeof (struct OperationResult)) | 285 | if (size == sizeof (struct OperationResult)) |
286 | str = NULL; | 286 | str = ""; |
287 | 287 | ||
288 | op = find_op_by_id (h, GNUNET_ntohll (opres->op_id)); | 288 | op = find_op_by_id (h, GNUNET_ntohll (opres->op_id)); |
289 | if (NULL == op) | 289 | if (NULL == op) |
@@ -321,7 +321,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
321 | } | 321 | } |
322 | } | 322 | } |
323 | if (NULL != op->res_cb) | 323 | if (NULL != op->res_cb) |
324 | op->res_cb (op->cls, result_code, str); | 324 | op->res_cb (op->cls, result_code, str, size - sizeof (*opres)); |
325 | GNUNET_free (op); | 325 | GNUNET_free (op); |
326 | } | 326 | } |
327 | break; | 327 | break; |
@@ -965,18 +965,19 @@ GNUNET_PSYCSTORE_fragment_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | |||
965 | * @param channel_key | 965 | * @param channel_key |
966 | * The channel we are interested in. | 966 | * The channel we are interested in. |
967 | * @param slave_key | 967 | * @param slave_key |
968 | * The slave requesting the message. If not NULL, a membership test is | 968 | * The slave requesting the message. |
969 | * performed first and the message is only returned if the slave has | 969 | * If not NULL, a membership test is performed first |
970 | * access to it. | 970 | * and the message is only returned if the slave has access to it. |
971 | * @param first_message_id | 971 | * @param first_message_id |
972 | * First message ID to retrieve. | 972 | * First message ID to retrieve. |
973 | * Use 0 to get the latest message. | ||
974 | * @param last_message_id | 973 | * @param last_message_id |
975 | * Last consecutive message ID to retrieve. | 974 | * Last consecutive message ID to retrieve. |
976 | * Use 0 to get the latest message. | 975 | * @param method_prefix |
976 | * Retrieve only messages with a matching method prefix. | ||
977 | * @todo Implement method_prefix query. | ||
977 | * @param fragment_cb | 978 | * @param fragment_cb |
978 | * Callback to call with the retrieved fragments. | 979 | * Callback to call with the retrieved fragments. |
979 | * @param rcb | 980 | * @param result_cb |
980 | * Callback to call with the result of the operation. | 981 | * Callback to call with the result of the operation. |
981 | * @param cls | 982 | * @param cls |
982 | * Closure for the callbacks. | 983 | * Closure for the callbacks. |
@@ -989,11 +990,18 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
989 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 990 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
990 | uint64_t first_message_id, | 991 | uint64_t first_message_id, |
991 | uint64_t last_message_id, | 992 | uint64_t last_message_id, |
993 | const char *method_prefix, | ||
992 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, | 994 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, |
993 | GNUNET_PSYCSTORE_ResultCallback rcb, | 995 | GNUNET_PSYCSTORE_ResultCallback rcb, |
994 | void *cls) | 996 | void *cls) |
995 | { | 997 | { |
996 | struct MessageGetRequest *req; | 998 | struct MessageGetRequest *req; |
999 | if (NULL == method_prefix) | ||
1000 | method_prefix = ""; | ||
1001 | uint16_t method_size = strnlen (method_prefix, | ||
1002 | GNUNET_SERVER_MAX_MESSAGE_SIZE | ||
1003 | - sizeof (*req)) + 1; | ||
1004 | |||
997 | struct GNUNET_PSYCSTORE_OperationHandle * | 1005 | struct GNUNET_PSYCSTORE_OperationHandle * |
998 | op = GNUNET_malloc (sizeof (*op) + sizeof (*req)); | 1006 | op = GNUNET_malloc (sizeof (*op) + sizeof (*req)); |
999 | op->h = h; | 1007 | op->h = h; |
@@ -1004,7 +1012,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
1004 | req = (struct MessageGetRequest *) &op[1]; | 1012 | req = (struct MessageGetRequest *) &op[1]; |
1005 | op->msg = (struct GNUNET_MessageHeader *) req; | 1013 | op->msg = (struct GNUNET_MessageHeader *) req; |
1006 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET); | 1014 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET); |
1007 | req->header.size = htons (sizeof (*req)); | 1015 | req->header.size = htons (sizeof (*req) + method_size); |
1008 | req->channel_key = *channel_key; | 1016 | req->channel_key = *channel_key; |
1009 | req->first_message_id = GNUNET_htonll (first_message_id); | 1017 | req->first_message_id = GNUNET_htonll (first_message_id); |
1010 | req->last_message_id = GNUNET_htonll (last_message_id); | 1018 | req->last_message_id = GNUNET_htonll (last_message_id); |
@@ -1013,6 +1021,8 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
1013 | req->slave_key = *slave_key; | 1021 | req->slave_key = *slave_key; |
1014 | req->do_membership_test = GNUNET_YES; | 1022 | req->do_membership_test = GNUNET_YES; |
1015 | } | 1023 | } |
1024 | memcpy (&req[1], method_prefix, method_size); | ||
1025 | ((char *) &req[1])[method_size - 1] = '\0'; | ||
1016 | 1026 | ||
1017 | op->op_id = get_next_op_id (h); | 1027 | op->op_id = get_next_op_id (h); |
1018 | req->op_id = GNUNET_htonll (op->op_id); | 1028 | req->op_id = GNUNET_htonll (op->op_id); |
@@ -1032,14 +1042,17 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
1032 | * @param channel_key | 1042 | * @param channel_key |
1033 | * The channel we are interested in. | 1043 | * The channel we are interested in. |
1034 | * @param slave_key | 1044 | * @param slave_key |
1035 | * The slave requesting the message. If not NULL, a membership test is | 1045 | * The slave requesting the message. |
1036 | * performed first and the message is only returned if the slave has | 1046 | * If not NULL, a membership test is performed first |
1037 | * access to it. | 1047 | * and the message is only returned if the slave has access to it. |
1038 | * @param message_limit | 1048 | * @param message_limit |
1039 | * Maximum number of messages to retrieve. | 1049 | * Maximum number of messages to retrieve. |
1050 | * @param method_prefix | ||
1051 | * Retrieve only messages with a matching method prefix. | ||
1052 | * @todo Implement method_prefix query. | ||
1040 | * @param fragment_cb | 1053 | * @param fragment_cb |
1041 | * Callback to call with the retrieved fragments. | 1054 | * Callback to call with the retrieved fragments. |
1042 | * @param rcb | 1055 | * @param result_cb |
1043 | * Callback to call with the result of the operation. | 1056 | * Callback to call with the result of the operation. |
1044 | * @param cls | 1057 | * @param cls |
1045 | * Closure for the callbacks. | 1058 | * Closure for the callbacks. |
@@ -1051,13 +1064,22 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | |||
1051 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | 1064 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, |
1052 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 1065 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
1053 | uint64_t message_limit, | 1066 | uint64_t message_limit, |
1067 | const char *method_prefix, | ||
1054 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, | 1068 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, |
1055 | GNUNET_PSYCSTORE_ResultCallback rcb, | 1069 | GNUNET_PSYCSTORE_ResultCallback rcb, |
1056 | void *cls) | 1070 | void *cls) |
1057 | { | 1071 | { |
1058 | struct MessageGetRequest *req; | 1072 | struct MessageGetRequest *req; |
1073 | |||
1074 | if (NULL == method_prefix) | ||
1075 | method_prefix = ""; | ||
1076 | uint16_t method_size = strnlen (method_prefix, | ||
1077 | GNUNET_SERVER_MAX_MESSAGE_SIZE | ||
1078 | - sizeof (*req)) + 1; | ||
1079 | GNUNET_assert ('\0' == method_prefix[method_size - 1]); | ||
1080 | |||
1059 | struct GNUNET_PSYCSTORE_OperationHandle * | 1081 | struct GNUNET_PSYCSTORE_OperationHandle * |
1060 | op = GNUNET_malloc (sizeof (*op) + sizeof (*req)); | 1082 | op = GNUNET_malloc (sizeof (*op) + sizeof (*req) + method_size); |
1061 | op->h = h; | 1083 | op->h = h; |
1062 | op->data_cb = (DataCallback) fragment_cb; | 1084 | op->data_cb = (DataCallback) fragment_cb; |
1063 | op->res_cb = rcb; | 1085 | op->res_cb = rcb; |
@@ -1066,7 +1088,7 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | |||
1066 | req = (struct MessageGetRequest *) &op[1]; | 1088 | req = (struct MessageGetRequest *) &op[1]; |
1067 | op->msg = (struct GNUNET_MessageHeader *) req; | 1089 | op->msg = (struct GNUNET_MessageHeader *) req; |
1068 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET); | 1090 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET); |
1069 | req->header.size = htons (sizeof (*req)); | 1091 | req->header.size = htons (sizeof (*req) + method_size); |
1070 | req->channel_key = *channel_key; | 1092 | req->channel_key = *channel_key; |
1071 | req->message_limit = GNUNET_ntohll (message_limit); | 1093 | req->message_limit = GNUNET_ntohll (message_limit); |
1072 | if (NULL != slave_key) | 1094 | if (NULL != slave_key) |
@@ -1077,6 +1099,7 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | |||
1077 | 1099 | ||
1078 | op->op_id = get_next_op_id (h); | 1100 | op->op_id = get_next_op_id (h); |
1079 | req->op_id = GNUNET_htonll (op->op_id); | 1101 | req->op_id = GNUNET_htonll (op->op_id); |
1102 | memcpy (&req[1], method_prefix, method_size); | ||
1080 | 1103 | ||
1081 | GNUNET_CONTAINER_DLL_insert_tail (h->transmit_head, h->transmit_tail, op); | 1104 | GNUNET_CONTAINER_DLL_insert_tail (h->transmit_head, h->transmit_tail, op); |
1082 | transmit_next (h); | 1105 | transmit_next (h); |
diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index 5b1b8a335..021c457b9 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c | |||
@@ -154,7 +154,8 @@ end () | |||
154 | 154 | ||
155 | 155 | ||
156 | void | 156 | void |
157 | state_reset_result (void *cls, int64_t result, const char *err_msg) | 157 | state_reset_result (void *cls, int64_t result, |
158 | const char *err_msg, uint16_t err_msg_size) | ||
158 | { | 159 | { |
159 | op = NULL; | 160 | op = NULL; |
160 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_reset_result:\t%d\n", result); | 161 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_reset_result:\t%d\n", result); |
@@ -195,7 +196,8 @@ state_result (void *cls, const char *name, const void *value, size_t value_size) | |||
195 | 196 | ||
196 | 197 | ||
197 | void | 198 | void |
198 | state_get_prefix_result (void *cls, int64_t result, const char *err_msg) | 199 | state_get_prefix_result (void *cls, int64_t result, |
200 | const char *err_msg, uint16_t err_msg_size) | ||
199 | { | 201 | { |
200 | struct StateClosure *scls = cls; | 202 | struct StateClosure *scls = cls; |
201 | op = NULL; | 203 | op = NULL; |
@@ -208,7 +210,8 @@ state_get_prefix_result (void *cls, int64_t result, const char *err_msg) | |||
208 | 210 | ||
209 | 211 | ||
210 | void | 212 | void |
211 | state_get_result (void *cls, int64_t result, const char *err_msg) | 213 | state_get_result (void *cls, int64_t result, |
214 | const char *err_msg, uint16_t err_msg_size) | ||
212 | { | 215 | { |
213 | op = NULL; | 216 | op = NULL; |
214 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_result:\t%d\n", result); | 217 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_result:\t%d\n", result); |
@@ -260,7 +263,8 @@ counters_result (void *cls, int status, uint64_t max_fragment_id, | |||
260 | 263 | ||
261 | 264 | ||
262 | void | 265 | void |
263 | state_modify_result (void *cls, int64_t result, const char *err_msg) | 266 | state_modify_result (void *cls, int64_t result, |
267 | const char *err_msg, uint16_t err_msg_size) | ||
264 | { | 268 | { |
265 | op = NULL; | 269 | op = NULL; |
266 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_modify_result:\t%d\n", result); | 270 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_modify_result:\t%d\n", result); |
@@ -272,7 +276,8 @@ state_modify_result (void *cls, int64_t result, const char *err_msg) | |||
272 | 276 | ||
273 | 277 | ||
274 | void | 278 | void |
275 | state_sync_result (void *cls, int64_t result, const char *err_msg) | 279 | state_sync_result (void *cls, int64_t result, |
280 | const char *err_msg, uint16_t err_msg_size) | ||
276 | { | 281 | { |
277 | struct FragmentClosure *fcls = cls; | 282 | struct FragmentClosure *fcls = cls; |
278 | op = NULL; | 283 | op = NULL; |
@@ -328,7 +333,8 @@ fragment_result (void *cls, | |||
328 | 333 | ||
329 | 334 | ||
330 | void | 335 | void |
331 | message_get_latest_result (void *cls, int64_t result, const char *err_msg) | 336 | message_get_latest_result (void *cls, int64_t result, |
337 | const char *err_msg, uint16_t err_msg_size) | ||
332 | { | 338 | { |
333 | struct FragmentClosure *fcls = cls; | 339 | struct FragmentClosure *fcls = cls; |
334 | op = NULL; | 340 | op = NULL; |
@@ -355,7 +361,8 @@ message_get_latest_result (void *cls, int64_t result, const char *err_msg) | |||
355 | 361 | ||
356 | 362 | ||
357 | void | 363 | void |
358 | message_get_result (void *cls, int64_t result, const char *err_msg) | 364 | message_get_result (void *cls, int64_t result, |
365 | const char *err_msg, uint16_t err_msg_size) | ||
359 | { | 366 | { |
360 | struct FragmentClosure *fcls = cls; | 367 | struct FragmentClosure *fcls = cls; |
361 | op = NULL; | 368 | op = NULL; |
@@ -365,13 +372,14 @@ message_get_result (void *cls, int64_t result, const char *err_msg) | |||
365 | fcls->n = 0; | 372 | fcls->n = 0; |
366 | fcls->n_expected = 3; | 373 | fcls->n_expected = 3; |
367 | op = GNUNET_PSYCSTORE_message_get_latest (h, &channel_pub_key, &slave_pub_key, | 374 | op = GNUNET_PSYCSTORE_message_get_latest (h, &channel_pub_key, &slave_pub_key, |
368 | 1, &fragment_result, | 375 | 1, "", &fragment_result, |
369 | &message_get_latest_result, fcls); | 376 | &message_get_latest_result, fcls); |
370 | } | 377 | } |
371 | 378 | ||
372 | 379 | ||
373 | void | 380 | void |
374 | message_get_fragment_result (void *cls, int64_t result, const char *err_msg) | 381 | message_get_fragment_result (void *cls, int64_t result, |
382 | const char *err_msg, uint16_t err_msg_size) | ||
375 | { | 383 | { |
376 | struct FragmentClosure *fcls = cls; | 384 | struct FragmentClosure *fcls = cls; |
377 | op = NULL; | 385 | op = NULL; |
@@ -382,14 +390,15 @@ message_get_fragment_result (void *cls, int64_t result, const char *err_msg) | |||
382 | fcls->n_expected = 3; | 390 | fcls->n_expected = 3; |
383 | uint64_t message_id = GNUNET_ntohll (fcls->msg[0]->message_id); | 391 | uint64_t message_id = GNUNET_ntohll (fcls->msg[0]->message_id); |
384 | op = GNUNET_PSYCSTORE_message_get (h, &channel_pub_key, &slave_pub_key, | 392 | op = GNUNET_PSYCSTORE_message_get (h, &channel_pub_key, &slave_pub_key, |
385 | message_id, message_id, | 393 | message_id, message_id, "", |
386 | &fragment_result, | 394 | &fragment_result, |
387 | &message_get_result, fcls); | 395 | &message_get_result, fcls); |
388 | } | 396 | } |
389 | 397 | ||
390 | 398 | ||
391 | void | 399 | void |
392 | fragment_get_latest_result (void *cls, int64_t result, const char *err_msg) | 400 | fragment_get_latest_result (void *cls, int64_t result, |
401 | const char *err_msg, uint16_t err_msg_size) | ||
393 | { | 402 | { |
394 | struct FragmentClosure *fcls = cls; | 403 | struct FragmentClosure *fcls = cls; |
395 | op = NULL; | 404 | op = NULL; |
@@ -407,7 +416,8 @@ fragment_get_latest_result (void *cls, int64_t result, const char *err_msg) | |||
407 | 416 | ||
408 | 417 | ||
409 | void | 418 | void |
410 | fragment_get_result (void *cls, int64_t result, const char *err_msg) | 419 | fragment_get_result (void *cls, int64_t result, |
420 | const char *err_msg, uint16_t err_msg_size) | ||
411 | { | 421 | { |
412 | struct FragmentClosure *fcls = cls; | 422 | struct FragmentClosure *fcls = cls; |
413 | op = NULL; | 423 | op = NULL; |
@@ -424,7 +434,8 @@ fragment_get_result (void *cls, int64_t result, const char *err_msg) | |||
424 | 434 | ||
425 | 435 | ||
426 | void | 436 | void |
427 | fragment_store_result (void *cls, int64_t result, const char *err_msg) | 437 | fragment_store_result (void *cls, int64_t result, |
438 | const char *err_msg, uint16_t err_msg_size) | ||
428 | { | 439 | { |
429 | op = NULL; | 440 | op = NULL; |
430 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_store:\t%d\n", result); | 441 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_store:\t%d\n", result); |
@@ -495,7 +506,8 @@ fragment_store () | |||
495 | 506 | ||
496 | 507 | ||
497 | void | 508 | void |
498 | membership_test_result (void *cls, int64_t result, const char *err_msg) | 509 | membership_test_result (void *cls, int64_t result, |
510 | const char *err_msg, uint16_t err_msg_size) | ||
499 | { | 511 | { |
500 | op = NULL; | 512 | op = NULL; |
501 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%d\n", result); | 513 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%d\n", result); |
@@ -506,7 +518,8 @@ membership_test_result (void *cls, int64_t result, const char *err_msg) | |||
506 | 518 | ||
507 | 519 | ||
508 | void | 520 | void |
509 | membership_store_result (void *cls, int64_t result, const char *err_msg) | 521 | membership_store_result (void *cls, int64_t result, |
522 | const char *err_msg, uint16_t err_msg_size) | ||
510 | { | 523 | { |
511 | op = NULL; | 524 | op = NULL; |
512 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_store:\t%d\n", result); | 525 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_store:\t%d\n", result); |
@@ -517,6 +530,7 @@ membership_store_result (void *cls, int64_t result, const char *err_msg) | |||
517 | &membership_test_result, NULL); | 530 | &membership_test_result, NULL); |
518 | } | 531 | } |
519 | 532 | ||
533 | |||
520 | /** | 534 | /** |
521 | * Main function of the test, run from scheduler. | 535 | * Main function of the test, run from scheduler. |
522 | * | 536 | * |