[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22713 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22713 - gnunet/src/testbed |
Date: |
Tue, 17 Jul 2012 14:12:05 +0200 |
Author: harsha
Date: 2012-07-17 14:12:05 +0200 (Tue, 17 Jul 2012)
New Revision: 22713
Modified:
gnunet/src/testbed/test_gnunet_testbed_helper.c
gnunet/src/testbed/testbed_api_hosts.c
gnunet/src/testbed/testbed_api_hosts.h
Log:
separated helper init message
Modified: gnunet/src/testbed/test_gnunet_testbed_helper.c
===================================================================
--- gnunet/src/testbed/test_gnunet_testbed_helper.c 2012-07-17 09:44:26 UTC
(rev 22712)
+++ gnunet/src/testbed/test_gnunet_testbed_helper.c 2012-07-17 12:12:05 UTC
(rev 22713)
@@ -30,6 +30,7 @@
#include "testbed_api.h"
#include "testbed_helper.h"
+#include "testbed_api_hosts.h"
/**
* Generic logging shortcut
@@ -141,34 +142,14 @@
"gnunet-testbed-helper",
NULL
};
- char *config;
- char *xconfig;
- const char *hostname = "127.0.0.1";
- size_t config_size;
- size_t xconfig_size;
- uint16_t hostname_len;
- uint16_t msg_size;
+ const char *controller_name = "127.0.0.1";
helper = GNUNET_HELPER_start ("gnunet-testbed-helper",
binary_argv,
NULL, NULL, NULL);
GNUNET_assert (NULL != helper);
cfg = GNUNET_CONFIGURATION_dup (cfg2);
- config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
- GNUNET_assert (NULL != config);
- xconfig_size =
- GNUNET_TESTBED_compress_config (config, config_size, &xconfig);
- GNUNET_free (config);
- hostname_len = strlen (hostname);
- msg_size = xconfig_size + hostname_len + 1 +
- sizeof (struct GNUNET_TESTBED_HelperInit);
- msg = GNUNET_realloc (xconfig, msg_size);
- (void) memmove ( ((void *) &msg[1]) + hostname_len + 1, msg, xconfig_size);
- msg->header.size = htons (msg_size);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
- msg->cname_size = htons (hostname_len);
- msg->config_size = htons (config_size);
- (void) strcpy ((char *) &msg[1], hostname);
+ msg = GNUNET_TESTBED_create_helper_init_msg_ (controller_name, cfg);
shandle = GNUNET_HELPER_send (helper,
&msg->header,
GNUNET_NO, &cont_cb, NULL);
Modified: gnunet/src/testbed/testbed_api_hosts.c
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.c 2012-07-17 09:44:26 UTC (rev
22712)
+++ gnunet/src/testbed/testbed_api_hosts.c 2012-07-17 12:12:05 UTC (rev
22713)
@@ -33,6 +33,7 @@
#include "gnunet_hello_lib.h"
#include "gnunet_container_lib.h"
+#include "testbed_api.h"
#include "testbed_api_hosts.h"
/**
@@ -488,4 +489,43 @@
}
+/**
+ * Creates a helper initialization message. Only for testing.
+ *
+ * @param cname the ip address of the controlling host
+ * @param cfg the configuration that has to used to start the testbed service
+ * thru helper
+ * @return the initialization message
+ */
+struct GNUNET_TESTBED_HelperInit *
+GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
+ const struct
GNUNET_CONFIGURATION_Handle *cfg)
+{
+ struct GNUNET_TESTBED_HelperInit *msg;
+ char *config;
+ char *xconfig;
+ size_t config_size;
+ size_t xconfig_size;
+ uint16_t cname_len;
+ uint16_t msg_size;
+
+ config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
+ GNUNET_assert (NULL != config);
+ xconfig_size =
+ GNUNET_TESTBED_compress_config (config, config_size, &xconfig);
+ GNUNET_free (config);
+ cname_len = strlen (cname);
+ msg_size = xconfig_size + cname_len + 1 +
+ sizeof (struct GNUNET_TESTBED_HelperInit);
+ msg = GNUNET_realloc (xconfig, msg_size);
+ (void) memmove ( ((void *) &msg[1]) + cname_len + 1, msg, xconfig_size);
+ msg->header.size = htons (msg_size);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
+ msg->cname_size = htons (cname_len);
+ msg->config_size = htons (config_size);
+ (void) strcpy ((char *) &msg[1], cname);
+ return msg;
+}
+
+
/* end of testbed_api_hosts.c */
Modified: gnunet/src/testbed/testbed_api_hosts.h
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.h 2012-07-17 09:44:26 UTC (rev
22712)
+++ gnunet/src/testbed/testbed_api_hosts.h 2012-07-17 12:12:05 UTC (rev
22713)
@@ -23,11 +23,12 @@
* @brief internal API to access the 'hosts' subsystem
* @author Christian Grothoff
*/
+
#ifndef NEW_TESTING_API_HOSTS_H
#define NEW_TESTING_API_HOSTS_H
#include "gnunet_testbed_service.h"
-#include "gnunet_helper_lib.h"
+#include "testbed_helper.h"
/**
@@ -181,5 +182,20 @@
const struct GNUNET_TESTBED_Controller
*controller);
+
+/**
+ * Creates a helper initialization message. Only for testing.
+ *
+ * @param cname the ip address of the controlling host
+ * @param cfg the configuration that has to used to start the testbed service
+ * thru helper
+ * @return the initialization message
+ */
+struct GNUNET_TESTBED_HelperInit *
+GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
+ const struct
GNUNET_CONFIGURATION_Handle *cfg);
+
+
+
#endif
/* end of testbed_api_hosts.h */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22713 - gnunet/src/testbed,
gnunet <=