diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-08-25 11:50:39 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-08-25 11:50:39 +0000 |
commit | 5bec5a8d66565e3f42aa5b4fc98ab0d87c47e528 (patch) | |
tree | 831cf55cd54f2adc78fc87ac9114de4748f1bdb1 /src/testbed/testbed_api_peers.c | |
parent | 9233abe82cdf18d40932d590f1c411dff47488e7 (diff) | |
download | gnunet-5bec5a8d66565e3f42aa5b4fc98ab0d87c47e528.tar.gz gnunet-5bec5a8d66565e3f42aa5b4fc98ab0d87c47e528.zip |
towards implementing service_connect
Diffstat (limited to 'src/testbed/testbed_api_peers.c')
-rw-r--r-- | src/testbed/testbed_api_peers.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c index 25362df0d..9ef1829a7 100644 --- a/src/testbed/testbed_api_peers.c +++ b/src/testbed/testbed_api_peers.c | |||
@@ -223,6 +223,32 @@ oprelease_peer_stop (void *cls) | |||
223 | 223 | ||
224 | 224 | ||
225 | /** | 225 | /** |
226 | * Generate PeerGetConfigurationMessage | ||
227 | * | ||
228 | * @param peer_id the id of the peer whose information we have to get | ||
229 | * @param operation_id the ip of the operation that should be represented in | ||
230 | * the message | ||
231 | * @param | ||
232 | * @return the PeerGetConfigurationMessage | ||
233 | */ | ||
234 | struct GNUNET_TESTBED_PeerGetConfigurationMessage * | ||
235 | GNUNET_TESTBED_generate_peergetconfig_msg_ (uint32_t peer_id, | ||
236 | uint64_t operation_id) | ||
237 | { | ||
238 | struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg; | ||
239 | |||
240 | msg = GNUNET_malloc (sizeof (struct | ||
241 | GNUNET_TESTBED_PeerGetConfigurationMessage)); | ||
242 | msg->header.size = htons | ||
243 | (sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage)); | ||
244 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG); | ||
245 | msg->peer_id = htonl (peer_id); | ||
246 | msg->operation_id = GNUNET_htonll (operation_id); | ||
247 | return msg; | ||
248 | } | ||
249 | |||
250 | |||
251 | /** | ||
226 | * Function called when a peer get information operation is ready | 252 | * Function called when a peer get information operation is ready |
227 | * | 253 | * |
228 | * @param cls the closure from GNUNET_TESTBED_operation_create_() | 254 | * @param cls the closure from GNUNET_TESTBED_operation_create_() |
@@ -237,13 +263,8 @@ opstart_peer_getinfo (void *cls) | |||
237 | data = opc->data; | 263 | data = opc->data; |
238 | GNUNET_assert (NULL != data); | 264 | GNUNET_assert (NULL != data); |
239 | opc->state = OPC_STATE_STARTED; | 265 | opc->state = OPC_STATE_STARTED; |
240 | msg = GNUNET_malloc (sizeof (struct | 266 | msg = GNUNET_TESTBED_generate_peergetconfig_msg_ (data->peer->unique_id, |
241 | GNUNET_TESTBED_PeerGetConfigurationMessage)); | 267 | opc->id); |
242 | msg->header.size = htons | ||
243 | (sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage)); | ||
244 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG); | ||
245 | msg->peer_id = htonl (data->peer->unique_id); | ||
246 | msg->operation_id = GNUNET_htonll (opc->id); | ||
247 | GNUNET_CONTAINER_DLL_insert_tail (opc->c->ocq_head, opc->c->ocq_tail, opc); | 268 | GNUNET_CONTAINER_DLL_insert_tail (opc->c->ocq_head, opc->c->ocq_tail, opc); |
248 | GNUNET_TESTBED_queue_message_ (opc->c, &msg->header); | 269 | GNUNET_TESTBED_queue_message_ (opc->c, &msg->header); |
249 | } | 270 | } |
@@ -534,7 +555,7 @@ GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer, | |||
534 | opc->type = OP_PEER_INFO; | 555 | opc->type = OP_PEER_INFO; |
535 | opc->id = opc->c->operation_counter++; | 556 | opc->id = opc->c->operation_counter++; |
536 | opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_getinfo, | 557 | opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_getinfo, |
537 | &oprelease_peer_getinfo); | 558 | &oprelease_peer_getinfo); |
538 | GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations, | 559 | GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations, |
539 | opc->op); | 560 | opc->op); |
540 | return opc->op; | 561 | return opc->op; |