[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22390 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22390 - gnunet/src/testbed |
Date: |
Fri, 29 Jun 2012 17:12:56 +0200 |
Author: harsha
Date: 2012-06-29 17:12:56 +0200 (Fri, 29 Jun 2012)
New Revision: 22390
Modified:
gnunet/src/testbed/testbed.h
gnunet/src/testbed/testbed_api.c
Log:
testbed api: controller link message
Modified: gnunet/src/testbed/testbed.h
===================================================================
--- gnunet/src/testbed/testbed.h 2012-06-29 15:04:55 UTC (rev 22389)
+++ gnunet/src/testbed/testbed.h 2012-06-29 15:12:56 UTC (rev 22390)
@@ -169,10 +169,10 @@
uint32_t slave_host_id GNUNET_PACKED;
/**
- * Is the receiving controller the master controller for
- * the slave host (and thus responsible for starting it?). NBO.
+ * Set to 1 if the receiving controller is the master controller for
+ * the slave host (and thus responsible for starting it?). 0 if not
*/
- int32_t is_subordinate GNUNET_PACKED;
+ uint8_t is_subordinate;
/* followed by serialized slave configuration;
gzip'ed configuration file in INI format */
Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c 2012-06-29 15:04:55 UTC (rev 22389)
+++ gnunet/src/testbed/testbed_api.c 2012-06-29 15:12:56 UTC (rev 22390)
@@ -31,6 +31,7 @@
#include "gnunet_constants.h"
#include "gnunet_transport_service.h"
#include "gnunet_hello_lib.h"
+#include <zlib.h>
#include "testbed.h"
#include "testbed_api_hosts.h"
@@ -629,7 +630,37 @@
const struct GNUNET_CONFIGURATION_Handle
*slave_cfg,
int is_subordinate)
{
- GNUNET_break (0);
+ struct GNUNET_TESTBED_ControllerLinkMessage *msg;
+ char *config;
+ Bytef *cconfig;
+ uLongf cc_size;
+ size_t config_size;
+ uint16_t msg_size;
+
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_TESTBED_is_host_registered_ (delegated_host));
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_TESTBED_is_host_registered_ (slave_host));
+ config = GNUNET_CONFIGURATION_serialize (slave_cfg, &config_size);
+ cc_size = compressBound ((uLong) config_size);
+ cconfig = GNUNET_malloc (cc_size);
+ GNUNET_assert (Z_OK ==
+ compress2 (cconfig, &cc_size,
+ (Bytef *) config, config_size, Z_BEST_SPEED));
+ GNUNET_free (config);
+ GNUNET_assert ((UINT16_MAX -
+ sizeof (struct GNUNET_TESTBED_ControllerLinkMessage))
+ >= cc_size); /* Configuration doesn't fit in 1 message */
+ msg_size = cc_size + sizeof (struct GNUNET_TESTBED_ControllerLinkMessage);
+ msg = GNUNET_realloc (cconfig, msg_size);
+ memmove (msg + sizeof (struct GNUNET_TESTBED_ControllerLinkMessage),
+ msg, cc_size);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS);
+ msg->header.size = htons (msg_size);
+ msg->delegated_host_id = htonl (GNUNET_TESTBED_host_get_id_
(delegated_host));
+ msg->slave_host_id = htonl (GNUNET_TESTBED_host_get_id_ (slave_host));
+ msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
+ queue_message (master, (struct GNUNET_MessageHeader *) msg);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22390 - gnunet/src/testbed,
gnunet <=