aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-05-07 14:35:46 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-05-07 14:35:46 +0000
commit05aa8d8001e3977adb5d68d851db608c075dffee (patch)
tree2c4e23e307a917d67fb41719f2b858bccea590aa /src/testbed/testbed_api.c
parent3029a328070bd5eb422261fb3559b01f415ae51c (diff)
downloadgnunet-05aa8d8001e3977adb5d68d851db608c075dffee.tar.gz
gnunet-05aa8d8001e3977adb5d68d851db608c075dffee.zip
fix #2665: peer reconfiguration now implemented
Diffstat (limited to 'src/testbed/testbed_api.c')
-rw-r--r--src/testbed/testbed_api.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 207f2658f..01df06729 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -455,6 +455,8 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c,
455 opc->data = NULL; 455 opc->data = NULL;
456 } 456 }
457 break; 457 break;
458 case OP_PEER_RECONFIGURE:
459 break;
458 default: 460 default:
459 GNUNET_assert (0); 461 GNUNET_assert (0);
460 } 462 }
@@ -780,6 +782,7 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
780 struct OperationContext *opc; 782 struct OperationContext *opc;
781 const char *emsg; 783 const char *emsg;
782 uint64_t op_id; 784 uint64_t op_id;
785 uint64_t mask;
783 struct GNUNET_TESTBED_EventInformation event; 786 struct GNUNET_TESTBED_EventInformation event;
784 787
785 op_id = GNUNET_ntohll (msg->operation_id); 788 op_id = GNUNET_ntohll (msg->operation_id);
@@ -814,8 +817,8 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
814 event.op_cls = opc->op_cls; 817 event.op_cls = opc->op_cls;
815 event.details.operation_finished.emsg = emsg; 818 event.details.operation_finished.emsg = emsg;
816 event.details.operation_finished.generic = NULL; 819 event.details.operation_finished.generic = NULL;
817 if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) && 820 mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
818 (NULL != c->cc)) 821 if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
819 { 822 {
820 exop_insert (event.op); 823 exop_insert (event.op);
821 c->cc (c->cc_cls, &event); 824 c->cc (c->cc_cls, &event);
@@ -1939,6 +1942,28 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
1939 xdata = (const Bytef *) &imsg[1]; 1942 xdata = (const Bytef *) &imsg[1];
1940 } 1943 }
1941 break; 1944 break;
1945 case GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER:
1946 {
1947 const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
1948
1949 imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *) msg;
1950 data_len = ntohs (imsg->config_size);
1951 xdata_len = ntohs (imsg->header.size) -
1952 sizeof (struct GNUNET_TESTBED_PeerCreateMessage);
1953 xdata = (const Bytef *) &imsg[1];
1954 }
1955 break;
1956 case GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER:
1957 {
1958 const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
1959
1960 imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *) msg;
1961 data_len = ntohs (imsg->config_size);
1962 xdata_len = ntohs (imsg->header.size) -
1963 sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage);
1964 xdata = (const Bytef *) &imsg[1];
1965 }
1966 break;
1942 default: 1967 default:
1943 GNUNET_assert (0); 1968 GNUNET_assert (0);
1944 } 1969 }
@@ -1946,7 +1971,7 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
1946 if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len))) 1971 if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
1947 { 1972 {
1948 GNUNET_free (data); 1973 GNUNET_free (data);
1949 GNUNET_break_op (0); 1974 GNUNET_break_op (0); /* Un-compression failure */
1950 return NULL; 1975 return NULL;
1951 } 1976 }
1952 cfg = GNUNET_CONFIGURATION_create (); 1977 cfg = GNUNET_CONFIGURATION_create ();
@@ -1956,7 +1981,7 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
1956 GNUNET_NO)) 1981 GNUNET_NO))
1957 { 1982 {
1958 GNUNET_free (data); 1983 GNUNET_free (data);
1959 GNUNET_break_op (0); 1984 GNUNET_break_op (0); /* De-serialization failure */
1960 return NULL; 1985 return NULL;
1961 } 1986 }
1962 GNUNET_free (data); 1987 GNUNET_free (data);