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 %lu successful\n", op_id);
452  if (NULL == (opc = find_opc (c, op_id)))
453  {
454  LOG_DEBUG ("Operation not found\n");
455  return;
456  }
458  event.op = opc->op;
459  event.op_cls = opc->op_cls;
460  event.details.operation_finished.emsg = NULL;
461  event.details.operation_finished.generic = NULL;
462  op_comp_cb = NULL;
463  op_comp_cb_cls = NULL;
464  switch (opc->type)
465  {
466  case OP_FORWARDED: {
468  opc,
469  (const struct
470  GNUNET_MessageHeader *) msg);
471  return;
472  }
473  break;
474 
475  case OP_PEER_DESTROY: {
476  struct GNUNET_TESTBED_Peer *peer;
477 
478  peer = opc->data;
480  GNUNET_free (peer);
481  opc->data = NULL;
482  // PEERDESTROYDATA
483  }
484  break;
485 
486  case OP_SHUTDOWN_PEERS: {
487  struct ShutdownPeersData *data;
488 
489  data = opc->data;
490  op_comp_cb = data->cb;
491  op_comp_cb_cls = data->cb_cls;
492  GNUNET_free (data);
493  opc->data = NULL;
495  }
496  break;
497 
498  case OP_MANAGE_SERVICE: {
499  struct ManageServiceData *data;
500 
501  GNUNET_assert (NULL != (data = opc->data));
502  op_comp_cb = data->cb;
503  op_comp_cb_cls = data->cb_cls;
504  GNUNET_free (data);
505  opc->data = NULL;
506  }
507  break;
508 
509  case OP_PEER_RECONFIGURE:
510  break;
511 
512  default:
513  GNUNET_assert (0);
514  }
515  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
516  opc->state = OPC_STATE_FINISHED;
517  exop_insert (event.op);
518  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
519  {
520  if (NULL != c->cc)
521  c->cc (c->cc_cls, &event);
522  if (GNUNET_NO == exop_check (event.op))
523  return;
524  }
525  else
526  LOG_DEBUG ("Not calling callback\n");
527  if (NULL != op_comp_cb)
528  op_comp_cb (op_comp_cb_cls, event.op, NULL);
529  /* You could have marked the operation as done by now */
530  GNUNET_break (GNUNET_NO == exop_check (event.op));
531 }
532 
533 
541 static void
543  void *cls,
545 {
546  struct GNUNET_TESTBED_Controller *c = cls;
547  struct OperationContext *opc;
548  struct PeerCreateData *data;
549  struct GNUNET_TESTBED_Peer *peer;
552  void *cb_cls;
553  uint64_t op_id;
554 
556  ntohs (msg->header.size));
557  op_id = GNUNET_ntohll (msg->operation_id);
558  if (NULL == (opc = find_opc (c, op_id)))
559  {
560  LOG_DEBUG ("Operation context for PeerCreateSuccessEvent not found\n");
561  return;
562  }
563  if (OP_FORWARDED == opc->type)
564  {
566  opc,
567  (const struct GNUNET_MessageHeader *) msg);
568  return;
569  }
571  GNUNET_assert (NULL != opc->data);
572  data = opc->data;
573  GNUNET_assert (NULL != data->peer);
574  peer = data->peer;
575  GNUNET_assert (peer->unique_id == ntohl (msg->peer_id));
576  peer->state = TESTBED_PS_CREATED;
578  cb = data->cb;
579  cb_cls = data->cls;
580  op = opc->op;
581  GNUNET_free (opc->data);
582  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
583  opc->state = OPC_STATE_FINISHED;
584  exop_insert (op);
585  if (NULL != cb)
586  cb (cb_cls, peer, NULL);
587  /* You could have marked the operation as done by now */
589 }
590 
591 
599 static void
601 {
602  struct GNUNET_TESTBED_Controller *c = cls;
603  struct OperationContext *opc;
604  struct GNUNET_TESTBED_Peer *peer;
605  struct PeerEventData *data;
607  void *pcc_cls;
608  struct GNUNET_TESTBED_EventInformation event;
609  uint64_t op_id;
610  uint64_t mask;
611 
613  ntohs (msg->header.size));
614  op_id = GNUNET_ntohll (msg->operation_id);
615  if (NULL == (opc = find_opc (c, op_id)))
616  {
617  LOG_DEBUG ("Operation not found\n");
618  return;
619  }
620  if (OP_FORWARDED == opc->type)
621  {
623  opc,
624  (const struct GNUNET_MessageHeader *) msg);
625  return;
626  }
627  GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
628  data = opc->data;
629  GNUNET_assert (NULL != data);
630  peer = data->peer;
631  GNUNET_assert (NULL != peer);
632  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
633  event.op = opc->op;
634  event.op_cls = opc->op_cls;
635  switch (event.type)
636  {
638  peer->state = TESTBED_PS_STARTED;
639  event.details.peer_start.host = peer->host;
640  event.details.peer_start.peer = peer;
641  break;
642 
644  peer->state = TESTBED_PS_STOPPED;
645  event.details.peer_stop.peer = peer;
646  break;
647 
648  default:
649  GNUNET_assert (0); /* We should never reach this state */
650  }
651  pcc = data->pcc;
652  pcc_cls = data->pcc_cls;
653  GNUNET_free (data);
654  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
655  opc->state = OPC_STATE_FINISHED;
656  exop_insert (event.op);
657  mask = 1LL << GNUNET_TESTBED_ET_PEER_START;
658  mask |= 1LL << GNUNET_TESTBED_ET_PEER_STOP;
659  if (0 != (mask & c->event_mask))
660  {
661  if (NULL != c->cc)
662  c->cc (c->cc_cls, &event);
663  if (GNUNET_NO == exop_check (event.op))
664  return;
665  }
666  if (NULL != pcc)
667  pcc (pcc_cls, NULL);
668  /* You could have marked the operation as done by now */
669  GNUNET_break (GNUNET_NO == exop_check (event.op));
670 }
671 
672 
680 static void
683 {
684  struct GNUNET_TESTBED_Controller *c = cls;
685  struct OperationContext *opc;
686  struct OverlayConnectData *data;
688  void *cb_cls;
689  struct GNUNET_TESTBED_EventInformation event;
690  uint64_t op_id;
691  uint64_t mask;
692 
693  op_id = GNUNET_ntohll (msg->operation_id);
694  if (NULL == (opc = find_opc (c, op_id)))
695  {
696  LOG_DEBUG ("Operation not found\n");
697  return;
698  }
699  if (OP_FORWARDED == opc->type)
700  {
702  opc,
703  (const struct GNUNET_MessageHeader *) msg);
704  return;
705  }
707  GNUNET_assert (NULL != (data = opc->data));
708  GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id) &&
709  (ntohl (msg->peer2) == data->p2->unique_id));
710  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
711  event.op = opc->op;
712  event.op_cls = opc->op_cls;
713  switch (event.type)
714  {
716  event.details.peer_connect.peer1 = data->p1;
717  event.details.peer_connect.peer2 = data->p2;
718  break;
719 
721  GNUNET_assert (0); /* FIXME: implement */
722  break;
723 
724  default:
725  GNUNET_assert (0); /* Should never reach here */
726  break;
727  }
728  cb = data->cb;
729  cb_cls = data->cb_cls;
730  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
731  opc->state = OPC_STATE_FINISHED;
732  exop_insert (event.op);
733  mask = 1LL << GNUNET_TESTBED_ET_CONNECT;
734  mask |= 1LL << GNUNET_TESTBED_ET_DISCONNECT;
735  if (0 != (mask & c->event_mask))
736  {
737  if (NULL != c->cc)
738  c->cc (c->cc_cls, &event);
739  if (GNUNET_NO == exop_check (event.op))
740  return;
741  }
742  if (NULL != cb)
743  cb (cb_cls, opc->op, NULL);
744  /* You could have marked the operation as done by now */
745  GNUNET_break (GNUNET_NO == exop_check (event.op));
746 }
747 
748 
756 static int
758  void *cls,
760 {
761  /* anything goes? */
762  return GNUNET_OK;
763 }
764 
765 
773 static void
775  void *cls,
777 {
778  struct GNUNET_TESTBED_Controller *c = cls;
779  struct OperationContext *opc;
780  struct GNUNET_TESTBED_Peer *peer;
781  struct PeerInfoData *data;
782  struct GNUNET_TESTBED_PeerInformation *pinfo;
784  void *cb_cls;
785  uint64_t op_id;
786 
787  op_id = GNUNET_ntohll (msg->operation_id);
788  if (NULL == (opc = find_opc (c, op_id)))
789  {
790  LOG_DEBUG ("Operation not found\n");
791  return;
792  }
793  if (OP_FORWARDED == opc->type)
794  {
795  handle_forwarded_operation_msg (c, opc, &msg->header);
796  return;
797  }
798  data = opc->data;
799  GNUNET_assert (NULL != data);
800  peer = data->peer;
801  GNUNET_assert (NULL != peer);
802  GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id);
804  pinfo->pit = data->pit;
805  cb = data->cb;
806  cb_cls = data->cb_cls;
807  GNUNET_assert (NULL != cb);
808  GNUNET_free (data);
809  opc->data = NULL;
810  switch (pinfo->pit)
811  {
813  pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity);
814  GNUNET_memcpy (pinfo->result.id,
815  &msg->peer_identity,
816  sizeof(struct GNUNET_PeerIdentity));
817  break;
818 
820  pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
822  break;
823 
825  GNUNET_assert (0); /* never reach here */
826  break;
827  }
828  opc->data = pinfo;
829  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
830  opc->state = OPC_STATE_FINISHED;
831  cb (cb_cls, opc->op, pinfo, NULL);
832  /* We dont check whether the operation is marked as done here as the
833  operation contains data (cfg/identify) which will be freed at a later point
834  */
835 }
836 
837 
846 static int
848  void *cls,
850 {
851  /* we accept anything as a valid error message */
852  return GNUNET_OK;
853 }
854 
855 
863 static void
865  void *cls,
867 {
868  struct GNUNET_TESTBED_Controller *c = cls;
869  struct OperationContext *opc;
870  const char *emsg;
871  uint64_t op_id;
872  uint64_t mask;
873  struct GNUNET_TESTBED_EventInformation event;
874 
875  op_id = GNUNET_ntohll (msg->operation_id);
876  if (NULL == (opc = find_opc (c, op_id)))
877  {
878  LOG_DEBUG ("Operation not found\n");
879  return;
880  }
881  if (OP_FORWARDED == opc->type)
882  {
884  opc,
885  (const struct GNUNET_MessageHeader *) msg);
886  return;
887  }
888  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
889  opc->state = OPC_STATE_FINISHED;
891  if (NULL == emsg)
892  emsg = "Unknown error";
893  if (OP_PEER_INFO == opc->type)
894  {
895  struct PeerInfoData *data;
896 
897  data = opc->data;
898  if (NULL != data->cb)
899  data->cb (data->cb_cls, opc->op, NULL, emsg);
900  GNUNET_free (data);
901  return; /* We do not call controller callback for peer info */
902  }
904  event.op = opc->op;
905  event.op_cls = opc->op_cls;
906  event.details.operation_finished.emsg = emsg;
907  event.details.operation_finished.generic = NULL;
908  mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
909  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
910  {
911  exop_insert (event.op);
912  c->cc (c->cc_cls, &event);
913  if (GNUNET_NO == exop_check (event.op))
914  return;
915  }
916  switch (opc->type)
917  {
918  case OP_PEER_CREATE: {
919  struct PeerCreateData *data;
920 
921  data = opc->data;
922  GNUNET_free (data->peer);
923  if (NULL != data->cb)
924  data->cb (data->cls, NULL, emsg);
925  GNUNET_free (data);
926  }
927  break;
928 
929  case OP_PEER_START:
930  case OP_PEER_STOP: {
931  struct PeerEventData *data;
932 
933  data = opc->data;
934  if (NULL != data->pcc)
935  data->pcc (data->pcc_cls, emsg);
936  GNUNET_free (data);
937  }
938  break;
939 
940  case OP_PEER_DESTROY:
941  break;
942 
943  case OP_PEER_INFO:
944  GNUNET_assert (0);
945 
946  case OP_OVERLAY_CONNECT: {
947  struct OverlayConnectData *data;
948 
949  data = opc->data;
951  if (NULL != data->cb)
952  data->cb (data->cb_cls, opc->op, emsg);
953  }
954  break;
955 
956  case OP_FORWARDED:
957  GNUNET_assert (0);
958 
959  case OP_LINK_CONTROLLERS: /* No secondary callback */
960  break;
961 
962  case OP_SHUTDOWN_PEERS: {
963  struct ShutdownPeersData *data;
964 
965  data = opc->data;
966  GNUNET_free (data); /* FIXME: Decide whether we call data->op_cb */
967  opc->data = NULL;
968  }
969  break;
970 
971  case OP_MANAGE_SERVICE: {
972  struct ManageServiceData *data = opc->data;
974  void *cb_cls;
975 
976  GNUNET_assert (NULL != data);
977  cb = data->cb;
978  cb_cls = data->cb_cls;
979  GNUNET_free (data);
980  opc->data = NULL;
981  exop_insert (event.op);
982  if (NULL != cb)
983  cb (cb_cls, opc->op, emsg);
984  /* You could have marked the operation as done by now */
985  GNUNET_break (GNUNET_NO == exop_check (event.op));
986  }
987  break;
988 
989  default:
990  GNUNET_break (0);
991  }
992 }
993 
994 
1004 {
1006  uint16_t msize;
1007 
1008  msize = sizeof(struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
1009  msg = GNUNET_malloc (msize);
1010  msg->header.size = htons (msize);
1011  msg->header.type =
1013  msg->operation_id = GNUNET_htonll (op_id);
1014  msg->slave_id = htonl (slave_id);
1015  return msg;
1016 }
1017 
1018 
1026 static int
1028  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1029 {
1030  /* anything goes? */
1031  return GNUNET_OK;
1032 }
1033 
1034 
1042 static void
1044  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1045 {
1046  struct GNUNET_TESTBED_Controller *c = cls;
1047  struct OperationContext *opc;
1048  uint64_t op_id;
1049  uint64_t mask;
1050  struct GNUNET_TESTBED_EventInformation event;
1051 
1052  op_id = GNUNET_ntohll (msg->operation_id);
1053  if (NULL == (opc = find_opc (c, op_id)))
1054  {
1055  LOG_DEBUG ("Operation not found\n");
1056  return;
1057  }
1058  if (OP_GET_SLAVE_CONFIG != opc->type)
1059  {
1060  GNUNET_break (0);
1061  return;
1062  }
1063  opc->state = OPC_STATE_FINISHED;
1064  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1066  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
1067  {
1070  event.op = opc->op;
1071  event.op_cls = opc->op_cls;
1072  event.details.operation_finished.generic = opc->data;
1073  event.details.operation_finished.emsg = NULL;
1074  c->cc (c->cc_cls, &event);
1075  }
1076 }
1077 
1078 
1087 static int
1089  void *cls,
1091 {
1092  /* actual check to be implemented */
1093  return GNUNET_OK;
1094 }
1095 
1096 
1104 static void
1106  void *cls,
1108 {
1109  struct GNUNET_TESTBED_Controller *c = cls;
1110  struct OperationContext *opc;
1111  struct ControllerLinkData *data;
1113  struct GNUNET_TESTBED_Host *host;
1114  char *emsg;
1115  uint64_t op_id;
1116  struct GNUNET_TESTBED_EventInformation event;
1117 
1118  op_id = GNUNET_ntohll (msg->operation_id);
1119  if (NULL == (opc = find_opc (c, op_id)))
1120  {
1121  LOG_DEBUG ("Operation not found\n");
1122  return;
1123  }
1124  if (OP_FORWARDED == opc->type)
1125  {
1127  opc,
1128  (const struct GNUNET_MessageHeader *) msg);
1129  return;
1130  }
1131  if (OP_LINK_CONTROLLERS != opc->type)
1132  {
1133  GNUNET_break (0);
1134  return;
1135  }
1136  GNUNET_assert (NULL != (data = opc->data));
1138  GNUNET_assert (NULL != host);
1139  GNUNET_free (data);
1140  opc->data = NULL;
1141  opc->state = OPC_STATE_FINISHED;
1142  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1144  event.op = opc->op;
1145  event.op_cls = opc->op_cls;
1146  event.details.operation_finished.emsg = NULL;
1147  event.details.operation_finished.generic = NULL;
1148  emsg = NULL;
1149  cfg = NULL;
1150  if (GNUNET_NO == ntohs (msg->success))
1151  {
1152  emsg =
1153  GNUNET_malloc (ntohs (msg->header.size)
1154  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse)
1155  + 1);
1156  GNUNET_memcpy (emsg,
1157  &msg[1],
1158  ntohs (msg->header.size)
1159  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse));
1160  event.details.operation_finished.emsg = emsg;
1161  }
1162  else
1163  {
1164  if (0 != ntohs (msg->config_size))
1165  {
1167  (const struct GNUNET_MessageHeader *) msg);
1168  GNUNET_assert (NULL != cfg);
1170  }
1171  }
1172  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
1173  {
1174  if (NULL != c->cc)
1175  c->cc (c->cc_cls, &event);
1176  }
1177  else
1178  LOG_DEBUG ("Not calling callback\n");
1179  if (NULL != cfg)
1181  GNUNET_free_non_null (emsg);
1182 }
1183 
1184 
1194 static int
1196  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1197 {
1198  uint16_t msize;
1199  uint16_t name_len;
1200  int status;
1201  const char *name;
1202  size_t emsg_len;
1203 
1204  msize = ntohs (msg->header.size);
1205  name = msg->data;
1206  name_len = ntohs (msg->name_len);
1207 
1208  if (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) + name_len + 1 > msize)
1209  {
1210  GNUNET_break_op (0);
1211  return GNUNET_SYSERR;
1212  }
1213  if ('\0' != name[name_len])
1214  {
1215  GNUNET_break_op (0);
1216  return GNUNET_SYSERR;
1217  }
1218  status = ntohs (msg->status);
1219  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1220  {
1221  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1222  + name_len + 1); /* +1!? */
1223  if (0 == emsg_len)
1224  {
1225  GNUNET_break_op (0);
1226  return GNUNET_SYSERR;
1227  }
1228  }
1229  return GNUNET_OK;
1230 }
1231 
1232 
1240 static void
1242  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1243 {
1244  struct GNUNET_TESTBED_Controller *c = cls;
1245  struct GNUNET_TESTBED_Barrier *barrier;
1246  char *emsg;
1247  const char *name;
1248  struct GNUNET_HashCode key;
1249  size_t emsg_len;
1250  int status;
1251  uint16_t msize;
1252  uint16_t name_len;
1253 
1254  emsg = NULL;
1255  barrier = NULL;
1256  msize = ntohs (msg->header.size);
1257  if (msize <= sizeof(struct GNUNET_TESTBED_BarrierStatusMsg))
1258  {
1259  GNUNET_break_op (0);
1260  goto cleanup;
1261  }
1262  name = msg->data;
1263  name_len = ntohs (msg->name_len);
1264  if (name_len >= // name_len is strlen(barrier_name)
1265  (msize - ((sizeof msg->header) + sizeof(msg->status))))
1266  {
1267  GNUNET_break_op (0);
1268  goto cleanup;
1269  }
1270  if ('\0' != name[name_len])
1271  {
1272  GNUNET_break_op (0);
1273  goto cleanup;
1274  }
1275  LOG_DEBUG ("Received BARRIER_STATUS msg\n");
1276  status = ntohs (msg->status);
1277  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1278  {
1279  status = -1;
1280  // unlike name_len, emsg_len includes the trailing zero
1281  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1282  + (name_len + 1));
1283  if (0 == emsg_len)
1284  {
1285  GNUNET_break_op (0);
1286  goto cleanup;
1287  }
1288  if ('\0' != (msg->data[(name_len + 1) + (emsg_len - 1)]))
1289  {
1290  GNUNET_break_op (0);
1291  goto cleanup;
1292  }
1293  emsg = GNUNET_malloc (emsg_len);
1294  GNUNET_memcpy (emsg, msg->data + name_len + 1, emsg_len);
1295  }
1296  if (NULL == c->barrier_map)
1297  {
1298  GNUNET_break_op (0);
1299  goto cleanup;
1300  }
1301  GNUNET_CRYPTO_hash (name, name_len, &key);
1302  barrier = GNUNET_CONTAINER_multihashmap_get (c->barrier_map, &key);
1303  if (NULL == barrier)
1304  {
1305  GNUNET_break_op (0);
1306  goto cleanup;
1307  }
1308  GNUNET_assert (NULL != barrier->cb);
1309  if ((GNUNET_YES == barrier->echo) &&
1312  barrier->cb (barrier->cls, name, barrier, status, emsg);
1314  return; /* just initialised; skip cleanup */
1315 
1316 cleanup:
1317  GNUNET_free_non_null (emsg);if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
1325 }
1326 
1327 
1334 void
1336  struct GNUNET_MessageHeader *msg)
1337 {
1338  struct GNUNET_MQ_Envelope *env;
1339  struct GNUNET_MessageHeader *m2;
1340  uint16_t type;
1341  uint16_t size;
1342 
1343  type = ntohs (msg->type);
1344  size = ntohs (msg->size);
1347  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1348  GNUNET_memcpy (m2, msg, size);
1349  GNUNET_free (msg);
1350  GNUNET_MQ_send (controller->mq, env);
1351 }
1352 
1353 
1368 struct OperationContext *
1370  struct GNUNET_TESTBED_Controller *controller,
1371  uint64_t operation_id,
1372  const struct GNUNET_MessageHeader *msg,
1374  void *cc_cls)
1375 {
1376  struct OperationContext *opc;
1377  struct ForwardedOperationData *data;
1378  struct GNUNET_MQ_Envelope *env;
1379  struct GNUNET_MessageHeader *m2;
1380  uint16_t type = ntohs (msg->type);
1381  uint16_t size = ntohs (msg->size);
1382 
1383  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1384  GNUNET_memcpy (m2, msg, size);
1385  GNUNET_MQ_send (controller->mq, env);
1386  data = GNUNET_new (struct ForwardedOperationData);
1387  data->cc = cc;
1388  data->cc_cls = cc_cls;
1389  opc = GNUNET_new (struct OperationContext);
1390  opc->c = controller;
1391  opc->type = OP_FORWARDED;
1392  opc->data = data;
1393  opc->id = operation_id;
1394  GNUNET_TESTBED_insert_opc_ (controller, opc);
1395  return opc;
1396 }
1397 
1398 
1405 void
1407 {
1408  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1409  GNUNET_free (opc->data);
1410  GNUNET_free (opc);
1411 }
1412 
1413 
1420 static void
1422 {
1423  struct OperationContext *opc = cls;
1424  struct ControllerLinkData *data;
1426 
1427  GNUNET_assert (NULL != opc->data);
1428  data = opc->data;
1429  msg = data->msg;
1430  data->msg = NULL;
1431  opc->state = OPC_STATE_STARTED;
1432  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1433  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1434 }
1435 
1436 
1442 static void
1444 {
1445  struct OperationContext *opc = cls;
1446  struct ControllerLinkData *data;
1447 
1448  data = opc->data;
1449  switch (opc->state)
1450  {
1451  case OPC_STATE_INIT:
1452  GNUNET_free (data->msg);
1453  break;
1454 
1455  case OPC_STATE_STARTED:
1456  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1457  break;
1458 
1459  case OPC_STATE_FINISHED:
1460  break;
1461  }
1462  GNUNET_free_non_null (data);
1463  GNUNET_free (opc);
1464 }
1465 
1466 
1472 static void
1474 {
1475  struct OperationContext *opc = cls;
1476  struct GetSlaveConfigData *data = opc->data;
1478 
1479  GNUNET_assert (NULL != data);
1481  GNUNET_free (opc->data);
1482  data = NULL;
1483  opc->data = NULL;
1484  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1485  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1486  opc->state = OPC_STATE_STARTED;
1487 }
1488 
1489 
1495 static void
1497 {
1498  struct OperationContext *opc = cls;
1499 
1500  switch (opc->state)
1501  {
1502  case OPC_STATE_INIT:
1503  GNUNET_free (opc->data);
1504  break;
1505 
1506  case OPC_STATE_STARTED:
1507  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1508  break;
1509 
1510  case OPC_STATE_FINISHED:
1511  if (NULL != opc->data)
1513  break;
1514  }
1515  GNUNET_free (opc);
1516 }
1517 
1518 
1527 static void
1528 mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
1529 {
1530  /* struct GNUNET_TESTBED_Controller *c = cls; */
1531 
1532  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Encountered MQ error: %d\n", error);
1533  /* now what? */
1534  GNUNET_SCHEDULER_shutdown (); /* seems most reasonable */
1535 }
1536 
1537 
1555  uint64_t event_mask,
1557  void *cc_cls)
1558 {
1559  struct GNUNET_TESTBED_Controller *controller =
1561  struct GNUNET_MQ_MessageHandler handlers[] =
1562  { GNUNET_MQ_hd_var_size (add_host_confirm,
1565  controller),
1566  GNUNET_MQ_hd_fixed_size (peer_conevent,
1569  controller),
1570  GNUNET_MQ_hd_fixed_size (opsuccess,
1572  struct
1574  controller),
1575  GNUNET_MQ_hd_var_size (op_fail_event,
1578  controller),
1579  GNUNET_MQ_hd_fixed_size (peer_create_success,
1581  struct
1583  controller),
1584  GNUNET_MQ_hd_fixed_size (peer_event,
1587  controller),
1588  GNUNET_MQ_hd_var_size (peer_config,
1590  struct
1592  controller),
1593  GNUNET_MQ_hd_var_size (slave_config,
1596  controller),
1597  GNUNET_MQ_hd_var_size (link_controllers_result,
1600  controller),
1601  GNUNET_MQ_hd_var_size (barrier_status,
1604  controller),
1605  GNUNET_MQ_handler_end () };
1607  struct GNUNET_MQ_Envelope *env;
1608  const struct GNUNET_CONFIGURATION_Handle *cfg;
1609  const char *controller_hostname;
1610  unsigned long long max_parallel_operations;
1611  unsigned long long max_parallel_service_connections;
1612  unsigned long long max_parallel_topology_config_operations;
1613  size_t slen;
1614 
1615  GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host)));
1616  if (GNUNET_OK !=
1618  "testbed",
1619  "MAX_PARALLEL_OPERATIONS",
1620  &max_parallel_operations))
1621  {
1622  GNUNET_break (0);
1623  GNUNET_free (controller);
1624  return NULL;
1625  }
1626  if (GNUNET_OK !=
1628  "testbed",
1629  "MAX_PARALLEL_SERVICE_CONNECTIONS",
1630  &max_parallel_service_connections))
1631  {
1632  GNUNET_break (0);
1633  GNUNET_free (controller);
1634  return NULL;
1635  }
1637  cfg,
1638  "testbed",
1639  "MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS",
1640  &max_parallel_topology_config_operations))
1641  {
1642  GNUNET_break (0);
1643  GNUNET_free (controller);
1644  return NULL;
1645  }
1646  controller->cc = cc;
1647  controller->cc_cls = cc_cls;
1648  controller->event_mask = event_mask;
1649  controller->cfg = GNUNET_CONFIGURATION_dup (cfg);
1650  controller->mq = GNUNET_CLIENT_connect (controller->cfg,
1651  "testbed",
1652  handlers,
1654  controller);
1655  if (NULL == controller->mq)
1656  {
1657  GNUNET_break (0);
1659  return NULL;
1660  }
1661  GNUNET_TESTBED_mark_host_registered_at_ (host, controller);
1662  controller->host = host;
1663  controller->opq_parallel_operations =
1665  (unsigned int)
1666  max_parallel_operations);
1667  controller->opq_parallel_service_connections =
1669  (unsigned int)
1670  max_parallel_service_connections);
1674  (unsigned int) max_parallel_topology_config_operations);
1675  controller_hostname = GNUNET_TESTBED_host_get_hostname (host);
1676  if (NULL == controller_hostname)
1677  controller_hostname = "127.0.0.1";
1678  slen = strlen (controller_hostname) + 1;
1680  msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
1681  msg->event_mask = GNUNET_htonll (controller->event_mask);
1682  GNUNET_memcpy (&msg[1], controller_hostname, slen);
1683  GNUNET_MQ_send (controller->mq, env);
1684  return controller;
1685 }
1686 
1687 
1697 static int
1698 opc_free_iterator (void *cls, uint32_t key, void *value)
1699 {
1700  struct GNUNET_CONTAINER_MultiHashMap32 *map = cls;
1701  struct OperationContext *opc = value;
1702 
1703  GNUNET_assert (NULL != opc);
1704  GNUNET_break (0);
1706  GNUNET_CONTAINER_multihashmap32_remove (map, key, value));
1707  GNUNET_free (opc);
1708  return GNUNET_YES;
1709 }
1710 
1711 
1719 void
1721 {
1722  if (NULL != c->mq)
1723  {
1724  GNUNET_MQ_destroy (c->mq);
1725  c->mq = NULL;
1726  }
1727  if (NULL != c->host)
1734  if (NULL != c->opc_map)
1735  {
1739  c->opc_map));
1742  }
1743  GNUNET_free (c);
1744 }
1745 
1746 
1756 size_t
1758  size_t size,
1759  char **xconfig)
1760 {
1761  size_t xsize;
1762 
1763  xsize = compressBound ((uLong) size);
1764  *xconfig = GNUNET_malloc (xsize);
1765  GNUNET_assert (Z_OK == compress2 ((Bytef *) *xconfig,
1766  (uLongf *) &xsize,
1767  (const Bytef *) config,
1768  (uLongf) size,
1769  Z_BEST_SPEED));
1770  return xsize;
1771 }
1772 
1773 
1783 char *
1785  size_t *size,
1786  size_t *xsize)
1787 {
1788  char *config;
1789  char *xconfig;
1790  size_t size_;
1791  size_t xsize_;
1792 
1793  config = GNUNET_CONFIGURATION_serialize (cfg, &size_);
1794  xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig);
1795  GNUNET_free (config);
1796  *size = size_;
1797  *xsize = xsize_;
1798  return xconfig;
1799 }
1800 
1801 
1830 struct GNUNET_TESTBED_Operation *
1832  struct GNUNET_TESTBED_Controller *master,
1833  struct GNUNET_TESTBED_Host *delegated_host,
1834  struct GNUNET_TESTBED_Host *slave_host,
1835  int is_subordinate)
1836 {
1837  struct OperationContext *opc;
1839  struct ControllerLinkData *data;
1840  uint32_t slave_host_id;
1841  uint32_t delegated_host_id;
1842  uint16_t msg_size;
1843 
1845  GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
1846  slave_host_id = GNUNET_TESTBED_host_get_id_ (
1847  (NULL != slave_host) ? slave_host : master->host);
1848  delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
1849  if ((NULL != slave_host) && (0 != slave_host_id))
1851  GNUNET_TESTBED_is_host_registered_ (slave_host, master));
1852  msg_size = sizeof(struct GNUNET_TESTBED_ControllerLinkRequest);
1853  msg = GNUNET_malloc (msg_size);
1855  msg->header.size = htons (msg_size);
1856  msg->delegated_host_id = htonl (delegated_host_id);
1857  msg->slave_host_id = htonl (slave_host_id);
1858  msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
1859  data = GNUNET_new (struct ControllerLinkData);
1860  data->msg = msg;
1861  data->host_id = delegated_host_id;
1862  opc = GNUNET_new (struct OperationContext);
1863  opc->c = master;
1864  opc->data = data;
1865  opc->type = OP_LINK_CONTROLLERS;
1866  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
1867  opc->state = OPC_STATE_INIT;
1868  opc->op_cls = op_cls;
1869  msg->operation_id = GNUNET_htonll (opc->id);
1874  opc->op);
1876  return opc->op;
1877 }
1878 
1879 
1892 struct GNUNET_TESTBED_Operation *
1894  struct GNUNET_TESTBED_Controller *master,
1895  uint32_t slave_host_id)
1896 {
1897  struct OperationContext *opc;
1898  struct GetSlaveConfigData *data;
1899 
1900  data = GNUNET_new (struct GetSlaveConfigData);
1901  data->slave_id = slave_host_id;
1902  opc = GNUNET_new (struct OperationContext);
1903  opc->state = OPC_STATE_INIT;
1904  opc->c = master;
1905  opc->id = GNUNET_TESTBED_get_next_op_id (master);
1906  opc->type = OP_GET_SLAVE_CONFIG;
1907  opc->data = data;
1908  opc->op_cls = op_cls;
1913  opc->op);
1915  return opc->op;
1916 }
1917 
1918 
1934 struct GNUNET_TESTBED_Operation *
1936  struct GNUNET_TESTBED_Controller *master,
1937  struct GNUNET_TESTBED_Host *slave_host)
1938 {
1939  if (GNUNET_NO == GNUNET_TESTBED_is_host_registered_ (slave_host, master))
1940  return NULL;
1941  return GNUNET_TESTBED_get_slave_config_ (op_cls,
1942  master,
1944  slave_host));
1945 }
1946 
1947 
1957 void
1959  struct GNUNET_TESTBED_Controller *controller,
1960  const char *filename)
1961 {
1962  GNUNET_break (0);
1963 }
1964 
1965 
1981  const char *trusted_ip,
1982  const char *hostname,
1983  const struct GNUNET_CONFIGURATION_Handle *cfg)
1984 {
1986  char *config;
1987  char *xconfig;
1988  size_t config_size;
1989  size_t xconfig_size;
1990  uint16_t trusted_ip_len;
1991  uint16_t hostname_len;
1992  uint16_t msg_size;
1993 
1994  config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
1995  GNUNET_assert (NULL != config);
1996  xconfig_size =
1997  GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
1998  GNUNET_free (config);
1999  trusted_ip_len = strlen (trusted_ip);
2000  hostname_len = (NULL == hostname) ? 0 : strlen (hostname);
2001  msg_size = xconfig_size + trusted_ip_len + 1
2002  + sizeof(struct GNUNET_TESTBED_HelperInit);
2003  msg_size += hostname_len;
2004  msg = GNUNET_realloc (xconfig, msg_size);
2005  (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len,
2006  msg,
2007  xconfig_size);
2008  msg->header.size = htons (msg_size);
2009  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
2010  msg->trusted_ip_size = htons (trusted_ip_len);
2011  msg->hostname_size = htons (hostname_len);
2012  msg->config_size = htons (config_size);
2013  (void) strcpy ((char *) &msg[1], trusted_ip);
2014  if (0 != hostname_len)
2015  GNUNET_memcpy ((char *) &msg[1] + trusted_ip_len + 1,
2016  hostname,
2017  hostname_len);
2018  return msg;
2019 }
2020 
2021 
2043 void
2045 {
2046  (void) exop_check (operation);
2048 }
2049 
2050 
2067 {
2069  Bytef *data;
2070  const Bytef *xdata;
2071  uLong data_len;
2072  uLong xdata_len;
2073  int ret;
2074 
2075  switch (ntohs (msg->type))
2076  {
2079 
2080  imsg =
2082  data_len = (uLong) ntohs (imsg->config_size);
2083  xdata_len =
2084  ntohs (imsg->header.size)
2086  xdata = (const Bytef *) &imsg[1];
2087  }
2088  break;
2089 
2091  const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
2092 
2093  imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *) msg;
2094  data_len = (uLong) ntohs (imsg->config_size);
2095  xdata_len = ntohs (imsg->header.size)
2096  - sizeof(struct GNUNET_TESTBED_SlaveConfiguration);
2097  xdata = (const Bytef *) &imsg[1];
2098  }
2099  break;
2100 
2102  const struct GNUNET_TESTBED_AddHostMessage *imsg;
2103  uint16_t osize;
2104 
2105  imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
2106  data_len = (uLong) ntohs (imsg->config_size);
2107  osize = sizeof(struct GNUNET_TESTBED_AddHostMessage)
2108  + ntohs (imsg->username_length) + ntohs (imsg->hostname_length);
2109  xdata_len = ntohs (imsg->header.size) - osize;
2110  xdata = (const Bytef *) ((const void *) imsg + osize);
2111  }
2112  break;
2113 
2115  const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
2116 
2117  imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg;
2118  data_len = ntohs (imsg->config_size);
2119  xdata_len = ntohs (imsg->header.size)
2120  - sizeof(const struct GNUNET_TESTBED_ControllerLinkResponse);
2121  xdata = (const Bytef *) &imsg[1];
2122  }
2123  break;
2124 
2126  const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
2127 
2128  imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *) msg;
2129  data_len = ntohs (imsg->config_size);
2130  xdata_len = ntohs (imsg->header.size)
2131  - sizeof(struct GNUNET_TESTBED_PeerCreateMessage);
2132  xdata = (const Bytef *) &imsg[1];
2133  }
2134  break;
2135 
2137  const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
2138 
2139  imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *) msg;
2140  data_len = ntohs (imsg->config_size);
2141  xdata_len = ntohs (imsg->header.size)
2142  - sizeof(struct GNUNET_TESTBED_PeerReconfigureMessage);
2143  xdata = (const Bytef *) &imsg[1];
2144  }
2145  break;
2146 
2147  default:
2148  GNUNET_assert (0);
2149  }
2150  data = GNUNET_malloc (data_len);
2151  if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
2152  {
2153  GNUNET_free (data);
2154  GNUNET_break_op (0); /* Un-compression failure */
2155  return NULL;
2156  }
2157  cfg = GNUNET_CONFIGURATION_create ();
2159  (const char *) data,
2160  (size_t) data_len,
2161  NULL))
2162  {
2163  GNUNET_free (data);
2164  GNUNET_break_op (0); /* De-serialization failure */
2165  return NULL;
2166  }
2167  GNUNET_free (data);
2168  return cfg;
2169 }
2170 
2171 
2179 const char *
2182 {
2183  uint16_t msize;
2184  const char *emsg;
2185 
2186  msize = ntohs (msg->header.size);
2187  if (sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
2188  return NULL;
2189  msize -= sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage);
2190  emsg = (const char *) &msg[1];
2191  if ('\0' != emsg[msize - 1])
2192  {
2193  GNUNET_break (0);
2194  return NULL;
2195  }
2196  return emsg;
2197 }
2198 
2199 
2207 uint64_t
2209 {
2210  uint64_t op_id;
2211 
2212  op_id = (uint64_t) GNUNET_TESTBED_host_get_id_ (controller->host);
2213  op_id = op_id << 32;
2214  op_id |= (uint64_t) controller->operation_counter++;
2215  return op_id;
2216 }
2217 
2218 
2224 static void
2226 {
2227  struct OperationContext *opc = cls;
2228  struct GNUNET_MQ_Envelope *env;
2230 
2231  opc->state = OPC_STATE_STARTED;
2233  msg->operation_id = GNUNET_htonll (opc->id);
2234  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
2235  GNUNET_MQ_send (opc->c->mq, env);
2236 }
2237 
2238 
2244 static void
2246 {
2247  struct OperationContext *opc = cls;
2248 
2249  switch (opc->state)
2250  {
2251  case OPC_STATE_STARTED:
2252  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
2253 
2254  /* no break; continue */
2255  case OPC_STATE_INIT:
2256  GNUNET_free (opc->data);
2257  break;
2258 
2259  case OPC_STATE_FINISHED:
2260  break;
2261  }
2262  GNUNET_free (opc);
2263 }
2264 
2265 
2281 struct GNUNET_TESTBED_Operation *
2283  void *op_cls,
2285  void *cb_cls)
2286 {
2287  struct OperationContext *opc;
2288  struct ShutdownPeersData *data;
2289 
2291  return NULL;
2292  data = GNUNET_new (struct ShutdownPeersData);
2293  data->cb = cb;
2294  data->cb_cls = cb_cls;
2295  opc = GNUNET_new (struct OperationContext);
2296  opc->c = c;
2297  opc->op_cls = op_cls;
2298  opc->data = data;
2299  opc->id = GNUNET_TESTBED_get_next_op_id (c);
2300  opc->type = OP_SHUTDOWN_PEERS;
2301  opc->state = OPC_STATE_INIT;
2306  opc->op);
2308  return opc->op;
2309 }
2310 
2311 
2320 uint32_t
2322 {
2323  return peer->unique_id;
2324 }
2325 
2326 
2333 void
2335 {
2336  struct GNUNET_TESTBED_Controller *c = barrier->c;
2337 
2338  GNUNET_assert (NULL != c->barrier_map); /* No barriers present */
2341  &barrier->key,
2342  barrier));
2343  GNUNET_free (barrier->name);
2344  GNUNET_free (barrier);
2346  {
2348  c->barrier_map = NULL;
2349  }
2350 }
2351 
2352 
2369 struct GNUNET_TESTBED_Barrier *
2371  const char *name,
2372  unsigned int quorum,
2374  void *cls,
2375  int echo)
2376 {
2378  struct GNUNET_MQ_Envelope *env;
2379  struct GNUNET_TESTBED_Barrier *barrier;
2380  struct GNUNET_HashCode key;
2381  size_t name_len;
2382 
2383  GNUNET_assert (quorum <= 100);
2384  GNUNET_assert (NULL != cb);
2385  name_len = strlen (name);
2386  GNUNET_assert (0 < name_len);
2387  GNUNET_CRYPTO_hash (name, name_len, &key);
2388  if (NULL == controller->barrier_map)
2389  controller->barrier_map =
2391  if (GNUNET_YES ==
2393  {
2394  GNUNET_break (0);
2395  return NULL;
2396  }
2397  LOG_DEBUG ("Initialising barrier `%s'\n", name);
2398  barrier = GNUNET_new (struct GNUNET_TESTBED_Barrier);
2399  barrier->c = controller;
2400  barrier->name = GNUNET_strdup (name);
2401  barrier->cb = cb;
2402  barrier->cls = cls;
2403  barrier->echo = echo;
2404  GNUNET_memcpy (&barrier->key, &key, sizeof(struct GNUNET_HashCode));
2407  controller->barrier_map,
2408  &barrier->key,
2409  barrier,
2411 
2412  env = GNUNET_MQ_msg_extra (msg,
2413  name_len,
2415  msg->quorum = (uint8_t) quorum;
2416  GNUNET_memcpy (msg->name, barrier->name, name_len);
2417  GNUNET_MQ_send (barrier->c->mq, env);
2418  return barrier;
2419 }
2420 
2421 
2436 struct GNUNET_TESTBED_Barrier *
2438  const char *name,
2439  unsigned int quorum,
2441  void *cls)
2442 {
2443  return GNUNET_TESTBED_barrier_init_ (controller,
2444  name,
2445  quorum,
2446  cb,
2447  cls,
2448  GNUNET_YES);
2449 }
2450 
2451 
2457 void
2459 {
2460  struct GNUNET_MQ_Envelope *env;
2462  size_t slen;
2463 
2464  slen = strlen (barrier->name);
2465  env =
2467  GNUNET_memcpy (msg->name, barrier->name, slen);
2468  GNUNET_MQ_send (barrier->c->mq, env);
2470 }
2471 
2472 
2473 /* 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:1980
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:1043
#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:1720
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:2437
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:1958
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:1241
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:1057
#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:1831
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...
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:542
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.
#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: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:2208
#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:1003
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:600
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:1443
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:526
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:1528
#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:2066
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:774
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:181
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:864
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:1027
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:1496
#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:1784
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:2334
#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:1698
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:1406
#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:1421
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:1195
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:2225
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:1935
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:757
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:2458
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:2044
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:2370
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: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: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.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
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:1335
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:681
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:1105
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:1369
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:1554
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:1757
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:2282
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:85
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:2321
#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:1893
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:1473
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:824
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:151
#define GNUNET_YES
Definition: gnunet_common.h:77
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:353
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:2245
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.
union GNUNET_TESTBED_PeerInformation::@61 result
The result of the get information operation; Choose according to the pit.
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:2180
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:847
#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:48
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:1088