GNUnet  0.10.x
testbed_api.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2008--2013 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
29 #include "platform.h"
30 #include "gnunet_testbed_service.h"
31 #include "gnunet_core_service.h"
32 #include "gnunet_constants.h"
34 #include "gnunet_hello_lib.h"
35 #include <zlib.h>
36 
37 #include "testbed.h"
38 #include "testbed_api.h"
39 #include "testbed_api_hosts.h"
40 #include "testbed_api_peers.h"
41 #include "testbed_api_operations.h"
42 #include "testbed_api_sd.h"
43 
47 #define LOG(kind, ...) GNUNET_log_from(kind, "testbed-api", __VA_ARGS__)
48 
52 #define LOG_DEBUG(...) LOG(GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
53 
57 #define TIME_REL_SECS(sec) \
58  GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, sec)
59 
60 
64 #define TIMEOUT_REL TIME_REL_SECS(1)
65 
66 
75 
79  void *cc_cls;
80 };
81 
82 
90  uint32_t slave_id;
91 };
92 
93 
102 
106  uint32_t host_id;
107 };
108 
109 
118 
122  void *cb_cls;
123 };
124 
125 
134 
139 
144 };
145 
146 
151 
156 
157 
163 static void
165 {
166  struct ExpireOperationEntry *entry;
167 
168  entry = GNUNET_new(struct ExpireOperationEntry);
169  entry->op = op;
170  GNUNET_CONTAINER_DLL_insert_tail(exop_head, exop_tail, entry);
171 }
172 
173 
185 static int
187 {
188  struct ExpireOperationEntry *entry;
189  struct ExpireOperationEntry *entry2;
190  int found;
191 
192  found = GNUNET_NO;
193  entry = exop_head;
194  while (NULL != entry)
195  {
196  if (op == entry->op)
197  {
198  found = GNUNET_YES;
199  break;
200  }
201  entry = entry->next;
202  }
203  if (GNUNET_NO == found)
204  return GNUNET_NO;
205  /* Truncate the tail */
206  while (NULL != entry)
207  {
208  entry2 = entry->next;
209  GNUNET_CONTAINER_DLL_remove(exop_head, exop_tail, entry);
210  GNUNET_free(entry);
211  entry = entry2;
212  }
213  return GNUNET_YES;
214 }
215 
216 
225 
229  uint64_t id;
230 };
231 
232 
242 static int
243 opc_search_iterator(void *cls, uint32_t key, void *value)
244 {
245  struct SearchContext *sc = cls;
246  struct OperationContext *opc = value;
247 
248  GNUNET_assert(NULL != opc);
249  GNUNET_assert(NULL == sc->opc);
250  if (opc->id != sc->id)
251  return GNUNET_YES;
252  sc->opc = opc;
253  return GNUNET_NO;
254 }
255 
256 
265 static struct OperationContext *
266 find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
267 {
268  struct SearchContext sc;
269 
270  sc.id = id;
271  sc.opc = NULL;
272  GNUNET_assert(NULL != c->opc_map);
273  if (GNUNET_SYSERR !=
275  (uint32_t)id,
277  &sc))
278  return NULL;
279  return sc.opc;
280 }
281 
282 
291 void
293  struct OperationContext *opc)
294 {
295  if (NULL == c->opc_map)
298  c->opc_map,
299  (uint32_t)opc->id,
300  opc,
302 }
303 
304 
312 void
314  struct OperationContext *opc)
315 {
316  GNUNET_assert(NULL != c->opc_map);
319  (uint32_t)opc->id,
320  opc));
322  (NULL != c->opcq_empty_cb))
324 }
325 
326 
334 static int
337 {
338  const char *emsg;
339  uint16_t msg_size;
340 
341  msg_size = ntohs(msg->header.size) - sizeof(*msg);
342  if (0 == msg_size)
343  return GNUNET_OK;
344  /* We have an error message */
345  emsg = (const char *)&msg[1];
346  if ('\0' != emsg[msg_size - 1])
347  {
348  GNUNET_break(0);
349  return GNUNET_SYSERR;
350  }
351  return GNUNET_OK;
352 }
353 
354 
362 static void
365 {
366  struct GNUNET_TESTBED_Controller *c = cls;
368  const char *emsg;
369  uint16_t msg_size;
370 
371  if (NULL == rh)
372  return;
373  if (GNUNET_TESTBED_host_get_id_(rh->host) != ntohl(msg->host_id))
374  {
375  LOG_DEBUG("Mismatch in host id's %u, %u of host confirm msg\n",
377  ntohl(msg->host_id));
378  return;
379  }
380  c->rh = NULL;
381  msg_size = ntohs(msg->header.size) - sizeof(*msg);
382  if (0 == msg_size)
383  {
384  LOG_DEBUG("Host %u successfully registered\n", ntohl(msg->host_id));
386  rh->cc(rh->cc_cls, NULL);
387  GNUNET_free(rh);
388  return;
389  }
390  /* We have an error message */
391  emsg = (const char *)&msg[1];
393  _("Adding host %u failed with error: %s\n"),
394  ntohl(msg->host_id),
395  emsg);
396  rh->cc(rh->cc_cls, emsg);
397  GNUNET_free(rh);
398 }
399 
400 
408 static void
410  struct OperationContext *opc,
411  const struct GNUNET_MessageHeader *msg)
412 {
413  struct GNUNET_TESTBED_Controller *c = cls;
414  struct ForwardedOperationData *fo_data;
415 
416  fo_data = opc->data;
417  if (NULL != fo_data->cc)
418  fo_data->cc(fo_data->cc_cls, msg);
420  GNUNET_free(fo_data);
421  GNUNET_free(opc);
422 }
423 
424 
432 static void
434  void *cls,
436 {
437  struct GNUNET_TESTBED_Controller *c = cls;
438  struct OperationContext *opc;
440  void *op_comp_cb_cls;
441  struct GNUNET_TESTBED_EventInformation event;
442  uint64_t op_id;
443 
444  op_id = GNUNET_ntohll(msg->operation_id);
445  LOG_DEBUG("Operation %lu successful\n", op_id);
446  if (NULL == (opc = find_opc(c, op_id)))
447  {
448  LOG_DEBUG("Operation not found\n");
449  return;
450  }
452  event.op = opc->op;
453  event.op_cls = opc->op_cls;
454  event.details.operation_finished.emsg = NULL;
455  event.details.operation_finished.generic = NULL;
456  op_comp_cb = NULL;
457  op_comp_cb_cls = NULL;
458  switch (opc->type)
459  {
460  case OP_FORWARDED: {
462  opc,
463  (const struct GNUNET_MessageHeader *)msg);
464  return;
465  }
466  break;
467 
468  case OP_PEER_DESTROY: {
469  struct GNUNET_TESTBED_Peer *peer;
470 
471  peer = opc->data;
473  GNUNET_free(peer);
474  opc->data = NULL;
475  //PEERDESTROYDATA
476  }
477  break;
478 
479  case OP_SHUTDOWN_PEERS: {
480  struct ShutdownPeersData *data;
481 
482  data = opc->data;
483  op_comp_cb = data->cb;
484  op_comp_cb_cls = data->cb_cls;
485  GNUNET_free(data);
486  opc->data = NULL;
488  }
489  break;
490 
491  case OP_MANAGE_SERVICE: {
492  struct ManageServiceData *data;
493 
494  GNUNET_assert(NULL != (data = opc->data));
495  op_comp_cb = data->cb;
496  op_comp_cb_cls = data->cb_cls;
497  GNUNET_free(data);
498  opc->data = NULL;
499  }
500  break;
501 
502  case OP_PEER_RECONFIGURE:
503  break;
504 
505  default:
506  GNUNET_assert(0);
507  }
508  GNUNET_TESTBED_remove_opc_(opc->c, opc);
509  opc->state = OPC_STATE_FINISHED;
510  exop_insert(event.op);
511  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
512  {
513  if (NULL != c->cc)
514  c->cc(c->cc_cls, &event);
515  if (GNUNET_NO == exop_check(event.op))
516  return;
517  }
518  else
519  LOG_DEBUG("Not calling callback\n");
520  if (NULL != op_comp_cb)
521  op_comp_cb(op_comp_cb_cls, event.op, NULL);
522  /* You could have marked the operation as done by now */
523  GNUNET_break(GNUNET_NO == exop_check(event.op));
524 }
525 
526 
534 static void
536  void *cls,
538 {
539  struct GNUNET_TESTBED_Controller *c = cls;
540  struct OperationContext *opc;
541  struct PeerCreateData *data;
542  struct GNUNET_TESTBED_Peer *peer;
545  void *cb_cls;
546  uint64_t op_id;
547 
549  ntohs(msg->header.size));
550  op_id = GNUNET_ntohll(msg->operation_id);
551  if (NULL == (opc = find_opc(c, op_id)))
552  {
553  LOG_DEBUG("Operation context for PeerCreateSuccessEvent not found\n");
554  return;
555  }
556  if (OP_FORWARDED == opc->type)
557  {
559  opc,
560  (const struct GNUNET_MessageHeader *)msg);
561  return;
562  }
564  GNUNET_assert(NULL != opc->data);
565  data = opc->data;
566  GNUNET_assert(NULL != data->peer);
567  peer = data->peer;
568  GNUNET_assert(peer->unique_id == ntohl(msg->peer_id));
569  peer->state = TESTBED_PS_CREATED;
571  cb = data->cb;
572  cb_cls = data->cls;
573  op = opc->op;
574  GNUNET_free(opc->data);
575  GNUNET_TESTBED_remove_opc_(opc->c, opc);
576  opc->state = OPC_STATE_FINISHED;
577  exop_insert(op);
578  if (NULL != cb)
579  cb(cb_cls, peer, NULL);
580  /* You could have marked the operation as done by now */
582 }
583 
584 
592 static void
594 {
595  struct GNUNET_TESTBED_Controller *c = cls;
596  struct OperationContext *opc;
597  struct GNUNET_TESTBED_Peer *peer;
598  struct PeerEventData *data;
600  void *pcc_cls;
601  struct GNUNET_TESTBED_EventInformation event;
602  uint64_t op_id;
603  uint64_t mask;
604 
606  ntohs(msg->header.size));
607  op_id = GNUNET_ntohll(msg->operation_id);
608  if (NULL == (opc = find_opc(c, op_id)))
609  {
610  LOG_DEBUG("Operation not found\n");
611  return;
612  }
613  if (OP_FORWARDED == opc->type)
614  {
616  opc,
617  (const struct GNUNET_MessageHeader *)msg);
618  return;
619  }
620  GNUNET_assert((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
621  data = opc->data;
622  GNUNET_assert(NULL != data);
623  peer = data->peer;
624  GNUNET_assert(NULL != peer);
625  event.type = (enum GNUNET_TESTBED_EventType)ntohl(msg->event_type);
626  event.op = opc->op;
627  event.op_cls = opc->op_cls;
628  switch (event.type)
629  {
631  peer->state = TESTBED_PS_STARTED;
632  event.details.peer_start.host = peer->host;
633  event.details.peer_start.peer = peer;
634  break;
635 
637  peer->state = TESTBED_PS_STOPPED;
638  event.details.peer_stop.peer = peer;
639  break;
640 
641  default:
642  GNUNET_assert(0); /* We should never reach this state */
643  }
644  pcc = data->pcc;
645  pcc_cls = data->pcc_cls;
646  GNUNET_free(data);
647  GNUNET_TESTBED_remove_opc_(opc->c, opc);
648  opc->state = OPC_STATE_FINISHED;
649  exop_insert(event.op);
650  mask = 1LL << GNUNET_TESTBED_ET_PEER_START;
651  mask |= 1LL << GNUNET_TESTBED_ET_PEER_STOP;
652  if (0 != (mask & c->event_mask))
653  {
654  if (NULL != c->cc)
655  c->cc(c->cc_cls, &event);
656  if (GNUNET_NO == exop_check(event.op))
657  return;
658  }
659  if (NULL != pcc)
660  pcc(pcc_cls, NULL);
661  /* You could have marked the operation as done by now */
662  GNUNET_break(GNUNET_NO == exop_check(event.op));
663 }
664 
665 
673 static void
676 {
677  struct GNUNET_TESTBED_Controller *c = cls;
678  struct OperationContext *opc;
679  struct OverlayConnectData *data;
681  void *cb_cls;
682  struct GNUNET_TESTBED_EventInformation event;
683  uint64_t op_id;
684  uint64_t mask;
685 
686  op_id = GNUNET_ntohll(msg->operation_id);
687  if (NULL == (opc = find_opc(c, op_id)))
688  {
689  LOG_DEBUG("Operation not found\n");
690  return;
691  }
692  if (OP_FORWARDED == opc->type)
693  {
695  opc,
696  (const struct GNUNET_MessageHeader *)msg);
697  return;
698  }
700  GNUNET_assert(NULL != (data = opc->data));
701  GNUNET_assert((ntohl(msg->peer1) == data->p1->unique_id) &&
702  (ntohl(msg->peer2) == data->p2->unique_id));
703  event.type = (enum GNUNET_TESTBED_EventType)ntohl(msg->event_type);
704  event.op = opc->op;
705  event.op_cls = opc->op_cls;
706  switch (event.type)
707  {
709  event.details.peer_connect.peer1 = data->p1;
710  event.details.peer_connect.peer2 = data->p2;
711  break;
712 
714  GNUNET_assert(0); /* FIXME: implement */
715  break;
716 
717  default:
718  GNUNET_assert(0); /* Should never reach here */
719  break;
720  }
721  cb = data->cb;
722  cb_cls = data->cb_cls;
723  GNUNET_TESTBED_remove_opc_(opc->c, opc);
724  opc->state = OPC_STATE_FINISHED;
725  exop_insert(event.op);
726  mask = 1LL << GNUNET_TESTBED_ET_CONNECT;
727  mask |= 1LL << GNUNET_TESTBED_ET_DISCONNECT;
728  if (0 != (mask & c->event_mask))
729  {
730  if (NULL != c->cc)
731  c->cc(c->cc_cls, &event);
732  if (GNUNET_NO == exop_check(event.op))
733  return;
734  }
735  if (NULL != cb)
736  cb(cb_cls, opc->op, NULL);
737  /* You could have marked the operation as done by now */
738  GNUNET_break(GNUNET_NO == exop_check(event.op));
739 }
740 
741 
749 static int
751  void *cls,
753 {
754  /* anything goes? */
755  return GNUNET_OK;
756 }
757 
758 
766 static void
768  void *cls,
770 {
771  struct GNUNET_TESTBED_Controller *c = cls;
772  struct OperationContext *opc;
773  struct GNUNET_TESTBED_Peer *peer;
774  struct PeerInfoData *data;
775  struct GNUNET_TESTBED_PeerInformation *pinfo;
777  void *cb_cls;
778  uint64_t op_id;
779 
780  op_id = GNUNET_ntohll(msg->operation_id);
781  if (NULL == (opc = find_opc(c, op_id)))
782  {
783  LOG_DEBUG("Operation not found\n");
784  return;
785  }
786  if (OP_FORWARDED == opc->type)
787  {
788  handle_forwarded_operation_msg(c, opc, &msg->header);
789  return;
790  }
791  data = opc->data;
792  GNUNET_assert(NULL != data);
793  peer = data->peer;
794  GNUNET_assert(NULL != peer);
795  GNUNET_assert(ntohl(msg->peer_id) == peer->unique_id);
797  pinfo->pit = data->pit;
798  cb = data->cb;
799  cb_cls = data->cb_cls;
800  GNUNET_assert(NULL != cb);
801  GNUNET_free(data);
802  opc->data = NULL;
803  switch (pinfo->pit)
804  {
806  pinfo->result.id = GNUNET_new(struct GNUNET_PeerIdentity);
807  GNUNET_memcpy(pinfo->result.id,
808  &msg->peer_identity,
809  sizeof(struct GNUNET_PeerIdentity));
810  break;
811 
813  pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
815  break;
816 
818  GNUNET_assert(0); /* never reach here */
819  break;
820  }
821  opc->data = pinfo;
822  GNUNET_TESTBED_remove_opc_(opc->c, opc);
823  opc->state = OPC_STATE_FINISHED;
824  cb(cb_cls, opc->op, pinfo, NULL);
825  /* We dont check whether the operation is marked as done here as the
826  operation contains data (cfg/identify) which will be freed at a later point
827  */
828 }
829 
830 
839 static int
841  void *cls,
843 {
844  /* we accept anything as a valid error message */
845  return GNUNET_OK;
846 }
847 
848 
856 static void
858  void *cls,
860 {
861  struct GNUNET_TESTBED_Controller *c = cls;
862  struct OperationContext *opc;
863  const char *emsg;
864  uint64_t op_id;
865  uint64_t mask;
866  struct GNUNET_TESTBED_EventInformation event;
867 
868  op_id = GNUNET_ntohll(msg->operation_id);
869  if (NULL == (opc = find_opc(c, op_id)))
870  {
871  LOG_DEBUG("Operation not found\n");
872  return;
873  }
874  if (OP_FORWARDED == opc->type)
875  {
877  opc,
878  (const struct GNUNET_MessageHeader *)msg);
879  return;
880  }
881  GNUNET_TESTBED_remove_opc_(opc->c, opc);
882  opc->state = OPC_STATE_FINISHED;
884  if (NULL == emsg)
885  emsg = "Unknown error";
886  if (OP_PEER_INFO == opc->type)
887  {
888  struct PeerInfoData *data;
889 
890  data = opc->data;
891  if (NULL != data->cb)
892  data->cb(data->cb_cls, opc->op, NULL, emsg);
893  GNUNET_free(data);
894  return; /* We do not call controller callback for peer info */
895  }
897  event.op = opc->op;
898  event.op_cls = opc->op_cls;
899  event.details.operation_finished.emsg = emsg;
900  event.details.operation_finished.generic = NULL;
901  mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
902  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
903  {
904  exop_insert(event.op);
905  c->cc(c->cc_cls, &event);
906  if (GNUNET_NO == exop_check(event.op))
907  return;
908  }
909  switch (opc->type)
910  {
911  case OP_PEER_CREATE: {
912  struct PeerCreateData *data;
913 
914  data = opc->data;
915  GNUNET_free(data->peer);
916  if (NULL != data->cb)
917  data->cb(data->cls, NULL, emsg);
918  GNUNET_free(data);
919  }
920  break;
921 
922  case OP_PEER_START:
923  case OP_PEER_STOP: {
924  struct PeerEventData *data;
925 
926  data = opc->data;
927  if (NULL != data->pcc)
928  data->pcc(data->pcc_cls, emsg);
929  GNUNET_free(data);
930  }
931  break;
932 
933  case OP_PEER_DESTROY:
934  break;
935 
936  case OP_PEER_INFO:
937  GNUNET_assert(0);
938 
939  case OP_OVERLAY_CONNECT: {
940  struct OverlayConnectData *data;
941 
942  data = opc->data;
944  if (NULL != data->cb)
945  data->cb(data->cb_cls, opc->op, emsg);
946  }
947  break;
948 
949  case OP_FORWARDED:
950  GNUNET_assert(0);
951 
952  case OP_LINK_CONTROLLERS: /* No secondary callback */
953  break;
954 
955  case OP_SHUTDOWN_PEERS: {
956  struct ShutdownPeersData *data;
957 
958  data = opc->data;
959  GNUNET_free(data); /* FIXME: Decide whether we call data->op_cb */
960  opc->data = NULL;
961  }
962  break;
963 
964  case OP_MANAGE_SERVICE: {
965  struct ManageServiceData *data = opc->data;
967  void *cb_cls;
968 
969  GNUNET_assert(NULL != data);
970  cb = data->cb;
971  cb_cls = data->cb_cls;
972  GNUNET_free(data);
973  opc->data = NULL;
974  exop_insert(event.op);
975  if (NULL != cb)
976  cb(cb_cls, opc->op, emsg);
977  /* You could have marked the operation as done by now */
978  GNUNET_break(GNUNET_NO == exop_check(event.op));
979  }
980  break;
981 
982  default:
983  GNUNET_break(0);
984  }
985 }
986 
987 
997 {
999  uint16_t msize;
1000 
1001  msize = sizeof(struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
1002  msg = GNUNET_malloc(msize);
1003  msg->header.size = htons(msize);
1004  msg->header.type =
1006  msg->operation_id = GNUNET_htonll(op_id);
1007  msg->slave_id = htonl(slave_id);
1008  return msg;
1009 }
1010 
1011 
1019 static int
1021  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1022 {
1023  /* anything goes? */
1024  return GNUNET_OK;
1025 }
1026 
1027 
1035 static void
1037  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1038 {
1039  struct GNUNET_TESTBED_Controller *c = cls;
1040  struct OperationContext *opc;
1041  uint64_t op_id;
1042  uint64_t mask;
1043  struct GNUNET_TESTBED_EventInformation event;
1044 
1045  op_id = GNUNET_ntohll(msg->operation_id);
1046  if (NULL == (opc = find_opc(c, op_id)))
1047  {
1048  LOG_DEBUG("Operation not found\n");
1049  return;
1050  }
1051  if (OP_GET_SLAVE_CONFIG != opc->type)
1052  {
1053  GNUNET_break(0);
1054  return;
1055  }
1056  opc->state = OPC_STATE_FINISHED;
1057  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1059  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
1060  {
1063  event.op = opc->op;
1064  event.op_cls = opc->op_cls;
1065  event.details.operation_finished.generic = opc->data;
1066  event.details.operation_finished.emsg = NULL;
1067  c->cc(c->cc_cls, &event);
1068  }
1069 }
1070 
1071 
1080 static int
1082  void *cls,
1084 {
1085  /* actual check to be implemented */
1086  return GNUNET_OK;
1087 }
1088 
1089 
1097 static void
1099  void *cls,
1101 {
1102  struct GNUNET_TESTBED_Controller *c = cls;
1103  struct OperationContext *opc;
1104  struct ControllerLinkData *data;
1106  struct GNUNET_TESTBED_Host *host;
1107  char *emsg;
1108  uint64_t op_id;
1109  struct GNUNET_TESTBED_EventInformation event;
1110 
1111  op_id = GNUNET_ntohll(msg->operation_id);
1112  if (NULL == (opc = find_opc(c, op_id)))
1113  {
1114  LOG_DEBUG("Operation not found\n");
1115  return;
1116  }
1117  if (OP_FORWARDED == opc->type)
1118  {
1120  opc,
1121  (const struct GNUNET_MessageHeader *)msg);
1122  return;
1123  }
1124  if (OP_LINK_CONTROLLERS != opc->type)
1125  {
1126  GNUNET_break(0);
1127  return;
1128  }
1129  GNUNET_assert(NULL != (data = opc->data));
1131  GNUNET_assert(NULL != host);
1132  GNUNET_free(data);
1133  opc->data = NULL;
1134  opc->state = OPC_STATE_FINISHED;
1135  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1137  event.op = opc->op;
1138  event.op_cls = opc->op_cls;
1139  event.details.operation_finished.emsg = NULL;
1140  event.details.operation_finished.generic = NULL;
1141  emsg = NULL;
1142  cfg = NULL;
1143  if (GNUNET_NO == ntohs(msg->success))
1144  {
1145  emsg =
1146  GNUNET_malloc(ntohs(msg->header.size) -
1147  sizeof(struct GNUNET_TESTBED_ControllerLinkResponse) + 1);
1148  GNUNET_memcpy(emsg,
1149  &msg[1],
1150  ntohs(msg->header.size) -
1151  sizeof(struct GNUNET_TESTBED_ControllerLinkResponse));
1152  event.details.operation_finished.emsg = emsg;
1153  }
1154  else
1155  {
1156  if (0 != ntohs(msg->config_size))
1157  {
1159  (const struct GNUNET_MessageHeader *)msg);
1160  GNUNET_assert(NULL != cfg);
1162  }
1163  }
1164  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
1165  {
1166  if (NULL != c->cc)
1167  c->cc(c->cc_cls, &event);
1168  }
1169  else
1170  LOG_DEBUG("Not calling callback\n");
1171  if (NULL != cfg)
1173  GNUNET_free_non_null(emsg);
1174 }
1175 
1176 
1186 static int
1188  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1189 {
1190  uint16_t msize;
1191  uint16_t name_len;
1192  int status;
1193  const char *name;
1194  size_t emsg_len;
1195 
1196  msize = ntohs(msg->header.size);
1197  name = msg->data;
1198  name_len = ntohs(msg->name_len);
1199 
1200  if (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) + name_len + 1 > msize)
1201  {
1202  GNUNET_break_op(0);
1203  return GNUNET_SYSERR;
1204  }
1205  if ('\0' != name[name_len])
1206  {
1207  GNUNET_break_op(0);
1208  return GNUNET_SYSERR;
1209  }
1210  status = ntohs(msg->status);
1211  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1212  {
1213  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) +
1214  name_len + 1); /* +1!? */
1215  if (0 == emsg_len)
1216  {
1217  GNUNET_break_op(0);
1218  return GNUNET_SYSERR;
1219  }
1220  }
1221  return GNUNET_OK;
1222 }
1223 
1224 
1232 static void
1234  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1235 {
1236  struct GNUNET_TESTBED_Controller *c = cls;
1237  struct GNUNET_TESTBED_Barrier *barrier;
1238  char *emsg;
1239  const char *name;
1240  struct GNUNET_HashCode key;
1241  size_t emsg_len;
1242  int status;
1243  uint16_t msize;
1244  uint16_t name_len;
1245 
1246  emsg = NULL;
1247  barrier = NULL;
1248  msize = ntohs(msg->header.size);
1249  if (msize <= sizeof(struct GNUNET_TESTBED_BarrierStatusMsg))
1250  {
1251  GNUNET_break_op(0);
1252  goto cleanup;
1253  }
1254  name = msg->data;
1255  name_len = ntohs(msg->name_len);
1256  if (name_len >= //name_len is strlen(barrier_name)
1257  (msize - ((sizeof msg->header) + sizeof(msg->status))))
1258  {
1259  GNUNET_break_op(0);
1260  goto cleanup;
1261  }
1262  if ('\0' != name[name_len])
1263  {
1264  GNUNET_break_op(0);
1265  goto cleanup;
1266  }
1267  LOG_DEBUG("Received BARRIER_STATUS msg\n");
1268  status = ntohs(msg->status);
1269  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1270  {
1271  status = -1;
1272  //unlike name_len, emsg_len includes the trailing zero
1273  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) +
1274  (name_len + 1));
1275  if (0 == emsg_len)
1276  {
1277  GNUNET_break_op(0);
1278  goto cleanup;
1279  }
1280  if ('\0' != (msg->data[(name_len + 1) + (emsg_len - 1)]))
1281  {
1282  GNUNET_break_op(0);
1283  goto cleanup;
1284  }
1285  emsg = GNUNET_malloc(emsg_len);
1286  GNUNET_memcpy(emsg, msg->data + name_len + 1, emsg_len);
1287  }
1288  if (NULL == c->barrier_map)
1289  {
1290  GNUNET_break_op(0);
1291  goto cleanup;
1292  }
1293  GNUNET_CRYPTO_hash(name, name_len, &key);
1294  barrier = GNUNET_CONTAINER_multihashmap_get(c->barrier_map, &key);
1295  if (NULL == barrier)
1296  {
1297  GNUNET_break_op(0);
1298  goto cleanup;
1299  }
1300  GNUNET_assert(NULL != barrier->cb);
1301  if ((GNUNET_YES == barrier->echo) &&
1304  barrier->cb(barrier->cls, name, barrier, status, emsg);
1306  return; /* just initialised; skip cleanup */
1307 
1308 cleanup:
1309  GNUNET_free_non_null(emsg);
1316  if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
1318 }
1319 
1320 
1327 void
1329  struct GNUNET_MessageHeader *msg)
1330 {
1331  struct GNUNET_MQ_Envelope *env;
1332  struct GNUNET_MessageHeader *m2;
1333  uint16_t type;
1334  uint16_t size;
1335 
1336  type = ntohs(msg->type);
1337  size = ntohs(msg->size);
1340  env = GNUNET_MQ_msg_extra(m2, size - sizeof(*m2), type);
1341  GNUNET_memcpy(m2, msg, size);
1342  GNUNET_free(msg);
1343  GNUNET_MQ_send(controller->mq, env);
1344 }
1345 
1346 
1361 struct OperationContext *
1363  struct GNUNET_TESTBED_Controller *controller,
1364  uint64_t operation_id,
1365  const struct GNUNET_MessageHeader *msg,
1367  void *cc_cls)
1368 {
1369  struct OperationContext *opc;
1370  struct ForwardedOperationData *data;
1371  struct GNUNET_MQ_Envelope *env;
1372  struct GNUNET_MessageHeader *m2;
1373  uint16_t type = ntohs(msg->type);
1374  uint16_t size = ntohs(msg->size);
1375 
1376  env = GNUNET_MQ_msg_extra(m2, size - sizeof(*m2), type);
1377  GNUNET_memcpy(m2, msg, size);
1378  GNUNET_MQ_send(controller->mq, env);
1379  data = GNUNET_new(struct ForwardedOperationData);
1380  data->cc = cc;
1381  data->cc_cls = cc_cls;
1382  opc = GNUNET_new(struct OperationContext);
1383  opc->c = controller;
1384  opc->type = OP_FORWARDED;
1385  opc->data = data;
1386  opc->id = operation_id;
1387  GNUNET_TESTBED_insert_opc_(controller, opc);
1388  return opc;
1389 }
1390 
1391 
1398 void
1400 {
1401  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1402  GNUNET_free(opc->data);
1403  GNUNET_free(opc);
1404 }
1405 
1406 
1413 static void
1415 {
1416  struct OperationContext *opc = cls;
1417  struct ControllerLinkData *data;
1419 
1420  GNUNET_assert(NULL != opc->data);
1421  data = opc->data;
1422  msg = data->msg;
1423  data->msg = NULL;
1424  opc->state = OPC_STATE_STARTED;
1425  GNUNET_TESTBED_insert_opc_(opc->c, opc);
1426  GNUNET_TESTBED_queue_message_(opc->c, &msg->header);
1427 }
1428 
1429 
1435 static void
1437 {
1438  struct OperationContext *opc = cls;
1439  struct ControllerLinkData *data;
1440 
1441  data = opc->data;
1442  switch (opc->state)
1443  {
1444  case OPC_STATE_INIT:
1445  GNUNET_free(data->msg);
1446  break;
1447 
1448  case OPC_STATE_STARTED:
1449  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1450  break;
1451 
1452  case OPC_STATE_FINISHED:
1453  break;
1454  }
1455  GNUNET_free_non_null(data);
1456  GNUNET_free(opc);
1457 }
1458 
1459 
1465 static void
1467 {
1468  struct OperationContext *opc = cls;
1469  struct GetSlaveConfigData *data = opc->data;
1471 
1472  GNUNET_assert(NULL != data);
1474  GNUNET_free(opc->data);
1475  data = NULL;
1476  opc->data = NULL;
1477  GNUNET_TESTBED_insert_opc_(opc->c, opc);
1478  GNUNET_TESTBED_queue_message_(opc->c, &msg->header);
1479  opc->state = OPC_STATE_STARTED;
1480 }
1481 
1482 
1488 static void
1490 {
1491  struct OperationContext *opc = cls;
1492 
1493  switch (opc->state)
1494  {
1495  case OPC_STATE_INIT:
1496  GNUNET_free(opc->data);
1497  break;
1498 
1499  case OPC_STATE_STARTED:
1500  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1501  break;
1502 
1503  case OPC_STATE_FINISHED:
1504  if (NULL != opc->data)
1506  break;
1507  }
1508  GNUNET_free(opc);
1509 }
1510 
1511 
1520 static void
1521 mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
1522 {
1523  /* struct GNUNET_TESTBED_Controller *c = cls; */
1524 
1525  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Encountered MQ error: %d\n", error);
1526  /* now what? */
1527  GNUNET_SCHEDULER_shutdown(); /* seems most reasonable */
1528 }
1529 
1530 
1548  uint64_t event_mask,
1550  void *cc_cls)
1551 {
1552  struct GNUNET_TESTBED_Controller *controller =
1554  struct GNUNET_MQ_MessageHandler handlers[] =
1555  { GNUNET_MQ_hd_var_size(add_host_confirm,
1558  controller),
1559  GNUNET_MQ_hd_fixed_size(peer_conevent,
1562  controller),
1563  GNUNET_MQ_hd_fixed_size(opsuccess,
1565  struct
1567  controller),
1568  GNUNET_MQ_hd_var_size(op_fail_event,
1571  controller),
1572  GNUNET_MQ_hd_fixed_size(peer_create_success,
1574  struct
1576  controller),
1577  GNUNET_MQ_hd_fixed_size(peer_event,
1580  controller),
1581  GNUNET_MQ_hd_var_size(peer_config,
1583  struct
1585  controller),
1586  GNUNET_MQ_hd_var_size(slave_config,
1589  controller),
1590  GNUNET_MQ_hd_var_size(link_controllers_result,
1593  controller),
1594  GNUNET_MQ_hd_var_size(barrier_status,
1597  controller),
1600  struct GNUNET_MQ_Envelope *env;
1601  const struct GNUNET_CONFIGURATION_Handle *cfg;
1602  const char *controller_hostname;
1603  unsigned long long max_parallel_operations;
1604  unsigned long long max_parallel_service_connections;
1605  unsigned long long max_parallel_topology_config_operations;
1606  size_t slen;
1607 
1608  GNUNET_assert(NULL != (cfg = GNUNET_TESTBED_host_get_cfg_(host)));
1609  if (GNUNET_OK !=
1611  "testbed",
1612  "MAX_PARALLEL_OPERATIONS",
1613  &max_parallel_operations))
1614  {
1615  GNUNET_break(0);
1616  GNUNET_free(controller);
1617  return NULL;
1618  }
1619  if (GNUNET_OK !=
1621  "testbed",
1622  "MAX_PARALLEL_SERVICE_CONNECTIONS",
1623  &max_parallel_service_connections))
1624  {
1625  GNUNET_break(0);
1626  GNUNET_free(controller);
1627  return NULL;
1628  }
1630  cfg,
1631  "testbed",
1632  "MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS",
1633  &max_parallel_topology_config_operations))
1634  {
1635  GNUNET_break(0);
1636  GNUNET_free(controller);
1637  return NULL;
1638  }
1639  controller->cc = cc;
1640  controller->cc_cls = cc_cls;
1641  controller->event_mask = event_mask;
1642  controller->cfg = GNUNET_CONFIGURATION_dup(cfg);
1643  controller->mq = GNUNET_CLIENT_connect(controller->cfg,
1644  "testbed",
1645  handlers,
1647  controller);
1648  if (NULL == controller->mq)
1649  {
1650  GNUNET_break(0);
1652  return NULL;
1653  }
1654  GNUNET_TESTBED_mark_host_registered_at_(host, controller);
1655  controller->host = host;
1656  controller->opq_parallel_operations =
1658  (unsigned int)
1659  max_parallel_operations);
1660  controller->opq_parallel_service_connections =
1662  (unsigned int)
1663  max_parallel_service_connections);
1667  (unsigned int)max_parallel_topology_config_operations);
1668  controller_hostname = GNUNET_TESTBED_host_get_hostname(host);
1669  if (NULL == controller_hostname)
1670  controller_hostname = "127.0.0.1";
1671  slen = strlen(controller_hostname) + 1;
1673  msg->host_id = htonl(GNUNET_TESTBED_host_get_id_(host));
1674  msg->event_mask = GNUNET_htonll(controller->event_mask);
1675  GNUNET_memcpy(&msg[1], controller_hostname, slen);
1676  GNUNET_MQ_send(controller->mq, env);
1677  return controller;
1678 }
1679 
1680 
1690 static int
1691 opc_free_iterator(void *cls, uint32_t key, void *value)
1692 {
1693  struct GNUNET_CONTAINER_MultiHashMap32 *map = cls;
1694  struct OperationContext *opc = value;
1695 
1696  GNUNET_assert(NULL != opc);
1697  GNUNET_break(0);
1699  GNUNET_CONTAINER_multihashmap32_remove(map, key, value));
1700  GNUNET_free(opc);
1701  return GNUNET_YES;
1702 }
1703 
1704 
1712 void
1714 {
1715  if (NULL != c->mq)
1716  {
1717  GNUNET_MQ_destroy(c->mq);
1718  c->mq = NULL;
1719  }
1720  if (NULL != c->host)
1727  if (NULL != c->opc_map)
1728  {
1732  c->opc_map));
1735  }
1736  GNUNET_free(c);
1737 }
1738 
1739 
1749 size_t
1751  size_t size,
1752  char **xconfig)
1753 {
1754  size_t xsize;
1755 
1756  xsize = compressBound((uLong)size);
1757  *xconfig = GNUNET_malloc(xsize);
1758  GNUNET_assert(Z_OK == compress2((Bytef *)*xconfig,
1759  (uLongf *)&xsize,
1760  (const Bytef *)config,
1761  (uLongf)size,
1762  Z_BEST_SPEED));
1763  return xsize;
1764 }
1765 
1766 
1776 char *
1778  size_t *size,
1779  size_t *xsize)
1780 {
1781  char *config;
1782  char *xconfig;
1783  size_t size_;
1784  size_t xsize_;
1785 
1786  config = GNUNET_CONFIGURATION_serialize(cfg, &size_);
1787  xsize_ = GNUNET_TESTBED_compress_config_(config, size_, &xconfig);
1788  GNUNET_free(config);
1789  *size = size_;
1790  *xsize = xsize_;
1791  return xconfig;
1792 }
1793 
1794 
1823 struct GNUNET_TESTBED_Operation *
1825  struct GNUNET_TESTBED_Controller *master,
1826  struct GNUNET_TESTBED_Host *delegated_host,
1827  struct GNUNET_TESTBED_Host *slave_host,
1828  int is_subordinate)
1829 {
1830  struct OperationContext *opc;
1832  struct ControllerLinkData *data;
1833  uint32_t slave_host_id;
1834  uint32_t delegated_host_id;
1835  uint16_t msg_size;
1836 
1838  GNUNET_TESTBED_is_host_registered_(delegated_host, master));
1839  slave_host_id = GNUNET_TESTBED_host_get_id_(
1840  (NULL != slave_host) ? slave_host : master->host);
1841  delegated_host_id = GNUNET_TESTBED_host_get_id_(delegated_host);
1842  if ((NULL != slave_host) && (0 != slave_host_id))
1844  GNUNET_TESTBED_is_host_registered_(slave_host, master));
1845  msg_size = sizeof(struct GNUNET_TESTBED_ControllerLinkRequest);
1846  msg = GNUNET_malloc(msg_size);
1848  msg->header.size = htons(msg_size);
1849  msg->delegated_host_id = htonl(delegated_host_id);
1850  msg->slave_host_id = htonl(slave_host_id);
1851  msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
1852  data = GNUNET_new(struct ControllerLinkData);
1853  data->msg = msg;
1854  data->host_id = delegated_host_id;
1855  opc = GNUNET_new(struct OperationContext);
1856  opc->c = master;
1857  opc->data = data;
1858  opc->type = OP_LINK_CONTROLLERS;
1859  opc->id = GNUNET_TESTBED_get_next_op_id(opc->c);
1860  opc->state = OPC_STATE_INIT;
1861  opc->op_cls = op_cls;
1862  msg->operation_id = GNUNET_htonll(opc->id);
1867  opc->op);
1869  return opc->op;
1870 }
1871 
1872 
1885 struct GNUNET_TESTBED_Operation *
1887  struct GNUNET_TESTBED_Controller *master,
1888  uint32_t slave_host_id)
1889 {
1890  struct OperationContext *opc;
1891  struct GetSlaveConfigData *data;
1892 
1893  data = GNUNET_new(struct GetSlaveConfigData);
1894  data->slave_id = slave_host_id;
1895  opc = GNUNET_new(struct OperationContext);
1896  opc->state = OPC_STATE_INIT;
1897  opc->c = master;
1898  opc->id = GNUNET_TESTBED_get_next_op_id(master);
1899  opc->type = OP_GET_SLAVE_CONFIG;
1900  opc->data = data;
1901  opc->op_cls = op_cls;
1906  opc->op);
1908  return opc->op;
1909 }
1910 
1911 
1927 struct GNUNET_TESTBED_Operation *
1929  struct GNUNET_TESTBED_Controller *master,
1930  struct GNUNET_TESTBED_Host *slave_host)
1931 {
1932  if (GNUNET_NO == GNUNET_TESTBED_is_host_registered_(slave_host, master))
1933  return NULL;
1934  return GNUNET_TESTBED_get_slave_config_(op_cls,
1935  master,
1937  slave_host));
1938 }
1939 
1940 
1950 void
1952  struct GNUNET_TESTBED_Controller *controller,
1953  const char *filename)
1954 {
1955  GNUNET_break(0);
1956 }
1957 
1958 
1974  const char *trusted_ip,
1975  const char *hostname,
1976  const struct GNUNET_CONFIGURATION_Handle *cfg)
1977 {
1979  char *config;
1980  char *xconfig;
1981  size_t config_size;
1982  size_t xconfig_size;
1983  uint16_t trusted_ip_len;
1984  uint16_t hostname_len;
1985  uint16_t msg_size;
1986 
1987  config = GNUNET_CONFIGURATION_serialize(cfg, &config_size);
1988  GNUNET_assert(NULL != config);
1989  xconfig_size =
1990  GNUNET_TESTBED_compress_config_(config, config_size, &xconfig);
1991  GNUNET_free(config);
1992  trusted_ip_len = strlen(trusted_ip);
1993  hostname_len = (NULL == hostname) ? 0 : strlen(hostname);
1994  msg_size = xconfig_size + trusted_ip_len + 1 +
1995  sizeof(struct GNUNET_TESTBED_HelperInit);
1996  msg_size += hostname_len;
1997  msg = GNUNET_realloc(xconfig, msg_size);
1998  (void)memmove(((void *)&msg[1]) + trusted_ip_len + 1 + hostname_len,
1999  msg,
2000  xconfig_size);
2001  msg->header.size = htons(msg_size);
2002  msg->header.type = htons(GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
2003  msg->trusted_ip_size = htons(trusted_ip_len);
2004  msg->hostname_size = htons(hostname_len);
2005  msg->config_size = htons(config_size);
2006  (void)strcpy((char *)&msg[1], trusted_ip);
2007  if (0 != hostname_len)
2008  GNUNET_memcpy((char *)&msg[1] + trusted_ip_len + 1,
2009  hostname,
2010  hostname_len);
2011  return msg;
2012 }
2013 
2014 
2036 void
2038 {
2039  (void)exop_check(operation);
2041 }
2042 
2043 
2060 {
2062  Bytef *data;
2063  const Bytef *xdata;
2064  uLong data_len;
2065  uLong xdata_len;
2066  int ret;
2067 
2068  switch (ntohs(msg->type))
2069  {
2072 
2073  imsg =
2075  data_len = (uLong)ntohs(imsg->config_size);
2076  xdata_len =
2077  ntohs(imsg->header.size) -
2079  xdata = (const Bytef *)&imsg[1];
2080  }
2081  break;
2082 
2084  const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
2085 
2086  imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *)msg;
2087  data_len = (uLong)ntohs(imsg->config_size);
2088  xdata_len = ntohs(imsg->header.size) -
2089  sizeof(struct GNUNET_TESTBED_SlaveConfiguration);
2090  xdata = (const Bytef *)&imsg[1];
2091  }
2092  break;
2093 
2095  const struct GNUNET_TESTBED_AddHostMessage *imsg;
2096  uint16_t osize;
2097 
2098  imsg = (const struct GNUNET_TESTBED_AddHostMessage *)msg;
2099  data_len = (uLong)ntohs(imsg->config_size);
2100  osize = sizeof(struct GNUNET_TESTBED_AddHostMessage) +
2101  ntohs(imsg->username_length) + ntohs(imsg->hostname_length);
2102  xdata_len = ntohs(imsg->header.size) - osize;
2103  xdata = (const Bytef *)((const void *)imsg + osize);
2104  }
2105  break;
2106 
2108  const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
2109 
2110  imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *)msg;
2111  data_len = ntohs(imsg->config_size);
2112  xdata_len = ntohs(imsg->header.size) -
2113  sizeof(const struct GNUNET_TESTBED_ControllerLinkResponse);
2114  xdata = (const Bytef *)&imsg[1];
2115  }
2116  break;
2117 
2119  const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
2120 
2121  imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *)msg;
2122  data_len = ntohs(imsg->config_size);
2123  xdata_len = ntohs(imsg->header.size) -
2124  sizeof(struct GNUNET_TESTBED_PeerCreateMessage);
2125  xdata = (const Bytef *)&imsg[1];
2126  }
2127  break;
2128 
2130  const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
2131 
2132  imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *)msg;
2133  data_len = ntohs(imsg->config_size);
2134  xdata_len = ntohs(imsg->header.size) -
2136  xdata = (const Bytef *)&imsg[1];
2137  }
2138  break;
2139 
2140  default:
2141  GNUNET_assert(0);
2142  }
2143  data = GNUNET_malloc(data_len);
2144  if (Z_OK != (ret = uncompress(data, &data_len, xdata, xdata_len)))
2145  {
2146  GNUNET_free(data);
2147  GNUNET_break_op(0); /* Un-compression failure */
2148  return NULL;
2149  }
2152  (const char *)data,
2153  (size_t)data_len,
2154  NULL))
2155  {
2156  GNUNET_free(data);
2157  GNUNET_break_op(0); /* De-serialization failure */
2158  return NULL;
2159  }
2160  GNUNET_free(data);
2161  return cfg;
2162 }
2163 
2164 
2172 const char *
2175 {
2176  uint16_t msize;
2177  const char *emsg;
2178 
2179  msize = ntohs(msg->header.size);
2180  if (sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
2181  return NULL;
2182  msize -= sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage);
2183  emsg = (const char *)&msg[1];
2184  if ('\0' != emsg[msize - 1])
2185  {
2186  GNUNET_break(0);
2187  return NULL;
2188  }
2189  return emsg;
2190 }
2191 
2192 
2200 uint64_t
2202 {
2203  uint64_t op_id;
2204 
2205  op_id = (uint64_t)GNUNET_TESTBED_host_get_id_(controller->host);
2206  op_id = op_id << 32;
2207  op_id |= (uint64_t)controller->operation_counter++;
2208  return op_id;
2209 }
2210 
2211 
2217 static void
2219 {
2220  struct OperationContext *opc = cls;
2221  struct GNUNET_MQ_Envelope *env;
2223 
2224  opc->state = OPC_STATE_STARTED;
2226  msg->operation_id = GNUNET_htonll(opc->id);
2227  GNUNET_TESTBED_insert_opc_(opc->c, opc);
2228  GNUNET_MQ_send(opc->c->mq, env);
2229 }
2230 
2231 
2237 static void
2239 {
2240  struct OperationContext *opc = cls;
2241 
2242  switch (opc->state)
2243  {
2244  case OPC_STATE_STARTED:
2245  GNUNET_TESTBED_remove_opc_(opc->c, opc);
2246 
2247  /* no break; continue */
2248  case OPC_STATE_INIT:
2249  GNUNET_free(opc->data);
2250  break;
2251 
2252  case OPC_STATE_FINISHED:
2253  break;
2254  }
2255  GNUNET_free(opc);
2256 }
2257 
2258 
2274 struct GNUNET_TESTBED_Operation *
2276  void *op_cls,
2278  void *cb_cls)
2279 {
2280  struct OperationContext *opc;
2281  struct ShutdownPeersData *data;
2282 
2284  return NULL;
2285  data = GNUNET_new(struct ShutdownPeersData);
2286  data->cb = cb;
2287  data->cb_cls = cb_cls;
2288  opc = GNUNET_new(struct OperationContext);
2289  opc->c = c;
2290  opc->op_cls = op_cls;
2291  opc->data = data;
2293  opc->type = OP_SHUTDOWN_PEERS;
2294  opc->state = OPC_STATE_INIT;
2299  opc->op);
2301  return opc->op;
2302 }
2303 
2304 
2313 uint32_t
2315 {
2316  return peer->unique_id;
2317 }
2318 
2319 
2326 void
2328 {
2329  struct GNUNET_TESTBED_Controller *c = barrier->c;
2330 
2331  GNUNET_assert(NULL != c->barrier_map); /* No barriers present */
2334  &barrier->key,
2335  barrier));
2336  GNUNET_free(barrier->name);
2337  GNUNET_free(barrier);
2339  {
2341  c->barrier_map = NULL;
2342  }
2343 }
2344 
2345 
2362 struct GNUNET_TESTBED_Barrier *
2364  const char *name,
2365  unsigned int quorum,
2367  void *cls,
2368  int echo)
2369 {
2371  struct GNUNET_MQ_Envelope *env;
2372  struct GNUNET_TESTBED_Barrier *barrier;
2373  struct GNUNET_HashCode key;
2374  size_t name_len;
2375 
2376  GNUNET_assert(quorum <= 100);
2377  GNUNET_assert(NULL != cb);
2378  name_len = strlen(name);
2379  GNUNET_assert(0 < name_len);
2380  GNUNET_CRYPTO_hash(name, name_len, &key);
2381  if (NULL == controller->barrier_map)
2382  controller->barrier_map =
2384  if (GNUNET_YES ==
2386  {
2387  GNUNET_break(0);
2388  return NULL;
2389  }
2390  LOG_DEBUG("Initialising barrier `%s'\n", name);
2391  barrier = GNUNET_new(struct GNUNET_TESTBED_Barrier);
2392  barrier->c = controller;
2393  barrier->name = GNUNET_strdup(name);
2394  barrier->cb = cb;
2395  barrier->cls = cls;
2396  barrier->echo = echo;
2397  GNUNET_memcpy(&barrier->key, &key, sizeof(struct GNUNET_HashCode));
2400  controller->barrier_map,
2401  &barrier->key,
2402  barrier,
2404 
2405  env = GNUNET_MQ_msg_extra(msg,
2406  name_len,
2408  msg->quorum = (uint8_t)quorum;
2409  GNUNET_memcpy(msg->name, barrier->name, name_len);
2410  GNUNET_MQ_send(barrier->c->mq, env);
2411  return barrier;
2412 }
2413 
2414 
2429 struct GNUNET_TESTBED_Barrier *
2431  const char *name,
2432  unsigned int quorum,
2434  void *cls)
2435 {
2436  return GNUNET_TESTBED_barrier_init_(controller,
2437  name,
2438  quorum,
2439  cb,
2440  cls,
2441  GNUNET_YES);
2442 }
2443 
2444 
2450 void
2452 {
2453  struct GNUNET_MQ_Envelope *env;
2455  size_t slen;
2456 
2457  slen = strlen(barrier->name);
2458  env =
2460  GNUNET_memcpy(msg->name, barrier->name, slen);
2461  GNUNET_MQ_send(barrier->c->mq, env);
2463 }
2464 
2465 
2466 /* end of testbed_api.c */
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
Message for signalling status of a barrier.
void GNUNET_TESTBED_operation_mark_failed(struct GNUNET_TESTBED_Operation *op)
Marks an operation as failed.
void * cb_cls
Closure for callbacks.
struct GNUNET_TESTBED_HelperInit * GNUNET_TESTBED_create_helper_init_msg_(const char *trusted_ip, const char *hostname, const struct GNUNET_CONFIGURATION_Handle *cfg)
Creates a helper initialization message.
Definition: testbed_api.c:1973
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:454
Event notification from a controller to a client.
Definition: testbed.h:517
#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
Message which contains the configuration of slave controller.
static void handle_opsuccess(void *cls, const struct GNUNET_TESTBED_GenericOperationSuccessEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS message from controller (testbed service) ...
Definition: testbed_api.c:433
Confirmation from the service that adding a host worked (or failed).
Definition: testbed.h:112
uint32_t peer_id
The id of the peer relevant to this information.
Definition: testbed.h:593
Message to request configuration of a slave controller.
Definition: testbed.h:617
Data for the OperationType OP_PEER_INFO.
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
Message to signal successful peer creation.
Event notification from a controller to a client.
Definition: testbed.h:461
static void handle_slave_config(void *cls, const struct GNUNET_TESTBED_SlaveConfiguration *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION message from controller (testbed service)...
Definition: testbed_api.c:1036
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
Message to link delegated controller to slave controller.
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
Definition: testbed_api.c:155
void GNUNET_TESTBED_controller_disconnect(struct GNUNET_TESTBED_Controller *c)
Stop the given controller (also will terminate all peers and controllers dependent on this controller...
Definition: testbed_api.c:1713
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:185
internal API to access the &#39;operations&#39; subsystem
static struct ExpireOperationEntry * exop_head
DLL head for list of operations marked for expiry.
Definition: testbed_api.c:150
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
struct GNUNET_TESTBED_Barrier * GNUNET_TESTBED_barrier_init(struct GNUNET_TESTBED_Controller *controller, const char *name, unsigned int quorum, GNUNET_TESTBED_barrier_status_cb cb, void *cls)
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach...
Definition: testbed_api.c:2430
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER.
Definition: testbed.h:238
void GNUNET_TESTBED_overlay_write_topology_to_file(struct GNUNET_TESTBED_Controller *controller, const char *filename)
Ask the testbed controller to write the current overlay topology to a file.
Definition: testbed_api.c:1951
static void handle_barrier_status(void *cls, const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS messages.
Definition: testbed_api.c:1233
void * cb_cls
The closure for the above callback.
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
Message for peer connect events.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
Message sent from client to testing service to reconfigure a (stopped) a peer.
Definition: testbed.h:234
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
Definition: testbed_api.c:186
Message to cancel a barrier.
Definition: testbed.h:778
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT.
Definition: testbed.h:497
void GNUNET_TESTBED_mark_host_registered_at_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Marks a host as registered with a controller.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:900
#define GNUNET_MESSAGE_TYPE_TESTBED_MAX
Not really a message, but for careful checks on the testbed messages; Should always be the maximum an...
union GNUNET_TESTBED_PeerInformation::@64 result
The result of the get information operation; Choose according to the pit.
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
Message to request configuration of a slave controller.
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * cb_cls
The closure for peer info callback.
void * op_cls
The operation closure.
Definition: testbed_api.h:149
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:808
The operation has been started.
Definition: testbed_api.h:122
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:169
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:210
GNUNET_MQ_Error
Error codes for the queue.
void(* GNUNET_TESTBED_barrier_status_cb)(void *cls, const char *name, struct GNUNET_TESTBED_Barrier *barrier, enum GNUNET_TESTBED_BarrierStatus status, const char *emsg)
Functions of this type are to be given as callback argument to GNUNET_TESTBED_barrier_init().
void * cls
The closure for the above callback.
Shutdown peers message.
Definition: testbed.h:666
struct GNUNET_TESTBED_Host * host
The host being registered.
TESTBED_opcq_empty_cb opcq_empty_cb
If this callback is not NULL, schedule it as a task when opc_map gets empty.
Definition: testbed_api.h:231
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER.
Definition: testbed.h:203
enum GNUNET_TESTBED_PeerInformationType pit
Peer information type; captures which of the types in the &#39;op_result&#39; is actually in use...
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:221
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void handle_add_host_confirm(void *cls, const struct GNUNET_TESTBED_HostConfirmedMessage *msg)
Handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from controller (testbed service) ...
Definition: testbed_api.c:363
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_controller_link(void *op_cls, struct GNUNET_TESTBED_Controller *master, struct GNUNET_TESTBED_Host *delegated_host, struct GNUNET_TESTBED_Host *slave_host, int is_subordinate)
Create a link from slave controller to delegated controller.
Definition: testbed_api.c:1824
Notify the service about a host that we intend to use.
Definition: testbed.h:63
uint64_t operation_id
Operation ID.
Definition: testbed.h:652
uint16_t config_size
The length of the uncompressed configuration.
Definition: testbed.h:95
static int echo
Request echo service.
Definition: gnunet-cadet.c:67
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS.
Definition: testbed.h:521
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an &#39;operation&#39; to be performed.
Peer configuration and identity reply from controller to a client.
Definition: testbed.h:584
void GNUNET_TESTBED_operation_release_(struct GNUNET_TESTBED_Operation *op)
An operation is &#39;done&#39; (was cancelled or finished); remove it from the queues and release associated ...
#define GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
A controller receiving this message floods it to its directly-connected sub-controllers and then stop...
uint16_t config_size
The size of the configuration when uncompressed.
Definition: testbed.h:657
Context data for get slave config operations.
Definition: testbed_api.c:86
Event notification from a controller to a client.
Definition: testbed.h:429
Operation queue which permits a fixed maximum number of operations to be active at any time...
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
Stop and destroy all peers.
Definition: testbed_api.h:98
static void handle_peer_create_success(void *cls, const struct GNUNET_TESTBED_PeerCreateSuccessEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS message from controller (testbed service)...
Definition: testbed_api.c:535
void GNUNET_TESTBED_deregister_host_at_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Unmarks a host registered at a controller.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
IPC messages between testing API and service ("controller")
void(* GNUNET_TESTBED_ControllerCallback)(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Signature of the event handler function called by the respective event controller.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION.
Definition: testbed.h:588
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
Message to signal that a add host succeeded.
struct GNUNET_TESTBED_Peer * peer
The handle of the peer to start.
#define GNUNET_NO
Definition: gnunet_common.h:78
GNUNET_TESTBED_PeerCreateCallback cb
The call back to call when we receive peer create success message.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
enum GNUNET_TESTBED_EventType type
Type of the event.
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:303
uint64_t GNUNET_TESTBED_get_next_op_id(struct GNUNET_TESTBED_Controller *controller)
Function to return the operation id for a controller.
Definition: testbed_api.c:2201
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_TESTBED_SlaveGetConfigurationMessage * GNUNET_TESTBED_generate_slavegetconfig_msg_(uint64_t op_id, uint32_t slave_id)
Function to build GET_SLAVE_CONFIG message.
Definition: testbed_api.c:996
void GNUNET_TESTBED_peer_register_(struct GNUNET_TESTBED_Peer *peer)
Adds a peer to the peer list.
uint32_t peer_id
Peer identity of the peer that was created.
Definition: testbed.h:526
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
int GNUNET_CONTAINER_multihashmap32_get_multiple(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS.
Definition: testbed.h:798
void GNUNET_TESTBED_host_replace_cfg_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_CONFIGURATION_Handle *new_cfg)
Function to replace host&#39;s configuration.
void * cls
the closure for the above callback
Definition: testbed_api.h:298
static void handle_peer_event(void *cls, const struct GNUNET_TESTBED_PeerEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT message from controller (testbed service) ...
Definition: testbed_api.c:593
const char * emsg
Error message for the operation, NULL on success.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
int GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL)...
Opaque handle to a host running experiments managed by the testing framework.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:598
static void oprelease_link_controllers(void *cls)
Callback which will be called when link-controllers type operation is released.
Definition: testbed_api.c:1436
Event notification from a controller to a client.
Definition: testbed.h:493
Initial message from a client to a testing control service.
Definition: testbed.h:36
uint64_t operation_id
Operation ID.
Definition: testbed.h:675
Initialization message for gnunet-helper-testbed to start testbed service.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
static int ret
Final status code.
Definition: gnunet-arm.c:89
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Definition: testbed_api.c:1521
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_extract_config_(const struct GNUNET_MessageHeader *msg)
Generates configuration by uncompressing configuration in given message.
Definition: testbed_api.c:2059
int GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
const struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.c:143
struct OperationQueue * GNUNET_TESTBED_operation_queue_create_(enum OperationQueueType type, unsigned int max_active)
Create an operation queue.
void * cc_cls
The closure for above callback.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static void handle_peer_config(void *cls, const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION message from controller (testbed service) ...
Definition: testbed_api.c:767
uint32_t operation_counter
The operation id counter.
Definition: testbed_api.h:267
Opaque handle to an abstract operation to be executed by the testing framework.
static struct GNUNET_CONTAINER_MultiPeerMap * map
Handle to the map used to store old latency values for peers.
Data for OperationType OP_PEER_START and OP_PEER_STOP.
Reconfigure a peer.
Definition: testbed_api.h:73
Response message for ControllerLinkRequest message.
Definition: testbed.h:165
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
void GNUNET_TESTBED_cleanup_peers_(void)
Frees all peers.
uint16_t status
status.
Definition: testbed.h:803
#define GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
Message to signal a generic operation has been successful.
GNUNET_TESTBED_PeerInfoCallback cb
The Peer info callback to call when this operation has completed.
void(* GNUNET_TESTBED_PeerCreateCallback)(void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
Functions of this signature are called when a peer has been successfully created. ...
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:555
uint16_t config_size
The length of the serialized configuration when uncompressed.
Definition: testbed.h:253
uint32_t delegated_host_id
For which host should requests be delegated? NBO.
Definition: testbed.h:142
uint16_t config_size
The size of configuration when uncompressed.
Definition: testbed.h:608
int32_t event_type
enum GNUNET_TESTBED_EventType (in NBO); either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER...
Definition: testbed.h:439
static void handle_op_fail_event(void *cls, const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT message from controller (testbed service...
Definition: testbed_api.c:857
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:164
struct GNUNET_PeerIdentity * id
The identity of the peer.
static int check_slave_config(void *cls, const struct GNUNET_TESTBED_SlaveConfiguration *msg)
Validate #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_INFORMATION message from controller (testbed service) ...
Definition: testbed_api.c:1020
static void oprelease_get_slave_config(void *cls)
Function to be called when get slave config operation is cancelled or finished.
Definition: testbed_api.c:1489
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
Message to signal the result of GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS request.
#define GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
Message for operation events.
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
enum PeerState state
Peer&#39;s state.
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
char * GNUNET_TESTBED_compress_cfg_(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size, size_t *xsize)
Function to serialize and compress using zlib a configuration through a configuration handle...
Definition: testbed_api.c:1777
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
GNUNET_TESTBED_PeerChurnCallback pcc
The Peer churn callback to call when this operation is completed.
uint32_t host_id
The id of the host which is hosting the controller to be linked.
Definition: testbed_api.c:106
Link controllers operation.
Definition: testbed_api.h:88
int GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
, &#39; bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
static char * value
Value of the record to add/remove.
An entry in the stack for keeping operations which are about to expire.
Definition: testbed_api.c:129
Special value (not valid for requesting information) that is used in the event struct if a &#39;generic&#39; ...
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:508
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
void GNUNET_TESTBED_barrier_remove_(struct GNUNET_TESTBED_Barrier *barrier)
Remove a barrier and it was the last one in the barrier hash map, destroy the hash map...
Definition: testbed_api.c:2327
#define GNUNET_realloc(ptr, size)
Wrapper around realloc.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:44
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
Message for peer events.
void * pcc_cls
Closure for the above callback.
static int opc_free_iterator(void *cls, uint32_t key, void *value)
Iterator to free opc map entries.
Definition: testbed_api.c:1691
void GNUNET_TESTBED_forward_operation_msg_cancel_(struct OperationContext *opc)
Function to cancel an operation created by simply forwarding an operation message.
Definition: testbed_api.c:1399
#define GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
Message to reconfigure a peer.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
uint32_t peer2
Second peer.
Definition: testbed.h:481
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:246
static void opstart_link_controllers(void *cls)
Function to call to start a link-controllers type operation once all queues the operation is part of ...
Definition: testbed_api.c:1414
struct OperationContext * opc
The result of the search.
Definition: testbed_api.c:224
static int check_barrier_status(void *cls, const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
Validate GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS message.
Definition: testbed_api.c:1187
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
void(* GNUNET_TESTBED_PeerInfoCallback)(void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
Callback to be called when the requested peer information is available The peer information in the ca...
Peer destroy operation.
Definition: testbed_api.h:63
static void opstart_shutdown_peers(void *cls)
Function called when a shutdown peers operation is ready.
Definition: testbed_api.c:2218
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_slave_config(void *op_cls, struct GNUNET_TESTBED_Controller *master, struct GNUNET_TESTBED_Host *slave_host)
Function to acquire the configuration of a running slave controller.
Definition: testbed_api.c:1928
A requested testbed operation has been completed.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
uint16_t status
See PRISM_STATUS_*-constants.
static char * filename
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:226
static const struct GNUNET_CONFIGURATION_Handle * config
static void cleanup(void *cls)
Function scheduled as very last function, cleans up after us.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
static int check_peer_config(void *cls, const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *msg)
Validate GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION message from controller (testbed service) ...
Definition: testbed_api.c:750
What configuration is the peer using? Returns a &#39;const struct GNUNET_CONFIGURATION_Handle *&#39;...
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
Message to add host.
char name[0]
The barrier name.
Definition: testbed.h:787
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:486
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
uint32_t host_id
Unique ID for the host (in NBO).
Definition: testbed.h:121
Peer start operation.
Definition: testbed_api.h:53
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Definition: testbed_api.c:74
char * name
The name of the barrier.
Definition: testbed_api.h:288
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
Message containing the peer&#39;s information.
void GNUNET_TESTBED_barrier_cancel(struct GNUNET_TESTBED_Barrier *barrier)
Cancel a barrier.
Definition: testbed_api.c:2451
Internal representation of the hash map.
struct GNUNET_PeerIdentity peer_identity
Identity of the peer.
Definition: testbed.h:603
void * cc_cls
The closure for the above callback.
Definition: testbed_api.c:79
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2037
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
struct GNUNET_TESTBED_Host * host
Which host does this peer run on?
const struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_host_get_cfg_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s configuration template.
Handle for barrier.
Definition: testbed_api.h:274
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call once this operation is done.
A 512-bit hashcode.
void GNUNET_TESTBED_peer_deregister_(struct GNUNET_TESTBED_Peer *peer)
Removes a peer from the peer list.
void(* GNUNET_TESTBED_PeerChurnCallback)(void *cls, const char *emsg)
Functions of this signature are called when a peer has been successfully started or stopped...
Message handler for a specific message type.
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration of the peer.
struct GNUNET_TESTBED_Barrier * GNUNET_TESTBED_barrier_init_(struct GNUNET_TESTBED_Controller *controller, const char *name, unsigned int quorum, GNUNET_TESTBED_barrier_status_cb cb, void *cls, int echo)
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach...
Definition: testbed_api.c:2363
A connection between two peers was torn down.
Data structure for OperationType OP_OVERLAY_CONNECT.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
Message sent from client to testing service to create (configure, but not start) a peer...
Definition: testbed.h:199
uint32_t slave_id
The id of the slave controller.
Definition: testbed_api.c:90
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call.
Definition: testbed_api.c:117
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
uint64_t operation_id
Operation ID.
Definition: testbed.h:631
#define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT
The initialization message towards gnunet-testbed-helper.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
void GNUNET_TESTBED_operation_queue_destroy_(struct OperationQueue *queue)
Destroys an operation queue.
uint64_t event_mask
Global event mask for all testbed events.
struct OperationQueue * opq_parallel_topology_config_operations
Operation queue for simultaneous topology configuration operations.
Definition: testbed_api.h:251
int GNUNET_TESTBED_is_host_registered_(const struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Checks whether a host has been registered.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_HashCode key
The key used in the DHT.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
uint32_t peer1
First peer.
Definition: testbed.h:476
static unsigned int size
Size of the "table".
Definition: peer.c:66
The peer is stopped.
uint16_t success
Set to GNUNET_YES to signify SUCCESS; GNUNET_NO to signify failure.
Definition: testbed.h:180
char data[0]
the barrier name (0-terminated) concatenated with an error message (0-terminated) if the status were ...
Definition: testbed.h:814
Context data for forwarded Operation.
Definition: testbed_api.c:70
void GNUNET_TESTBED_queue_message_(struct GNUNET_TESTBED_Controller *controller, struct GNUNET_MessageHeader *msg)
Queues a message in send queue for sending to the service.
Definition: testbed_api.c:1328
struct GNUNET_TESTBED_Peer * p1
Peer A to connect to peer B.
Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message.
Definition: testbed.h:638
GNUNET_TESTBED_OperationCompletionCallback cb
Overlay connection operation.
Definition: testbed_api.h:78
static void handle_peer_conevent(void *cls, const struct GNUNET_TESTBED_ConnectionEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT message from controller (testbed service) ...
Definition: testbed_api.c:674
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:67
const char * name
static void handle_link_controllers_result(void *cls, const struct GNUNET_TESTBED_ControllerLinkResponse *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller (testbed serv...
Definition: testbed_api.c:1098
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
Forwarded operation.
Definition: testbed_api.h:83
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:531
struct OperationContext * GNUNET_TESTBED_forward_operation_msg_(struct GNUNET_TESTBED_Controller *controller, uint64_t operation_id, const struct GNUNET_MessageHeader *msg, GNUNET_MQ_MessageCallback cc, void *cc_cls)
Sends the given message as an operation.
Definition: testbed_api.c:1362
struct GNUNET_TESTBED_Controller * GNUNET_TESTBED_controller_connect(struct GNUNET_TESTBED_Host *host, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls)
Start a controller process using the given configuration at the given host.
Definition: testbed_api.c:1547
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:116
static int opc_search_iterator(void *cls, uint32_t key, void *value)
Search iterator for searching an operation context.
Definition: testbed_api.c:243
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:175
int GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
#define LOG(kind,...)
Generic logging shorthand.
Definition: testbed_api.c:47
int32_t event_type
&#39;enum GNUNET_TESTBED_EventType&#39; (in NBO); either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCO...
Definition: testbed.h:471
A connection between two peers was established.
void(* GNUNET_MQ_MessageCallback)(void *cls, const struct GNUNET_MessageHeader *msg)
Called when a message has been received.
The operation has finished.
Definition: testbed_api.h:128
uint32_t host_id
Host ID that the controller is either given (if this is the dominating client) or assumed to have (fo...
Definition: testbed.h:48
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
Message to create a peer at a host.
GNUNET_TESTBED_EventType
Enumeration with (at most 64) possible event types that can be monitored using the testbed framework...
Date context for OP_SHUTDOWN_PEERS operations.
Definition: testbed_api.c:113
internal API to access the &#39;peers&#39; subsystem
GNUNET_TESTBED_HostRegistrationCompletion cc
The Registartion completion callback.
functions to calculate standard deviation
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
Peer stop operation.
Definition: testbed_api.h:58
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1750
struct GNUNET_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:283
Interface for functions internally exported from testbed_api.c.
Allow multiple values with the same key.
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
void(* GNUNET_TESTBED_OperationCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when an operation is completed.
Get slave config operation.
Definition: testbed_api.h:93
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:236
Start/stop service at a peer.
Definition: testbed_api.h:103
uint32_t unique_id
Globally unique ID of the peer.
void * cb_cls
The closure for the above callback.
Definition: testbed_api.c:122
The identity of the host (wraps the signing key of the peer).
const char * GNUNET_TESTBED_host_get_hostname(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s hostname.
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:241
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:278
What is the identity of the peer? Returns a &#39;const struct GNUNET_PeerIdentity *&#39;. ...
static char * hostname
Our hostname; we give this to all the peers we start.
Context information to be used while searching for operation contexts.
Definition: testbed_api.c:220
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_shutdown_peers(struct GNUNET_TESTBED_Controller *c, void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls)
Stops and destroys all peers.
Definition: testbed_api.c:2275
uint32_t slave_host_id
Which host is responsible for managing the delegation? NBO.
Definition: testbed.h:152
void GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.
struct GNUNET_TESTBED_Peer * p2
Peer B.
configuration data
Definition: configuration.c:83
static struct OperationContext * find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
Returns the operation context with the given id if found in the Operation context queues of the contr...
Definition: testbed_api.c:266
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS.
Definition: testbed.h:116
static int check_add_host_confirm(void *cls, const struct GNUNET_TESTBED_HostConfirmedMessage *msg)
Check #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message is well-formed.
Definition: testbed_api.c:335
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:215
uint8_t is_subordinate
Set to 1 if the receiving controller is the master controller for the slave host (and thus responsibl...
Definition: testbed.h:158
#define GNUNET_MESSAGE_TYPE_TESTBED_INIT
Initial message from a client to a testing control service.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT.
Definition: testbed.h:433
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION.
Definition: testbed.h:621
uint32_t GNUNET_TESTBED_get_index(const struct GNUNET_TESTBED_Peer *peer)
Return the index of the peer inside of the total peer array, aka.
Definition: testbed_api.c:2314
#define GNUNET_log(kind,...)
Peer create operation.
Definition: testbed_api.h:48
uint8_t quorum
The quorum percentage needed for crossing the barrier.
Definition: testbed.h:766
uint64_t id
The id of the operation context we are searching for.
Definition: testbed_api.c:229
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:257
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:195
uint64_t event_mask
Event mask that specifies which events this client is interested in.
Definition: testbed.h:54
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
Context data for controller link operations.
Definition: testbed_api.c:97
struct GNUNET_TESTBED_Peer * peer
The peer structure to return when we get success message.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_slave_config_(void *op_cls, struct GNUNET_TESTBED_Controller *master, uint32_t slave_host_id)
Like GNUNET_TESTBED_get_slave_config(), however without the host registration check.
Definition: testbed_api.c:1886
Barrier initialised successfully.
The peer has been created.
handle for host registration
struct ExpireOperationEntry * next
DLL head; new entries are to be inserted here.
Definition: testbed_api.c:133
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Header for all communications.
void GNUNET_TESTBED_insert_opc_(struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Inserts the given operation context into the operation context map of the given controller.
Definition: testbed_api.c:292
static void opstart_get_slave_config(void *cls)
Function to be called when get slave config operation is ready.
Definition: testbed_api.c:1466
Event notification from a controller to a client for a generic operational success where the operatio...
Definition: testbed.h:540
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:821
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:147
#define GNUNET_YES
Definition: gnunet_common.h:77
Message for signalling status changes of a barrier.
Definition: testbed.h:794
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:351
char name[0]
name of the barrier.
Definition: testbed.h:771
The peer is running.
static void oprelease_shutdown_peers(void *cls)
Callback which will be called when shutdown peers operation is released.
Definition: testbed_api.c:2238
internal API to access the &#39;hosts&#39; subsystem
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
Message to initialise a barrier.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
int GNUNET_CONFIGURATION_deserialize(struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *basedir)
De-serializes configuration.
uint32_t slave_id
The id of the slave host.
Definition: testbed.h:626
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
Message to cancel a barrier.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
Message to initialise a barrier.
Definition: testbed.h:757
enum GNUNET_TESTBED_PeerInformationType pit
The type of peer information requested.
A peer controlled by the testing framework.
A peer has been stopped.
struct ExpireOperationEntry * prev
DLL tail; entries are deleted from here.
Definition: testbed_api.c:138
uint16_t config_size
The size of the uncompressed configuration.
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
Data for the OperationType OP_PEER_CREATE.
const char * GNUNET_TESTBED_parse_error_string_(const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Checks the integrity of the OperationFailureEventMessage and if good returns the error message it con...
Definition: testbed_api.c:2173
Get peer information operation.
Definition: testbed_api.h:68
static int check_op_fail_event(void *cls, const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Validate GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT message from controller (testbed service) ...
Definition: testbed_api.c:840
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS.
Definition: testbed.h:137
uint16_t config_size
Size of the uncompressed configuration.
Definition: testbed.h:223
#define GNUNET_malloc(size)
Wrapper around malloc.
struct GNUNET_TESTBED_Peer * peer
The peer whose information has been requested.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:293
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:313
Client notifies controller that it should delegate requests for a particular client to a particular s...
Definition: testbed.h:133
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_lookup_by_id_(uint32_t id)
Lookup a host by ID.
Data returned from GNUNET_TESTBED_peer_get_information.
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION.
Definition: testbed.h:642
struct GNUNET_TESTBED_Operation * op
Handle for the corresponding operation that generated this event.
struct GNUNET_TESTBED_ControllerLinkRequest * msg
The controller link message.
Definition: testbed_api.c:101
static int check_link_controllers_result(void *cls, const struct GNUNET_TESTBED_ControllerLinkResponse *msg)
Check GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller (testbed service) ...
Definition: testbed_api.c:1081