GNUnet  0.11.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 
71 {
76 
80  void *cc_cls;
81 };
82 
83 
88 {
92  uint32_t slave_id;
93 };
94 
95 
100 {
105 
109  uint32_t host_id;
110 };
111 
112 
117 {
122 
126  void *cb_cls;
127 };
128 
129 
134 {
139 
144 
149 };
150 
151 
156 
161 
162 
168 static void
170 {
171  struct ExpireOperationEntry *entry;
172 
173  entry = GNUNET_new (struct ExpireOperationEntry);
174  entry->op = op;
175  GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry);
176 }
177 
178 
190 static int
192 {
193  struct ExpireOperationEntry *entry;
194  struct ExpireOperationEntry *entry2;
195  int found;
196 
197  found = GNUNET_NO;
198  entry = exop_head;
199  while (NULL != entry)
200  {
201  if (op == entry->op)
202  {
203  found = GNUNET_YES;
204  break;
205  }
206  entry = entry->next;
207  }
208  if (GNUNET_NO == found)
209  return GNUNET_NO;
210  /* Truncate the tail */
211  while (NULL != entry)
212  {
213  entry2 = entry->next;
214  GNUNET_CONTAINER_DLL_remove (exop_head, exop_tail, entry);
215  GNUNET_free (entry);
216  entry = entry2;
217  }
218  return GNUNET_YES;
219 }
220 
221 
226 {
231 
235  uint64_t id;
236 };
237 
238 
248 static int
249 opc_search_iterator (void *cls, uint32_t key, void *value)
250 {
251  struct SearchContext *sc = cls;
252  struct OperationContext *opc = value;
253 
254  GNUNET_assert (NULL != opc);
255  GNUNET_assert (NULL == sc->opc);
256  if (opc->id != sc->id)
257  return GNUNET_YES;
258  sc->opc = opc;
259  return GNUNET_NO;
260 }
261 
262 
271 static struct OperationContext *
272 find_opc (const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
273 {
274  struct SearchContext sc;
275 
276  sc.id = id;
277  sc.opc = NULL;
278  GNUNET_assert (NULL != c->opc_map);
279  if (GNUNET_SYSERR !=
281  (uint32_t) id,
283  &sc))
284  return NULL;
285  return sc.opc;
286 }
287 
288 
297 void
299  struct OperationContext *opc)
300 {
301  if (NULL == c->opc_map)
304  c->opc_map,
305  (uint32_t) opc->id,
306  opc,
308 }
309 
310 
318 void
320  struct OperationContext *opc)
321 {
322  GNUNET_assert (NULL != c->opc_map);
325  (uint32_t) opc->id,
326  opc));
328  (NULL != c->opcq_empty_cb))
330 }
331 
332 
340 static int
343 {
344  const char *emsg;
345  uint16_t msg_size;
346 
347  msg_size = ntohs (msg->header.size) - sizeof(*msg);
348  if (0 == msg_size)
349  return GNUNET_OK;
350  /* We have an error message */
351  emsg = (const char *) &msg[1];
352  if ('\0' != emsg[msg_size - 1])
353  {
354  GNUNET_break (0);
355  return GNUNET_SYSERR;
356  }
357  return GNUNET_OK;
358 }
359 
360 
368 static void
371 {
372  struct GNUNET_TESTBED_Controller *c = cls;
374  const char *emsg;
375  uint16_t msg_size;
376 
377  if (NULL == rh)
378  return;
379  if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
380  {
381  LOG_DEBUG ("Mismatch in host id's %u, %u of host confirm msg\n",
383  ntohl (msg->host_id));
384  return;
385  }
386  c->rh = NULL;
387  msg_size = ntohs (msg->header.size) - sizeof(*msg);
388  if (0 == msg_size)
389  {
390  LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
392  rh->cc (rh->cc_cls, NULL);
393  GNUNET_free (rh);
394  return;
395  }
396  /* We have an error message */
397  emsg = (const char *) &msg[1];
399  _ ("Adding host %u failed with error: %s\n"),
400  ntohl (msg->host_id),
401  emsg);
402  rh->cc (rh->cc_cls, emsg);
403  GNUNET_free (rh);
404 }
405 
406 
414 static void
416  struct OperationContext *opc,
417  const struct GNUNET_MessageHeader *msg)
418 {
419  struct GNUNET_TESTBED_Controller *c = cls;
420  struct ForwardedOperationData *fo_data;
421 
422  fo_data = opc->data;
423  if (NULL != fo_data->cc)
424  fo_data->cc (fo_data->cc_cls, msg);
426  GNUNET_free (fo_data);
427  GNUNET_free (opc);
428 }
429 
430 
438 static void
440  void *cls,
442 {
443  struct GNUNET_TESTBED_Controller *c = cls;
444  struct OperationContext *opc;
446  void *op_comp_cb_cls;
447  struct GNUNET_TESTBED_EventInformation event;
448  uint64_t op_id;
449 
450  op_id = GNUNET_ntohll (msg->operation_id);
451  LOG_DEBUG ("Operation %llu successful\n",
452  (unsigned long long) op_id);
453  if (NULL == (opc = find_opc (c, op_id)))
454  {
455  LOG_DEBUG ("Operation not found\n");
456  return;
457  }
459  event.op = opc->op;
460  event.op_cls = opc->op_cls;
461  event.details.operation_finished.emsg = NULL;
462  event.details.operation_finished.generic = NULL;
463  op_comp_cb = NULL;
464  op_comp_cb_cls = NULL;
465  switch (opc->type)
466  {
467  case OP_FORWARDED: {
469  opc,
470  (const struct
471  GNUNET_MessageHeader *) msg);
472  return;
473  }
474  break;
475 
476  case OP_PEER_DESTROY: {
477  struct GNUNET_TESTBED_Peer *peer;
478 
479  peer = opc->data;
481  GNUNET_free (peer);
482  opc->data = NULL;
483  // PEERDESTROYDATA
484  }
485  break;
486 
487  case OP_SHUTDOWN_PEERS: {
488  struct ShutdownPeersData *data;
489 
490  data = opc->data;
491  op_comp_cb = data->cb;
492  op_comp_cb_cls = data->cb_cls;
493  GNUNET_free (data);
494  opc->data = NULL;
496  }
497  break;
498 
499  case OP_MANAGE_SERVICE: {
500  struct ManageServiceData *data;
501 
502  GNUNET_assert (NULL != (data = opc->data));
503  op_comp_cb = data->cb;
504  op_comp_cb_cls = data->cb_cls;
505  GNUNET_free (data);
506  opc->data = NULL;
507  }
508  break;
509 
510  case OP_PEER_RECONFIGURE:
511  break;
512 
513  default:
514  GNUNET_assert (0);
515  }
516  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
517  opc->state = OPC_STATE_FINISHED;
518  exop_insert (event.op);
519  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
520  {
521  if (NULL != c->cc)
522  c->cc (c->cc_cls, &event);
523  if (GNUNET_NO == exop_check (event.op))
524  return;
525  }
526  else
527  LOG_DEBUG ("Not calling callback\n");
528  if (NULL != op_comp_cb)
529  op_comp_cb (op_comp_cb_cls, event.op, NULL);
530  /* You could have marked the operation as done by now */
531  GNUNET_break (GNUNET_NO == exop_check (event.op));
532 }
533 
534 
542 static void
544  void *cls,
546 {
547  struct GNUNET_TESTBED_Controller *c = cls;
548  struct OperationContext *opc;
549  struct PeerCreateData *data;
550  struct GNUNET_TESTBED_Peer *peer;
553  void *cb_cls;
554  uint64_t op_id;
555 
557  ntohs (msg->header.size));
558  op_id = GNUNET_ntohll (msg->operation_id);
559  if (NULL == (opc = find_opc (c, op_id)))
560  {
561  LOG_DEBUG ("Operation context for PeerCreateSuccessEvent not found\n");
562  return;
563  }
564  if (OP_FORWARDED == opc->type)
565  {
567  opc,
568  (const struct GNUNET_MessageHeader *) msg);
569  return;
570  }
572  GNUNET_assert (NULL != opc->data);
573  data = opc->data;
574  GNUNET_assert (NULL != data->peer);
575  peer = data->peer;
576  GNUNET_assert (peer->unique_id == ntohl (msg->peer_id));
577  peer->state = TESTBED_PS_CREATED;
579  cb = data->cb;
580  cb_cls = data->cls;
581  op = opc->op;
582  GNUNET_free (opc->data);
583  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
584  opc->state = OPC_STATE_FINISHED;
585  exop_insert (op);
586  if (NULL != cb)
587  cb (cb_cls, peer, NULL);
588  /* You could have marked the operation as done by now */
590 }
591 
592 
600 static void
602 {
603  struct GNUNET_TESTBED_Controller *c = cls;
604  struct OperationContext *opc;
605  struct GNUNET_TESTBED_Peer *peer;
606  struct PeerEventData *data;
608  void *pcc_cls;
609  struct GNUNET_TESTBED_EventInformation event;
610  uint64_t op_id;
611  uint64_t mask;
612 
614  ntohs (msg->header.size));
615  op_id = GNUNET_ntohll (msg->operation_id);
616  if (NULL == (opc = find_opc (c, op_id)))
617  {
618  LOG_DEBUG ("Operation not found\n");
619  return;
620  }
621  if (OP_FORWARDED == opc->type)
622  {
624  opc,
625  (const struct GNUNET_MessageHeader *) msg);
626  return;
627  }
628  GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
629  data = opc->data;
630  GNUNET_assert (NULL != data);
631  peer = data->peer;
632  GNUNET_assert (NULL != peer);
633  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
634  event.op = opc->op;
635  event.op_cls = opc->op_cls;
636  switch (event.type)
637  {
639  peer->state = TESTBED_PS_STARTED;
640  event.details.peer_start.host = peer->host;
641  event.details.peer_start.peer = peer;
642  break;
643 
645  peer->state = TESTBED_PS_STOPPED;
646  event.details.peer_stop.peer = peer;
647  break;
648 
649  default:
650  GNUNET_assert (0); /* We should never reach this state */
651  }
652  pcc = data->pcc;
653  pcc_cls = data->pcc_cls;
654  GNUNET_free (data);
655  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
656  opc->state = OPC_STATE_FINISHED;
657  exop_insert (event.op);
658  mask = 1LL << GNUNET_TESTBED_ET_PEER_START;
659  mask |= 1LL << GNUNET_TESTBED_ET_PEER_STOP;
660  if (0 != (mask & c->event_mask))
661  {
662  if (NULL != c->cc)
663  c->cc (c->cc_cls, &event);
664  if (GNUNET_NO == exop_check (event.op))
665  return;
666  }
667  if (NULL != pcc)
668  pcc (pcc_cls, NULL);
669  /* You could have marked the operation as done by now */
670  GNUNET_break (GNUNET_NO == exop_check (event.op));
671 }
672 
673 
681 static void
684 {
685  struct GNUNET_TESTBED_Controller *c = cls;
686  struct OperationContext *opc;
687  struct OverlayConnectData *data;
689  void *cb_cls;
690  struct GNUNET_TESTBED_EventInformation event;
691  uint64_t op_id;
692  uint64_t mask;
693 
694  op_id = GNUNET_ntohll (msg->operation_id);
695  if (NULL == (opc = find_opc (c, op_id)))
696  {
697  LOG_DEBUG ("Operation not found\n");
698  return;
699  }
700  if (OP_FORWARDED == opc->type)
701  {
703  opc,
704  (const struct GNUNET_MessageHeader *) msg);
705  return;
706  }
708  GNUNET_assert (NULL != (data = opc->data));
709  GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id) &&
710  (ntohl (msg->peer2) == data->p2->unique_id));
711  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
712  event.op = opc->op;
713  event.op_cls = opc->op_cls;
714  switch (event.type)
715  {
717  event.details.peer_connect.peer1 = data->p1;
718  event.details.peer_connect.peer2 = data->p2;
719  break;
720 
722  GNUNET_assert (0); /* FIXME: implement */
723  break;
724 
725  default:
726  GNUNET_assert (0); /* Should never reach here */
727  break;
728  }
729  cb = data->cb;
730  cb_cls = data->cb_cls;
731  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
732  opc->state = OPC_STATE_FINISHED;
733  exop_insert (event.op);
734  mask = 1LL << GNUNET_TESTBED_ET_CONNECT;
735  mask |= 1LL << GNUNET_TESTBED_ET_DISCONNECT;
736  if (0 != (mask & c->event_mask))
737  {
738  if (NULL != c->cc)
739  c->cc (c->cc_cls, &event);
740  if (GNUNET_NO == exop_check (event.op))
741  return;
742  }
743  if (NULL != cb)
744  cb (cb_cls, opc->op, NULL);
745  /* You could have marked the operation as done by now */
746  GNUNET_break (GNUNET_NO == exop_check (event.op));
747 }
748 
749 
757 static int
759  void *cls,
761 {
762  /* anything goes? */
763  return GNUNET_OK;
764 }
765 
766 
774 static void
776  void *cls,
778 {
779  struct GNUNET_TESTBED_Controller *c = cls;
780  struct OperationContext *opc;
781  struct GNUNET_TESTBED_Peer *peer;
782  struct PeerInfoData *data;
783  struct GNUNET_TESTBED_PeerInformation *pinfo;
785  void *cb_cls;
786  uint64_t op_id;
787 
788  op_id = GNUNET_ntohll (msg->operation_id);
789  if (NULL == (opc = find_opc (c, op_id)))
790  {
791  LOG_DEBUG ("Operation not found\n");
792  return;
793  }
794  if (OP_FORWARDED == opc->type)
795  {
796  handle_forwarded_operation_msg (c, opc, &msg->header);
797  return;
798  }
799  data = opc->data;
800  GNUNET_assert (NULL != data);
801  peer = data->peer;
802  GNUNET_assert (NULL != peer);
803  GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id);
805  pinfo->pit = data->pit;
806  cb = data->cb;
807  cb_cls = data->cb_cls;
808  GNUNET_assert (NULL != cb);
809  GNUNET_free (data);
810  opc->data = NULL;
811  switch (pinfo->pit)
812  {
814  pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity);
815  GNUNET_memcpy (pinfo->result.id,
816  &msg->peer_identity,
817  sizeof(struct GNUNET_PeerIdentity));
818  break;
819 
821  pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
823  break;
824 
826  GNUNET_assert (0); /* never reach here */
827  break;
828  }
829  opc->data = pinfo;
830  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
831  opc->state = OPC_STATE_FINISHED;
832  cb (cb_cls, opc->op, pinfo, NULL);
833  /* We dont check whether the operation is marked as done here as the
834  operation contains data (cfg/identify) which will be freed at a later point
835  */
836 }
837 
838 
847 static int
849  void *cls,
851 {
852  /* we accept anything as a valid error message */
853  return GNUNET_OK;
854 }
855 
856 
864 static void
866  void *cls,
868 {
869  struct GNUNET_TESTBED_Controller *c = cls;
870  struct OperationContext *opc;
871  const char *emsg;
872  uint64_t op_id;
873  uint64_t mask;
874  struct GNUNET_TESTBED_EventInformation event;
875 
876  op_id = GNUNET_ntohll (msg->operation_id);
877  if (NULL == (opc = find_opc (c, op_id)))
878  {
879  LOG_DEBUG ("Operation not found\n");
880  return;
881  }
882  if (OP_FORWARDED == opc->type)
883  {
885  opc,
886  (const struct GNUNET_MessageHeader *) msg);
887  return;
888  }
889  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
890  opc->state = OPC_STATE_FINISHED;
892  if (NULL == emsg)
893  emsg = "Unknown error";
894  if (OP_PEER_INFO == opc->type)
895  {
896  struct PeerInfoData *data;
897 
898  data = opc->data;
899  if (NULL != data->cb)
900  data->cb (data->cb_cls, opc->op, NULL, emsg);
901  GNUNET_free (data);
902  return; /* We do not call controller callback for peer info */
903  }
905  event.op = opc->op;
906  event.op_cls = opc->op_cls;
907  event.details.operation_finished.emsg = emsg;
908  event.details.operation_finished.generic = NULL;
909  mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
910  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
911  {
912  exop_insert (event.op);
913  c->cc (c->cc_cls, &event);
914  if (GNUNET_NO == exop_check (event.op))
915  return;
916  }
917  switch (opc->type)
918  {
919  case OP_PEER_CREATE: {
920  struct PeerCreateData *data;
921 
922  data = opc->data;
923  GNUNET_free (data->peer);
924  if (NULL != data->cb)
925  data->cb (data->cls, NULL, emsg);
926  GNUNET_free (data);
927  }
928  break;
929 
930  case OP_PEER_START:
931  case OP_PEER_STOP: {
932  struct PeerEventData *data;
933 
934  data = opc->data;
935  if (NULL != data->pcc)
936  data->pcc (data->pcc_cls, emsg);
937  GNUNET_free (data);
938  }
939  break;
940 
941  case OP_PEER_DESTROY:
942  break;
943 
944  case OP_PEER_INFO:
945  GNUNET_assert (0);
946 
947  case OP_OVERLAY_CONNECT: {
948  struct OverlayConnectData *data;
949 
950  data = opc->data;
952  if (NULL != data->cb)
953  data->cb (data->cb_cls, opc->op, emsg);
954  }
955  break;
956 
957  case OP_FORWARDED:
958  GNUNET_assert (0);
959 
960  case OP_LINK_CONTROLLERS: /* No secondary callback */
961  break;
962 
963  case OP_SHUTDOWN_PEERS: {
964  struct ShutdownPeersData *data;
965 
966  data = opc->data;
967  GNUNET_free (data); /* FIXME: Decide whether we call data->op_cb */
968  opc->data = NULL;
969  }
970  break;
971 
972  case OP_MANAGE_SERVICE: {
973  struct ManageServiceData *data = opc->data;
975  void *cb_cls;
976 
977  GNUNET_assert (NULL != data);
978  cb = data->cb;
979  cb_cls = data->cb_cls;
980  GNUNET_free (data);
981  opc->data = NULL;
982  exop_insert (event.op);
983  if (NULL != cb)
984  cb (cb_cls, opc->op, emsg);
985  /* You could have marked the operation as done by now */
986  GNUNET_break (GNUNET_NO == exop_check (event.op));
987  }
988  break;
989 
990  default:
991  GNUNET_break (0);
992  }
993 }
994 
995 
1005 {
1007  uint16_t msize;
1008 
1009  msize = sizeof(struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
1010  msg = GNUNET_malloc (msize);
1011  msg->header.size = htons (msize);
1012  msg->header.type =
1014  msg->operation_id = GNUNET_htonll (op_id);
1015  msg->slave_id = htonl (slave_id);
1016  return msg;
1017 }
1018 
1019 
1027 static int
1029  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1030 {
1031  /* anything goes? */
1032  return GNUNET_OK;
1033 }
1034 
1035 
1043 static void
1045  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1046 {
1047  struct GNUNET_TESTBED_Controller *c = cls;
1048  struct OperationContext *opc;
1049  uint64_t op_id;
1050  uint64_t mask;
1051  struct GNUNET_TESTBED_EventInformation event;
1052 
1053  op_id = GNUNET_ntohll (msg->operation_id);
1054  if (NULL == (opc = find_opc (c, op_id)))
1055  {
1056  LOG_DEBUG ("Operation not found\n");
1057  return;
1058  }
1059  if (OP_GET_SLAVE_CONFIG != opc->type)
1060  {
1061  GNUNET_break (0);
1062  return;
1063  }
1064  opc->state = OPC_STATE_FINISHED;
1065  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1067  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
1068  {
1071  event.op = opc->op;
1072  event.op_cls = opc->op_cls;
1073  event.details.operation_finished.generic = opc->data;
1074  event.details.operation_finished.emsg = NULL;
1075  c->cc (c->cc_cls, &event);
1076  }
1077 }
1078 
1079 
1088 static int
1090  void *cls,
1092 {
1093  /* actual check to be implemented */
1094  return GNUNET_OK;
1095 }
1096 
1097 
1105 static void
1107  void *cls,
1109 {
1110  struct GNUNET_TESTBED_Controller *c = cls;
1111  struct OperationContext *opc;
1112  struct ControllerLinkData *data;
1114  struct GNUNET_TESTBED_Host *host;
1115  char *emsg;
1116  uint64_t op_id;
1117  struct GNUNET_TESTBED_EventInformation event;
1118 
1119  op_id = GNUNET_ntohll (msg->operation_id);
1120  if (NULL == (opc = find_opc (c, op_id)))
1121  {
1122  LOG_DEBUG ("Operation not found\n");
1123  return;
1124  }
1125  if (OP_FORWARDED == opc->type)
1126  {
1128  opc,
1129  (const struct GNUNET_MessageHeader *) msg);
1130  return;
1131  }
1132  if (OP_LINK_CONTROLLERS != opc->type)
1133  {
1134  GNUNET_break (0);
1135  return;
1136  }
1137  GNUNET_assert (NULL != (data = opc->data));
1139  GNUNET_assert (NULL != host);
1140  GNUNET_free (data);
1141  opc->data = NULL;
1142  opc->state = OPC_STATE_FINISHED;
1143  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1145  event.op = opc->op;
1146  event.op_cls = opc->op_cls;
1147  event.details.operation_finished.emsg = NULL;
1148  event.details.operation_finished.generic = NULL;
1149  emsg = NULL;
1150  cfg = NULL;
1151  if (GNUNET_NO == ntohs (msg->success))
1152  {
1153  emsg =
1154  GNUNET_malloc (ntohs (msg->header.size)
1155  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse)
1156  + 1);
1157  GNUNET_memcpy (emsg,
1158  &msg[1],
1159  ntohs (msg->header.size)
1160  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse));
1161  event.details.operation_finished.emsg = emsg;
1162  }
1163  else
1164  {
1165  if (0 != ntohs (msg->config_size))
1166  {
1168  (const struct GNUNET_MessageHeader *) msg);
1169  GNUNET_assert (NULL != cfg);
1171  }
1172  }
1173  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
1174  {
1175  if (NULL != c->cc)
1176  c->cc (c->cc_cls, &event);
1177  }
1178  else
1179  LOG_DEBUG ("Not calling callback\n");
1180  if (NULL != cfg)
1182  GNUNET_free (emsg);
1183 }
1184 
1185 
1195 static int
1197  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1198 {
1199  uint16_t msize;
1200  uint16_t name_len;
1201  int status;
1202  const char *name;
1203  size_t emsg_len;
1204 
1205  msize = ntohs (msg->header.size);
1206  name = msg->data;
1207  name_len = ntohs (msg->name_len);
1208 
1209  if (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) + name_len + 1 > msize)
1210  {
1211  GNUNET_break_op (0);
1212  return GNUNET_SYSERR;
1213  }
1214  if ('\0' != name[name_len])
1215  {
1216  GNUNET_break_op (0);
1217  return GNUNET_SYSERR;
1218  }
1219  status = ntohs (msg->status);
1220  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1221  {
1222  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1223  + name_len + 1); /* +1!? */
1224  if (0 == emsg_len)
1225  {
1226  GNUNET_break_op (0);
1227  return GNUNET_SYSERR;
1228  }
1229  }
1230  return GNUNET_OK;
1231 }
1232 
1233 
1241 static void
1243  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1244 {
1245  struct GNUNET_TESTBED_Controller *c = cls;
1246  struct GNUNET_TESTBED_Barrier *barrier;
1247  char *emsg;
1248  const char *name;
1249  struct GNUNET_HashCode key;
1250  size_t emsg_len;
1251  int status;
1252  uint16_t msize;
1253  uint16_t name_len;
1254 
1255  emsg = NULL;
1256  barrier = NULL;
1257  msize = ntohs (msg->header.size);
1258  if (msize <= sizeof(struct GNUNET_TESTBED_BarrierStatusMsg))
1259  {
1260  GNUNET_break_op (0);
1261  goto cleanup;
1262  }
1263  name = msg->data;
1264  name_len = ntohs (msg->name_len);
1265  if (name_len >= // name_len is strlen(barrier_name)
1266  (msize - ((sizeof msg->header) + sizeof(msg->status))))
1267  {
1268  GNUNET_break_op (0);
1269  goto cleanup;
1270  }
1271  if ('\0' != name[name_len])
1272  {
1273  GNUNET_break_op (0);
1274  goto cleanup;
1275  }
1276  LOG_DEBUG ("Received BARRIER_STATUS msg\n");
1277  status = ntohs (msg->status);
1278  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1279  {
1280  status = -1;
1281  // unlike name_len, emsg_len includes the trailing zero
1282  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1283  + (name_len + 1));
1284  if (0 == emsg_len)
1285  {
1286  GNUNET_break_op (0);
1287  goto cleanup;
1288  }
1289  if ('\0' != (msg->data[(name_len + 1) + (emsg_len - 1)]))
1290  {
1291  GNUNET_break_op (0);
1292  goto cleanup;
1293  }
1294  emsg = GNUNET_malloc (emsg_len);
1295  GNUNET_memcpy (emsg, msg->data + name_len + 1, emsg_len);
1296  }
1297  if (NULL == c->barrier_map)
1298  {
1299  GNUNET_break_op (0);
1300  goto cleanup;
1301  }
1302  GNUNET_CRYPTO_hash (name, name_len, &key);
1303  barrier = GNUNET_CONTAINER_multihashmap_get (c->barrier_map, &key);
1304  if (NULL == barrier)
1305  {
1306  GNUNET_break_op (0);
1307  goto cleanup;
1308  }
1309  GNUNET_assert (NULL != barrier->cb);
1310  if ((GNUNET_YES == barrier->echo) &&
1313  barrier->cb (barrier->cls, name, barrier, status, emsg);
1315  return; /* just initialised; skip cleanup */
1316 
1317 cleanup:
1318  GNUNET_free (emsg);if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
1326 }
1327 
1328 
1335 void
1337  struct GNUNET_MessageHeader *msg)
1338 {
1339  struct GNUNET_MQ_Envelope *env;
1340  struct GNUNET_MessageHeader *m2;
1341  uint16_t type;
1342  uint16_t size;
1343 
1344  type = ntohs (msg->type);
1345  size = ntohs (msg->size);
1348  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1349  GNUNET_memcpy (m2, msg, size);
1350  GNUNET_free (msg);
1351  GNUNET_MQ_send (controller->mq, env);
1352 }
1353 
1354 
1369 struct OperationContext *
1371  struct GNUNET_TESTBED_Controller *controller,
1372  uint64_t operation_id,
1373  const struct GNUNET_MessageHeader *msg,
1375  void *cc_cls)
1376 {
1377  struct OperationContext *opc;
1378  struct ForwardedOperationData *data;
1379  struct GNUNET_MQ_Envelope *env;
1380  struct GNUNET_MessageHeader *m2;
1381  uint16_t type = ntohs (msg->type);
1382  uint16_t size = ntohs (msg->size);
1383 
1384  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1385  GNUNET_memcpy (m2, msg, size);
1386  GNUNET_MQ_send (controller->mq, env);
1387  data = GNUNET_new (struct ForwardedOperationData);
1388  data->cc = cc;
1389  data->cc_cls = cc_cls;
1390  opc = GNUNET_new (struct OperationContext);
1391  opc->c = controller;
1392  opc->type = OP_FORWARDED;
1393  opc->data = data;
1394  opc->id = operation_id;
1395  GNUNET_TESTBED_insert_opc_ (controller, opc);
1396  return opc;
1397 }
1398 
1399 
1406 void
1408 {
1409  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1410  GNUNET_free (opc->data);
1411  GNUNET_free (opc);
1412 }
1413 
1414 
1421 static void
1423 {
1424  struct OperationContext *opc = cls;
1425  struct ControllerLinkData *data;
1427 
1428  GNUNET_assert (NULL != opc->data);
1429  data = opc->data;
1430  msg = data->msg;
1431  data->msg = NULL;
1432  opc->state = OPC_STATE_STARTED;
1433  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1434  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1435 }
1436 
1437 
1443 static void
1445 {
1446  struct OperationContext *opc = cls;
1447  struct ControllerLinkData *data;
1448 
1449  data = opc->data;
1450  switch (opc->state)
1451  {
1452  case OPC_STATE_INIT:
1453  GNUNET_free (data->msg);
1454  break;
1455 
1456  case OPC_STATE_STARTED:
1457  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1458  break;
1459 
1460  case OPC_STATE_FINISHED:
1461  break;
1462  }
1463  GNUNET_free (data);
1464  GNUNET_free (opc);
1465 }
1466 
1467 
1473 static void
1475 {
1476  struct OperationContext *opc = cls;
1477  struct GetSlaveConfigData *data = opc->data;
1479 
1480  GNUNET_assert (NULL != data);
1482  GNUNET_free (opc->data);
1483  data = NULL;
1484  opc->data = NULL;
1485  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1486  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1487  opc->state = OPC_STATE_STARTED;
1488 }
1489 
1490 
1496 static void
1498 {
1499  struct OperationContext *opc = cls;
1500 
1501  switch (opc->state)
1502  {
1503  case OPC_STATE_INIT:
1504  GNUNET_free (opc->data);
1505  break;
1506 
1507  case OPC_STATE_STARTED:
1508  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1509  break;
1510 
1511  case OPC_STATE_FINISHED:
1512  if (NULL != opc->data)
1514  break;
1515  }
1516  GNUNET_free (opc);
1517 }
1518 
1519 
1528 static void
1529 mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
1530 {
1531  /* struct GNUNET_TESTBED_Controller *c = cls; */
1532 
1533  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Encountered MQ error: %d\n", error);
1534  /* now what? */
1535  GNUNET_SCHEDULER_shutdown (); /* seems most reasonable */
1536 }
1537 
1538 
1556  uint64_t event_mask,
1558  void *cc_cls)
1559 {
1560  struct GNUNET_TESTBED_Controller *controller =
1562  struct GNUNET_MQ_MessageHandler handlers[] =
1563  { GNUNET_MQ_hd_var_size (add_host_confirm,
1566  controller),
1567  GNUNET_MQ_hd_fixed_size (peer_conevent,
1570  controller),
1571  GNUNET_MQ_hd_fixed_size (opsuccess,
1573  struct
1575  controller),
1576  GNUNET_MQ_hd_var_size (op_fail_event,
1579  controller),
1580  GNUNET_MQ_hd_fixed_size (peer_create_success,
1582  struct
1584  controller),
1585  GNUNET_MQ_hd_fixed_size (peer_event,
1588  controller),
1589  GNUNET_MQ_hd_var_size (peer_config,
1591  struct
1593  controller),
1594  GNUNET_MQ_hd_var_size (slave_config,
1597  controller),
1598  GNUNET_MQ_hd_var_size (link_controllers_result,
1601  controller),
1602  GNUNET_MQ_hd_var_size (barrier_status,
1605  controller),
1606  GNUNET_MQ_handler_end () };
1608  struct GNUNET_MQ_Envelope *env;
1609  const struct GNUNET_CONFIGURATION_Handle *cfg;
1610  const char *controller_hostname;
1611  unsigned long long max_parallel_operations;
1612  unsigned long long max_parallel_service_connections;
1613  unsigned long long max_parallel_topology_config_operations;
1614  size_t slen;
1615 
1616  GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host)));
1617  if (GNUNET_OK !=
1619  "testbed",
1620  "MAX_PARALLEL_OPERATIONS",
1621  &max_parallel_operations))
1622  {
1623  GNUNET_break (0);
1624  GNUNET_free (controller);
1625  return NULL;
1626  }
1627  if (GNUNET_OK !=
1629  "testbed",
1630  "MAX_PARALLEL_SERVICE_CONNECTIONS",
1631  &max_parallel_service_connections))
1632  {
1633  GNUNET_break (0);
1634  GNUNET_free (controller);
1635  return NULL;
1636  }
1638  cfg,
1639  "testbed",
1640  "MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS",
1641  &max_parallel_topology_config_operations))
1642  {
1643  GNUNET_break (0);
1644  GNUNET_free (controller);
1645  return NULL;
1646  }
1647  controller->cc = cc;
1648  controller->cc_cls = cc_cls;
1649  controller->event_mask = event_mask;
1650  controller->cfg = GNUNET_CONFIGURATION_dup (cfg);
1651  controller->mq = GNUNET_CLIENT_connect (controller->cfg,
1652  "testbed",
1653  handlers,
1655  controller);
1656  if (NULL == controller->mq)
1657  {
1658  GNUNET_break (0);
1660  return NULL;
1661  }
1662  GNUNET_TESTBED_mark_host_registered_at_ (host, controller);
1663  controller->host = host;
1664  controller->opq_parallel_operations =
1666  (unsigned int)
1667  max_parallel_operations);
1668  controller->opq_parallel_service_connections =
1670  (unsigned int)
1671  max_parallel_service_connections);
1675  (unsigned int) max_parallel_topology_config_operations);
1676  controller_hostname = GNUNET_TESTBED_host_get_hostname (host);
1677  if (NULL == controller_hostname)
1678  controller_hostname = "127.0.0.1";
1679  slen = strlen (controller_hostname) + 1;
1681  msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
1682  msg->event_mask = GNUNET_htonll (controller->event_mask);
1683  GNUNET_memcpy (&msg[1], controller_hostname, slen);
1684  GNUNET_MQ_send (controller->mq, env);
1685  return controller;
1686 }
1687 
1688 
1698 static int
1699 opc_free_iterator (void *cls, uint32_t key, void *value)
1700 {
1701  struct GNUNET_CONTAINER_MultiHashMap32 *map = cls;
1702  struct OperationContext *opc = value;
1703 
1704  GNUNET_assert (NULL != opc);
1705  GNUNET_break (0);
1707  GNUNET_CONTAINER_multihashmap32_remove (map, key, value));
1708  GNUNET_free (opc);
1709  return GNUNET_YES;
1710 }
1711 
1712 
1720 void
1722 {
1723  if (NULL != c->mq)
1724  {
1725  GNUNET_MQ_destroy (c->mq);
1726  c->mq = NULL;
1727  }
1728  if (NULL != c->host)
1735  if (NULL != c->opc_map)
1736  {
1740  c->opc_map));
1743  }
1744  GNUNET_free (c);
1745 }
1746 
1747 
1757 size_t
1759  size_t size,
1760  char **xconfig)
1761 {
1762  size_t xsize;
1763 
1764  xsize = compressBound ((uLong) size);
1765  *xconfig = GNUNET_malloc (xsize);
1766  GNUNET_assert (Z_OK == compress2 ((Bytef *) *xconfig,
1767  (uLongf *) &xsize,
1768  (const Bytef *) config,
1769  (uLongf) size,
1770  Z_BEST_SPEED));
1771  return xsize;
1772 }
1773 
1774 
1784 char *
1786  size_t *size,
1787  size_t *xsize)
1788 {
1789  char *config;
1790  char *xconfig;
1791  size_t size_;
1792  size_t xsize_;
1793 
1794  config = GNUNET_CONFIGURATION_serialize (cfg, &size_);
1795  xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig);
1796  GNUNET_free (config);
1797  *size = size_;
1798  *xsize = xsize_;
1799  return xconfig;
1800 }
1801 
1802 
1831 struct GNUNET_TESTBED_Operation *
1833  struct GNUNET_TESTBED_Controller *master,
1834  struct GNUNET_TESTBED_Host *delegated_host,
1835  struct GNUNET_TESTBED_Host *slave_host,
1836  int is_subordinate)
1837 {
1838  struct OperationContext *opc;
1840  struct ControllerLinkData *data;
1841  uint32_t slave_host_id;
1842  uint32_t delegated_host_id;
1843  uint16_t msg_size;
1844 
1846  GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
1847  slave_host_id = GNUNET_TESTBED_host_get_id_ (
1848  (NULL != slave_host) ? slave_host : master->host);
1849  delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
1850  if ((NULL != slave_host) && (0 != slave_host_id))
1852  GNUNET_TESTBED_is_host_registered_ (slave_host, master));
1853  msg_size = sizeof(struct GNUNET_TESTBED_ControllerLinkRequest);
1854  msg = GNUNET_malloc (msg_size);
1856  msg->header.size = htons (msg_size);
1857  msg->delegated_host_id = htonl (delegated_host_id);
1858  msg->slave_host_id = htonl (slave_host_id);
1859  msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
1860  data = GNUNET_new (struct ControllerLinkData);
1861  data->msg = msg;
1862  data->host_id = delegated_host_id;
1863  opc = GNUNET_new (struct OperationContext);
1864  opc->c = master;
1865  opc->data = data;
1866  opc->type = OP_LINK_CONTROLLERS;
1867  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
1868  opc->state = OPC_STATE_INIT;
1869  opc->op_cls = op_cls;
1870  msg->operation_id = GNUNET_htonll (opc->id);
1875  opc->op);
1877  return opc->op;
1878 }
1879 
1880 
1893 struct GNUNET_TESTBED_Operation *
1895  struct GNUNET_TESTBED_Controller *master,
1896  uint32_t slave_host_id)
1897 {
1898  struct OperationContext *opc;
1899  struct GetSlaveConfigData *data;
1900 
1901  data = GNUNET_new (struct GetSlaveConfigData);
1902  data->slave_id = slave_host_id;
1903  opc = GNUNET_new (struct OperationContext);
1904  opc->state = OPC_STATE_INIT;
1905  opc->c = master;
1906  opc->id = GNUNET_TESTBED_get_next_op_id (master);
1907  opc->type = OP_GET_SLAVE_CONFIG;
1908  opc->data = data;
1909  opc->op_cls = op_cls;
1914  opc->op);
1916  return opc->op;
1917 }
1918 
1919 
1935 struct GNUNET_TESTBED_Operation *
1937  struct GNUNET_TESTBED_Controller *master,
1938  struct GNUNET_TESTBED_Host *slave_host)
1939 {
1940  if (GNUNET_NO == GNUNET_TESTBED_is_host_registered_ (slave_host, master))
1941  return NULL;
1942  return GNUNET_TESTBED_get_slave_config_ (op_cls,
1943  master,
1945  slave_host));
1946 }
1947 
1948 
1958 void
1960  struct GNUNET_TESTBED_Controller *controller,
1961  const char *filename)
1962 {
1963  GNUNET_break (0);
1964 }
1965 
1966 
1982  const char *trusted_ip,
1983  const char *hostname,
1984  const struct GNUNET_CONFIGURATION_Handle *cfg)
1985 {
1987  char *config;
1988  char *xconfig;
1989  size_t config_size;
1990  size_t xconfig_size;
1991  uint16_t trusted_ip_len;
1992  uint16_t hostname_len;
1993  uint16_t msg_size;
1994 
1995  config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
1996  GNUNET_assert (NULL != config);
1997  xconfig_size =
1998  GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
1999  GNUNET_free (config);
2000  trusted_ip_len = strlen (trusted_ip);
2001  hostname_len = (NULL == hostname) ? 0 : strlen (hostname);
2002  msg_size = xconfig_size + trusted_ip_len + 1
2003  + sizeof(struct GNUNET_TESTBED_HelperInit);
2004  msg_size += hostname_len;
2005  msg = GNUNET_realloc (xconfig, msg_size);
2006  (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len,
2007  msg,
2008  xconfig_size);
2009  msg->header.size = htons (msg_size);
2010  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
2011  msg->trusted_ip_size = htons (trusted_ip_len);
2012  msg->hostname_size = htons (hostname_len);
2013  msg->config_size = htons (config_size);
2014  (void) strcpy ((char *) &msg[1], trusted_ip);
2015  if (0 != hostname_len)
2016  GNUNET_memcpy ((char *) &msg[1] + trusted_ip_len + 1,
2017  hostname,
2018  hostname_len);
2019  return msg;
2020 }
2021 
2022 
2044 void
2046 {
2047  (void) exop_check (operation);
2049 }
2050 
2051 
2068 {
2070  Bytef *data;
2071  const Bytef *xdata;
2072  uLong data_len;
2073  uLong xdata_len;
2074  int ret;
2075 
2076  switch (ntohs (msg->type))
2077  {
2080 
2081  imsg =
2083  data_len = (uLong) ntohs (imsg->config_size);
2084  xdata_len =
2085  ntohs (imsg->header.size)
2087  xdata = (const Bytef *) &imsg[1];
2088  }
2089  break;
2090 
2092  const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
2093 
2094  imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *) msg;
2095  data_len = (uLong) ntohs (imsg->config_size);
2096  xdata_len = ntohs (imsg->header.size)
2097  - sizeof(struct GNUNET_TESTBED_SlaveConfiguration);
2098  xdata = (const Bytef *) &imsg[1];
2099  }
2100  break;
2101 
2103  const struct GNUNET_TESTBED_AddHostMessage *imsg;
2104  uint16_t osize;
2105 
2106  imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
2107  data_len = (uLong) ntohs (imsg->config_size);
2108  osize = sizeof(struct GNUNET_TESTBED_AddHostMessage)
2109  + ntohs (imsg->username_length) + ntohs (imsg->hostname_length);
2110  xdata_len = ntohs (imsg->header.size) - osize;
2111  xdata = (const Bytef *) ((const void *) imsg + osize);
2112  }
2113  break;
2114 
2116  const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
2117 
2118  imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg;
2119  data_len = ntohs (imsg->config_size);
2120  xdata_len = ntohs (imsg->header.size)
2121  - sizeof(const struct GNUNET_TESTBED_ControllerLinkResponse);
2122  xdata = (const Bytef *) &imsg[1];
2123  }
2124  break;
2125 
2127  const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
2128 
2129  imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *) msg;
2130  data_len = ntohs (imsg->config_size);
2131  xdata_len = ntohs (imsg->header.size)
2132  - sizeof(struct GNUNET_TESTBED_PeerCreateMessage);
2133  xdata = (const Bytef *) &imsg[1];
2134  }
2135  break;
2136 
2138  const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
2139 
2140  imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *) msg;
2141  data_len = ntohs (imsg->config_size);
2142  xdata_len = ntohs (imsg->header.size)
2143  - sizeof(struct GNUNET_TESTBED_PeerReconfigureMessage);
2144  xdata = (const Bytef *) &imsg[1];
2145  }
2146  break;
2147 
2148  default:
2149  GNUNET_assert (0);
2150  }
2151  data = GNUNET_malloc (data_len);
2152  if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
2153  {
2154  GNUNET_free (data);
2155  GNUNET_break_op (0); /* Un-compression failure */
2156  return NULL;
2157  }
2158  cfg = GNUNET_CONFIGURATION_create ();
2160  (const char *) data,
2161  (size_t) data_len,
2162  NULL))
2163  {
2164  GNUNET_free (data);
2165  GNUNET_break_op (0); /* De-serialization failure */
2166  return NULL;
2167  }
2168  GNUNET_free (data);
2169  return cfg;
2170 }
2171 
2172 
2180 const char *
2183 {
2184  uint16_t msize;
2185  const char *emsg;
2186 
2187  msize = ntohs (msg->header.size);
2188  if (sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
2189  return NULL;
2190  msize -= sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage);
2191  emsg = (const char *) &msg[1];
2192  if ('\0' != emsg[msize - 1])
2193  {
2194  GNUNET_break (0);
2195  return NULL;
2196  }
2197  return emsg;
2198 }
2199 
2200 
2208 uint64_t
2210 {
2211  uint64_t op_id;
2212 
2213  op_id = (uint64_t) GNUNET_TESTBED_host_get_id_ (controller->host);
2214  op_id = op_id << 32;
2215  op_id |= (uint64_t) controller->operation_counter++;
2216  return op_id;
2217 }
2218 
2219 
2225 static void
2227 {
2228  struct OperationContext *opc = cls;
2229  struct GNUNET_MQ_Envelope *env;
2231 
2232  opc->state = OPC_STATE_STARTED;
2234  msg->operation_id = GNUNET_htonll (opc->id);
2235  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
2236  GNUNET_MQ_send (opc->c->mq, env);
2237 }
2238 
2239 
2245 static void
2247 {
2248  struct OperationContext *opc = cls;
2249 
2250  switch (opc->state)
2251  {
2252  case OPC_STATE_STARTED:
2253  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
2254 
2255  /* no break; continue */
2256  case OPC_STATE_INIT:
2257  GNUNET_free (opc->data);
2258  break;
2259 
2260  case OPC_STATE_FINISHED:
2261  break;
2262  }
2263  GNUNET_free (opc);
2264 }
2265 
2266 
2282 struct GNUNET_TESTBED_Operation *
2284  void *op_cls,
2286  void *cb_cls)
2287 {
2288  struct OperationContext *opc;
2289  struct ShutdownPeersData *data;
2290 
2292  return NULL;
2293  data = GNUNET_new (struct ShutdownPeersData);
2294  data->cb = cb;
2295  data->cb_cls = cb_cls;
2296  opc = GNUNET_new (struct OperationContext);
2297  opc->c = c;
2298  opc->op_cls = op_cls;
2299  opc->data = data;
2300  opc->id = GNUNET_TESTBED_get_next_op_id (c);
2301  opc->type = OP_SHUTDOWN_PEERS;
2302  opc->state = OPC_STATE_INIT;
2307  opc->op);
2309  return opc->op;
2310 }
2311 
2312 
2321 uint32_t
2323 {
2324  return peer->unique_id;
2325 }
2326 
2327 
2334 void
2336 {
2337  struct GNUNET_TESTBED_Controller *c = barrier->c;
2338 
2339  GNUNET_assert (NULL != c->barrier_map); /* No barriers present */
2342  &barrier->key,
2343  barrier));
2344  GNUNET_free (barrier->name);
2345  GNUNET_free (barrier);
2347  {
2349  c->barrier_map = NULL;
2350  }
2351 }
2352 
2353 
2370 struct GNUNET_TESTBED_Barrier *
2372  const char *name,
2373  unsigned int quorum,
2375  void *cls,
2376  int echo)
2377 {
2379  struct GNUNET_MQ_Envelope *env;
2380  struct GNUNET_TESTBED_Barrier *barrier;
2381  struct GNUNET_HashCode key;
2382  size_t name_len;
2383 
2384  GNUNET_assert (quorum <= 100);
2385  GNUNET_assert (NULL != cb);
2386  name_len = strlen (name);
2387  GNUNET_assert (0 < name_len);
2388  GNUNET_CRYPTO_hash (name, name_len, &key);
2389  if (NULL == controller->barrier_map)
2390  controller->barrier_map =
2392  if (GNUNET_YES ==
2394  {
2395  GNUNET_break (0);
2396  return NULL;
2397  }
2398  LOG_DEBUG ("Initialising barrier `%s'\n", name);
2399  barrier = GNUNET_new (struct GNUNET_TESTBED_Barrier);
2400  barrier->c = controller;
2401  barrier->name = GNUNET_strdup (name);
2402  barrier->cb = cb;
2403  barrier->cls = cls;
2404  barrier->echo = echo;
2405  GNUNET_memcpy (&barrier->key, &key, sizeof(struct GNUNET_HashCode));
2408  controller->barrier_map,
2409  &barrier->key,
2410  barrier,
2412 
2413  env = GNUNET_MQ_msg_extra (msg,
2414  name_len,
2416  msg->quorum = (uint8_t) quorum;
2417  GNUNET_memcpy (msg->name, barrier->name, name_len);
2418  GNUNET_MQ_send (barrier->c->mq, env);
2419  return barrier;
2420 }
2421 
2422 
2437 struct GNUNET_TESTBED_Barrier *
2439  const char *name,
2440  unsigned int quorum,
2442  void *cls)
2443 {
2444  return GNUNET_TESTBED_barrier_init_ (controller,
2445  name,
2446  quorum,
2447  cb,
2448  cls,
2449  GNUNET_YES);
2450 }
2451 
2452 
2458 void
2460 {
2461  struct GNUNET_MQ_Envelope *env;
2463  size_t slen;
2464 
2465  slen = strlen (barrier->name);
2466  env =
2468  GNUNET_memcpy (msg->name, barrier->name, slen);
2469  GNUNET_MQ_send (barrier->c->mq, env);
2471 }
2472 
2473 
2474 /* 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:1981
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:468
Event notification from a controller to a client.
Definition: testbed.h:533
#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:439
Confirmation from the service that adding a host worked (or failed).
Definition: testbed.h:114
uint32_t peer_id
The id of the peer relevant to this information.
Definition: testbed.h:613
Message to request configuration of a slave controller.
Definition: testbed.h:637
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:475
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:1044
#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:160
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:1721
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:190
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:155
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.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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:2438
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER.
Definition: testbed.h:245
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:1959
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:1242
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:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
Message sent from client to testing service to reconfigure a (stopped) a peer.
Definition: testbed.h:240
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:191
Message to cancel a barrier.
Definition: testbed.h:804
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT.
Definition: testbed.h:513
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:1063
#define GNUNET_MESSAGE_TYPE_TESTBED_MAX
Not really a message, but for careful checks on the testbed messages; Should always be the maximum an...
#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:146
void * cb_cls
The closure for peer info callback.
void * op_cls
The operation closure.
Definition: testbed_api.h:151
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:836
The operation has been started.
Definition: testbed_api.h:123
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:174
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:213
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:688
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:234
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:209
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:224
#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:369
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:1832
Notify the service about a host that we intend to use.
Definition: testbed.h:64
uint64_t operation_id
Operation ID.
Definition: testbed.h:674
uint16_t config_size
The length of the uncompressed configuration.
Definition: testbed.h:97
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:538
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:603
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...
union GNUNET_TESTBED_PeerInformation::@73 result
The result of the get information operation; Choose according to the pit.
uint16_t config_size
The size of the configuration when uncompressed.
Definition: testbed.h:679
Context data for get slave config operations.
Definition: testbed_api.c:87
Event notification from a controller to a client.
Definition: testbed.h:442
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:99
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:543
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
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:608
#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.
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.
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:307
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:2209
#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:1004
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:543
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:826
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:302
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:601
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:618
static void oprelease_link_controllers(void *cls)
Callback which will be called when link-controllers type operation is released.
Definition: testbed_api.c:1444
Event notification from a controller to a client.
Definition: testbed.h:508
Initial message from a client to a testing control service.
Definition: testbed.h:36
uint64_t operation_id
Operation ID.
Definition: testbed.h:698
Initialization message for gnunet-helper-testbed to start testbed service.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
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:1529
#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:2067
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:148
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:775
uint32_t operation_counter
The operation id counter.
Definition: testbed_api.h:270
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:74
Response message for ControllerLinkRequest message.
Definition: testbed.h:169
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:184
void GNUNET_TESTBED_cleanup_peers_(void)
Frees all peers.
uint16_t status
status.
Definition: testbed.h:831
#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:573
uint16_t config_size
The length of the serialized configuration when uncompressed.
Definition: testbed.h:260
uint32_t delegated_host_id
For which host should requests be delegated? NBO.
Definition: testbed.h:146
uint16_t config_size
The size of configuration when uncompressed.
Definition: testbed.h:628
int32_t event_type
enum GNUNET_TESTBED_EventType (in NBO); either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER...
Definition: testbed.h:453
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:865
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:169
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:1028
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:1497
#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:265
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:1785
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:109
Link controllers operation.
Definition: testbed_api.h:89
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:161
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:133
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:524
#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:2335
#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:48
#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:1699
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:1407
#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:496
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:249
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:1422
struct OperationContext * opc
The result of the search.
Definition: testbed_api.c:230
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:1196
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
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:64
static void opstart_shutdown_peers(void *cls)
Function called when a shutdown peers operation is ready.
Definition: testbed_api.c:2226
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:1936
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:229
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:758
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:814
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:501
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:124
Peer start operation.
Definition: testbed_api.h:54
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Definition: testbed_api.c:75
char * name
The name of the barrier.
Definition: testbed_api.h:292
#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:2459
Internal representation of the hash map.
struct GNUNET_PeerIdentity peer_identity
Identity of the peer.
Definition: testbed.h:623
void * cc_cls
The closure for the above callback.
Definition: testbed_api.c:80
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:2045
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
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:277
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:2371
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:204
uint32_t slave_id
The id of the slave controller.
Definition: testbed_api.c:92
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:121
uint64_t operation_id
Operation ID.
Definition: testbed.h:652
#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:36
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:254
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.
uint32_t peer1
First peer.
Definition: testbed.h:491
static unsigned int size
Size of the "table".
Definition: peer.c:67
The peer is stopped.
uint16_t success
Set to GNUNET_YES to signify SUCCESS; GNUNET_NO to signify failure.
Definition: testbed.h:185
char data[0]
the barrier name (0-terminated) concatenated with an error message (0-terminated) if the status were ...
Definition: testbed.h:842
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:1336
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:659
GNUNET_TESTBED_OperationCompletionCallback cb
Overlay connection operation.
Definition: testbed_api.h:79
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:682
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:69
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:1106
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
Forwarded operation.
Definition: testbed_api.h:84
#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:548
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:1370
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:1555
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:117
static int opc_search_iterator(void *cls, uint32_t key, void *value)
Search iterator for searching an operation context.
Definition: testbed_api.c:249
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:180
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:486
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:129
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:49
#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:116
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:59
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1758
struct GNUNET_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:287
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:94
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:239
Start/stop service at a peer.
Definition: testbed_api.h:104
uint32_t unique_id
Globally unique ID of the peer.
void * cb_cls
The closure for the above callback.
Definition: testbed_api.c:126
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:244
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:282
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:225
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:2283
uint32_t slave_host_id
Which host is responsible for managing the delegation? NBO.
Definition: testbed.h:156
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:84
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:272
const char * name
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS.
Definition: testbed.h:119
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:341
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:218
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:162
#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:447
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION.
Definition: testbed.h:642
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:2322
#define GNUNET_log(kind,...)
Peer create operation.
Definition: testbed_api.h:49
uint8_t quorum
The quorum percentage needed for crossing the barrier.
Definition: testbed.h:792
uint64_t id
The id of the operation context we are searching for.
Definition: testbed_api.c:235
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:260
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:198
uint64_t event_mask
Event mask that specifies which events this client is interested in.
Definition: testbed.h:55
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:99
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:1894
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:138
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:298
static void opstart_get_slave_config(void *cls)
Function to be called when get slave config operation is ready.
Definition: testbed_api.c:1474
Event notification from a controller to a client for a generic operational success where the operatio...
Definition: testbed.h:557
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:837
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:151
Message for signalling status changes of a barrier.
Definition: testbed.h:821
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:355
char name[0]
name of the barrier.
Definition: testbed.h:797
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:2246
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:415
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:647
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
Message to cancel a barrier.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
Message to initialise a barrier.
Definition: testbed.h:782
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:143
uint16_t config_size
The size of the uncompressed configuration.
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:2181
Get peer information operation.
Definition: testbed_api.h:69
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:848
#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:141
uint16_t config_size
Size of the uncompressed configuration.
Definition: testbed.h:229
#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:53
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
#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:297
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
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:319
Client notifies controller that it should delegate requests for a particular client to a particular s...
Definition: testbed.h:136
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:664
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:104
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:1089