diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-10 19:33:49 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-10 19:33:49 +0000 |
commit | 8acf05794f3473e380e6d144e804bb818d8219ee (patch) | |
tree | 60ed75ecd6cd97c62e6d9e9a2b00130f9452a332 | |
parent | 2370b7bcd4649de55e06d86f16c35c360c93212b (diff) | |
download | gnunet-8acf05794f3473e380e6d144e804bb818d8219ee.tar.gz gnunet-8acf05794f3473e380e6d144e804bb818d8219ee.zip |
controller linking with host ids
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 2 | ||||
-rw-r--r-- | src/testbed/testbed_api.c | 85 | ||||
-rw-r--r-- | src/testbed/testbed_api.h | 54 |
3 files changed, 118 insertions, 23 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 56fff6450..da0d8b982 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c | |||
@@ -2535,7 +2535,7 @@ forwarded_overlay_connect_listener (void *cls, | |||
2535 | GNUNET_assert (NULL == focc->sub_op); | 2535 | GNUNET_assert (NULL == focc->sub_op); |
2536 | focc->state = FOCC_GET_CFG; | 2536 | focc->state = FOCC_GET_CFG; |
2537 | focc->sub_op = GNUNET_TESTBED_get_slave_config_ (focc, focc->gateway2, | 2537 | focc->sub_op = GNUNET_TESTBED_get_slave_config_ (focc, focc->gateway2, |
2538 | focc->peer2_host_id); | 2538 | focc->peer2_host_id); |
2539 | /* FIXME */ | 2539 | /* FIXME */ |
2540 | GNUNET_break (0); | 2540 | GNUNET_break (0); |
2541 | break; | 2541 | break; |
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 42db42a2f..f33336903 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -1819,15 +1819,14 @@ GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle | |||
1819 | 1819 | ||
1820 | 1820 | ||
1821 | /** | 1821 | /** |
1822 | * Same as the GNUNET_TESTBED_controller_link, however expects configuration in | 1822 | * Same as the GNUNET_TESTBED_controller_link_2, but with ids for delegated host |
1823 | * serialized and compressed | 1823 | * and slave host |
1824 | * | 1824 | * |
1825 | * @param op_cls the operation closure for the event which is generated to | 1825 | * @param op_cls the operation closure for the event which is generated to |
1826 | * signal success or failure of this operation | 1826 | * signal success or failure of this operation |
1827 | * @param master handle to the master controller who creates the association | 1827 | * @param master handle to the master controller who creates the association |
1828 | * @param delegated_host requests to which host should be delegated; cannot be NULL | 1828 | * @param delegated_host_id id of the host to which requests should be delegated |
1829 | * @param slave_host which host is used to run the slave controller; use NULL to | 1829 | * @param slave_host_id id of the host which is used to run the slave controller |
1830 | * make the master controller connect to the delegated host | ||
1831 | * @param sxcfg serialized and compressed configuration | 1830 | * @param sxcfg serialized and compressed configuration |
1832 | * @param sxcfg_size the size sxcfg | 1831 | * @param sxcfg_size the size sxcfg |
1833 | * @param scfg_size the size of uncompressed serialized configuration | 1832 | * @param scfg_size the size of uncompressed serialized configuration |
@@ -1954,6 +1953,53 @@ GNUNET_TESTBED_compress_config_ (const char *config, size_t size, | |||
1954 | 1953 | ||
1955 | 1954 | ||
1956 | /** | 1955 | /** |
1956 | * Same as the GNUNET_TESTBED_controller_link, but with ids for delegated host | ||
1957 | * and slave host | ||
1958 | * | ||
1959 | * @param op_cls the operation closure for the event which is generated to | ||
1960 | * signal success or failure of this operation | ||
1961 | * @param master handle to the master controller who creates the association | ||
1962 | * @param delegated_host requests to which host should be delegated; cannot be NULL | ||
1963 | * @param slave_host which host is used to run the slave controller; use NULL to | ||
1964 | * make the master controller connect to the delegated host | ||
1965 | * @param slave_cfg configuration to use for the slave controller | ||
1966 | * @param is_subordinate GNUNET_YES if the controller at delegated_host should | ||
1967 | * be started by the slave controller; GNUNET_NO if the slave | ||
1968 | * controller has to connect to the already started delegated | ||
1969 | * controller via TCP/IP | ||
1970 | * @return the operation handle | ||
1971 | */ | ||
1972 | struct GNUNET_TESTBED_Operation * | ||
1973 | GNUNET_TESTBED_controller_link_ (void *op_cls, | ||
1974 | struct GNUNET_TESTBED_Controller *master, | ||
1975 | uint32_t delegated_host_id, | ||
1976 | uint32_t slave_host_id, | ||
1977 | const struct GNUNET_CONFIGURATION_Handle | ||
1978 | *slave_cfg, | ||
1979 | int is_subordinate) | ||
1980 | { | ||
1981 | struct GNUNET_TESTBED_Operation *op; | ||
1982 | char *config; | ||
1983 | char *cconfig; | ||
1984 | size_t cc_size; | ||
1985 | size_t config_size; | ||
1986 | |||
1987 | config = GNUNET_CONFIGURATION_serialize (slave_cfg, &config_size); | ||
1988 | cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig); | ||
1989 | GNUNET_free (config); | ||
1990 | /* Configuration doesn't fit in 1 message */ | ||
1991 | GNUNET_assert ((UINT16_MAX - | ||
1992 | sizeof (struct GNUNET_TESTBED_ControllerLinkMessage)) >= | ||
1993 | cc_size); | ||
1994 | op = GNUNET_TESTBED_controller_link_2_ (op_cls, master, delegated_host_id, | ||
1995 | slave_host_id, (const char *) cconfig, | ||
1996 | cc_size, config_size, is_subordinate); | ||
1997 | GNUNET_free (cconfig); | ||
1998 | return op; | ||
1999 | } | ||
2000 | |||
2001 | |||
2002 | /** | ||
1957 | * Create a link from slave controller to delegated controller. Whenever the | 2003 | * Create a link from slave controller to delegated controller. Whenever the |
1958 | * master controller is asked to start a peer at the delegated controller the | 2004 | * master controller is asked to start a peer at the delegated controller the |
1959 | * request will be routed towards slave controller (if a route exists). The | 2005 | * request will be routed towards slave controller (if a route exists). The |
@@ -1990,28 +2036,23 @@ GNUNET_TESTBED_controller_link (void *op_cls, | |||
1990 | const struct GNUNET_CONFIGURATION_Handle | 2036 | const struct GNUNET_CONFIGURATION_Handle |
1991 | *slave_cfg, int is_subordinate) | 2037 | *slave_cfg, int is_subordinate) |
1992 | { | 2038 | { |
1993 | struct GNUNET_TESTBED_Operation *op; | 2039 | uint32_t slave_host_id; |
1994 | char *config; | 2040 | uint32_t delegated_host_id; |
1995 | char *cconfig; | ||
1996 | size_t cc_size; | ||
1997 | size_t config_size; | ||
1998 | 2041 | ||
1999 | GNUNET_assert (GNUNET_YES == | 2042 | GNUNET_assert (GNUNET_YES == |
2000 | GNUNET_TESTBED_is_host_registered_ (delegated_host, master)); | 2043 | GNUNET_TESTBED_is_host_registered_ (delegated_host, master)); |
2001 | if ((NULL != slave_host) && (0 != GNUNET_TESTBED_host_get_id_ (slave_host))) | 2044 | slave_host_id = (NULL == slave_host) ? |
2045 | 0 : GNUNET_TESTBED_host_get_id_ (slave_host); | ||
2046 | delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host); | ||
2047 | if ((NULL != slave_host) && (0 != slave_host_id)) | ||
2002 | GNUNET_assert (GNUNET_YES == | 2048 | GNUNET_assert (GNUNET_YES == |
2003 | GNUNET_TESTBED_is_host_registered_ (slave_host, master)); | 2049 | GNUNET_TESTBED_is_host_registered_ (slave_host, master)); |
2004 | config = GNUNET_CONFIGURATION_serialize (slave_cfg, &config_size); | 2050 | return GNUNET_TESTBED_controller_link_ (op_cls, master, |
2005 | cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig); | 2051 | delegated_host_id, |
2006 | GNUNET_free (config); | 2052 | slave_host_id, |
2007 | /* Configuration doesn't fit in 1 message */ | 2053 | slave_cfg, |
2008 | GNUNET_assert ((UINT16_MAX - | 2054 | is_subordinate); |
2009 | sizeof (struct GNUNET_TESTBED_ControllerLinkMessage)) >= cc_size); | 2055 | |
2010 | op = GNUNET_TESTBED_controller_link_2 (op_cls, master, delegated_host, | ||
2011 | slave_host, (const char *) cconfig, | ||
2012 | cc_size, config_size, is_subordinate); | ||
2013 | GNUNET_free (cconfig); | ||
2014 | return op; | ||
2015 | } | 2056 | } |
2016 | 2057 | ||
2017 | 2058 | ||
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h index 45815c057..ac44c8820 100644 --- a/src/testbed/testbed_api.h +++ b/src/testbed/testbed_api.h | |||
@@ -453,5 +453,59 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls, | |||
453 | struct GNUNET_TESTBED_Controller *master, | 453 | struct GNUNET_TESTBED_Controller *master, |
454 | uint32_t slave_host_id); | 454 | uint32_t slave_host_id); |
455 | 455 | ||
456 | |||
457 | /** | ||
458 | * Same as the GNUNET_TESTBED_controller_link_2, but with ids for delegated host | ||
459 | * and slave host | ||
460 | * | ||
461 | * @param op_cls the operation closure for the event which is generated to | ||
462 | * signal success or failure of this operation | ||
463 | * @param master handle to the master controller who creates the association | ||
464 | * @param delegated_host_id id of the host to which requests should be delegated | ||
465 | * @param slave_host_id id of the host which is used to run the slave controller | ||
466 | * @param sxcfg serialized and compressed configuration | ||
467 | * @param sxcfg_size the size sxcfg | ||
468 | * @param scfg_size the size of uncompressed serialized configuration | ||
469 | * @param is_subordinate GNUNET_YES if the controller at delegated_host should | ||
470 | * be started by the slave controller; GNUNET_NO if the slave | ||
471 | * controller has to connect to the already started delegated | ||
472 | * controller via TCP/IP | ||
473 | * @return the operation handle | ||
474 | */ | ||
475 | struct GNUNET_TESTBED_Operation * | ||
476 | GNUNET_TESTBED_controller_link_2_ (void *op_cls, | ||
477 | struct GNUNET_TESTBED_Controller *master, | ||
478 | uint32_t delegated_host_id, | ||
479 | uint32_t slave_host_id, | ||
480 | const char *sxcfg, size_t sxcfg_size, | ||
481 | size_t scfg_size, int is_subordinate); | ||
482 | |||
483 | |||
484 | /** | ||
485 | * Same as the GNUNET_TESTBED_controller_link, but with ids for delegated host | ||
486 | * and slave host | ||
487 | * | ||
488 | * @param op_cls the operation closure for the event which is generated to | ||
489 | * signal success or failure of this operation | ||
490 | * @param master handle to the master controller who creates the association | ||
491 | * @param delegated_host requests to which host should be delegated; cannot be NULL | ||
492 | * @param slave_host which host is used to run the slave controller; use NULL to | ||
493 | * make the master controller connect to the delegated host | ||
494 | * @param slave_cfg configuration to use for the slave controller | ||
495 | * @param is_subordinate GNUNET_YES if the controller at delegated_host should | ||
496 | * be started by the slave controller; GNUNET_NO if the slave | ||
497 | * controller has to connect to the already started delegated | ||
498 | * controller via TCP/IP | ||
499 | * @return the operation handle | ||
500 | */ | ||
501 | struct GNUNET_TESTBED_Operation * | ||
502 | GNUNET_TESTBED_controller_link_ (void *op_cls, | ||
503 | struct GNUNET_TESTBED_Controller *master, | ||
504 | uint32_t delegated_host_id, | ||
505 | uint32_t slave_host_id, | ||
506 | const struct GNUNET_CONFIGURATION_Handle | ||
507 | *slave_cfg, | ||
508 | int is_subordinate); | ||
509 | |||
456 | #endif | 510 | #endif |
457 | /* end of testbed_api.h */ | 511 | /* end of testbed_api.h */ |