diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-12 19:07:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-12 19:07:40 +0000 |
commit | 6c471eeb15e27f8226492b4860a3c2acb94c5f25 (patch) | |
tree | a3a9dcba12ee5356c03056c10b7aba5367b2ef34 /src/dht/dht_api.c | |
parent | 16bcbbea7133fd2265d46bd2ae1dc70e8c9ba96f (diff) | |
download | gnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.tar.gz gnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.zip |
-consistently use struct GNUNET_HashCode
Diffstat (limited to 'src/dht/dht_api.c')
-rw-r--r-- | src/dht/dht_api.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index 420eacbff..53702fd77 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -175,7 +175,7 @@ struct GNUNET_DHT_GetHandle | |||
175 | /** | 175 | /** |
176 | * Key that this get request is for | 176 | * Key that this get request is for |
177 | */ | 177 | */ |
178 | GNUNET_HashCode key; | 178 | struct GNUNET_HashCode key; |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * Unique identifier for this request (for key collisions). | 181 | * Unique identifier for this request (for key collisions). |
@@ -213,7 +213,7 @@ struct GNUNET_DHT_MonitorHandle | |||
213 | /** | 213 | /** |
214 | * Key being looked for, NULL == all. | 214 | * Key being looked for, NULL == all. |
215 | */ | 215 | */ |
216 | GNUNET_HashCode *key; | 216 | struct GNUNET_HashCode *key; |
217 | 217 | ||
218 | /** | 218 | /** |
219 | * Callback for each received message of type get. | 219 | * Callback for each received message of type get. |
@@ -362,7 +362,7 @@ try_connect (struct GNUNET_DHT_Handle *handle) | |||
362 | * @return GNUNET_YES (always) | 362 | * @return GNUNET_YES (always) |
363 | */ | 363 | */ |
364 | static int | 364 | static int |
365 | add_request_to_pending (void *cls, const GNUNET_HashCode * key, void *value) | 365 | add_request_to_pending (void *cls, const struct GNUNET_HashCode * key, void *value) |
366 | { | 366 | { |
367 | struct GNUNET_DHT_Handle *handle = cls; | 367 | struct GNUNET_DHT_Handle *handle = cls; |
368 | struct GNUNET_DHT_GetHandle *rh = value; | 368 | struct GNUNET_DHT_GetHandle *rh = value; |
@@ -577,7 +577,7 @@ transmit_pending (void *cls, size_t size, void *buf) | |||
577 | * GNUNET_NO if the reply is malformed | 577 | * GNUNET_NO if the reply is malformed |
578 | */ | 578 | */ |
579 | static int | 579 | static int |
580 | process_reply (void *cls, const GNUNET_HashCode * key, void *value) | 580 | process_reply (void *cls, const struct GNUNET_HashCode * key, void *value) |
581 | { | 581 | { |
582 | const struct GNUNET_DHT_ClientResultMessage *dht_msg = cls; | 582 | const struct GNUNET_DHT_ClientResultMessage *dht_msg = cls; |
583 | struct GNUNET_DHT_GetHandle *get_handle = value; | 583 | struct GNUNET_DHT_GetHandle *get_handle = value; |
@@ -648,7 +648,7 @@ process_monitor_get_message (struct GNUNET_DHT_Handle *handle, | |||
648 | 648 | ||
649 | type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type)); | 649 | type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type)); |
650 | key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key, | 650 | key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key, |
651 | sizeof (GNUNET_HashCode))); | 651 | sizeof (struct GNUNET_HashCode))); |
652 | if (type_ok && key_ok && (NULL != h->get_cb)) | 652 | if (type_ok && key_ok && (NULL != h->get_cb)) |
653 | h->get_cb (h->cb_cls, | 653 | h->get_cb (h->cb_cls, |
654 | ntohl (msg->options), | 654 | ntohl (msg->options), |
@@ -699,7 +699,7 @@ process_monitor_get_resp_message (struct GNUNET_DHT_Handle *handle, | |||
699 | 699 | ||
700 | type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type)); | 700 | type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type)); |
701 | key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key, | 701 | key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key, |
702 | sizeof (GNUNET_HashCode))); | 702 | sizeof (struct GNUNET_HashCode))); |
703 | if (type_ok && key_ok && (NULL != h->get_resp_cb)) | 703 | if (type_ok && key_ok && (NULL != h->get_resp_cb)) |
704 | h->get_resp_cb (h->cb_cls, | 704 | h->get_resp_cb (h->cb_cls, |
705 | (enum GNUNET_BLOCK_Type) ntohl(msg->type), | 705 | (enum GNUNET_BLOCK_Type) ntohl(msg->type), |
@@ -749,7 +749,7 @@ process_monitor_put_message (struct GNUNET_DHT_Handle *handle, | |||
749 | 749 | ||
750 | type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type)); | 750 | type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type)); |
751 | key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key, | 751 | key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key, |
752 | sizeof (GNUNET_HashCode))); | 752 | sizeof (struct GNUNET_HashCode))); |
753 | if (type_ok && key_ok && (NULL != h->put_cb)) | 753 | if (type_ok && key_ok && (NULL != h->put_cb)) |
754 | h->put_cb (h->cb_cls, | 754 | h->put_cb (h->cb_cls, |
755 | ntohl (msg->options), | 755 | ntohl (msg->options), |
@@ -1040,7 +1040,7 @@ mark_put_message_gone (void *cls, | |||
1040 | * @param cont_cls closure for cont | 1040 | * @param cont_cls closure for cont |
1041 | */ | 1041 | */ |
1042 | struct GNUNET_DHT_PutHandle * | 1042 | struct GNUNET_DHT_PutHandle * |
1043 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * key, | 1043 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const struct GNUNET_HashCode * key, |
1044 | uint32_t desired_replication_level, | 1044 | uint32_t desired_replication_level, |
1045 | enum GNUNET_DHT_RouteOption options, | 1045 | enum GNUNET_DHT_RouteOption options, |
1046 | enum GNUNET_BLOCK_Type type, size_t size, const char *data, | 1046 | enum GNUNET_BLOCK_Type type, size_t size, const char *data, |
@@ -1148,7 +1148,7 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph) | |||
1148 | */ | 1148 | */ |
1149 | struct GNUNET_DHT_GetHandle * | 1149 | struct GNUNET_DHT_GetHandle * |
1150 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | 1150 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, |
1151 | enum GNUNET_BLOCK_Type type, const GNUNET_HashCode * key, | 1151 | enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode * key, |
1152 | uint32_t desired_replication_level, | 1152 | uint32_t desired_replication_level, |
1153 | enum GNUNET_DHT_RouteOption options, const void *xquery, | 1153 | enum GNUNET_DHT_RouteOption options, const void *xquery, |
1154 | size_t xquery_size, GNUNET_DHT_GetIterator iter, | 1154 | size_t xquery_size, GNUNET_DHT_GetIterator iter, |
@@ -1266,7 +1266,7 @@ GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle) | |||
1266 | struct GNUNET_DHT_MonitorHandle * | 1266 | struct GNUNET_DHT_MonitorHandle * |
1267 | GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | 1267 | GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, |
1268 | enum GNUNET_BLOCK_Type type, | 1268 | enum GNUNET_BLOCK_Type type, |
1269 | const GNUNET_HashCode *key, | 1269 | const struct GNUNET_HashCode *key, |
1270 | GNUNET_DHT_MonitorGetCB get_cb, | 1270 | GNUNET_DHT_MonitorGetCB get_cb, |
1271 | GNUNET_DHT_MonitorGetRespCB get_resp_cb, | 1271 | GNUNET_DHT_MonitorGetRespCB get_resp_cb, |
1272 | GNUNET_DHT_MonitorPutCB put_cb, | 1272 | GNUNET_DHT_MonitorPutCB put_cb, |
@@ -1287,8 +1287,8 @@ GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | |||
1287 | h->dht_handle = handle; | 1287 | h->dht_handle = handle; |
1288 | if (NULL != key) | 1288 | if (NULL != key) |
1289 | { | 1289 | { |
1290 | h->key = GNUNET_malloc (sizeof(GNUNET_HashCode)); | 1290 | h->key = GNUNET_malloc (sizeof(struct GNUNET_HashCode)); |
1291 | memcpy (h->key, key, sizeof(GNUNET_HashCode)); | 1291 | memcpy (h->key, key, sizeof(struct GNUNET_HashCode)); |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | pending = GNUNET_malloc (sizeof (struct GNUNET_DHT_MonitorStartStopMessage) + | 1294 | pending = GNUNET_malloc (sizeof (struct GNUNET_DHT_MonitorStartStopMessage) + |
@@ -1305,7 +1305,7 @@ GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | |||
1305 | m->put = htons(NULL != put_cb); | 1305 | m->put = htons(NULL != put_cb); |
1306 | if (NULL != key) { | 1306 | if (NULL != key) { |
1307 | m->filter_key = htons(1); | 1307 | m->filter_key = htons(1); |
1308 | memcpy (&m->key, key, sizeof(GNUNET_HashCode)); | 1308 | memcpy (&m->key, key, sizeof(struct GNUNET_HashCode)); |
1309 | } | 1309 | } |
1310 | GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail, | 1310 | GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail, |
1311 | pending); | 1311 | pending); |
@@ -1347,7 +1347,7 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle) | |||
1347 | m->put = htons(NULL != handle->put_cb); | 1347 | m->put = htons(NULL != handle->put_cb); |
1348 | if (NULL != handle->key) { | 1348 | if (NULL != handle->key) { |
1349 | m->filter_key = htons(1); | 1349 | m->filter_key = htons(1); |
1350 | memcpy (&m->key, handle->key, sizeof(GNUNET_HashCode)); | 1350 | memcpy (&m->key, handle->key, sizeof(struct GNUNET_HashCode)); |
1351 | } | 1351 | } |
1352 | GNUNET_CONTAINER_DLL_insert (handle->dht_handle->pending_head, | 1352 | GNUNET_CONTAINER_DLL_insert (handle->dht_handle->pending_head, |
1353 | handle->dht_handle->pending_tail, | 1353 | handle->dht_handle->pending_tail, |