GNUnet  0.10.x
testbed_api.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2008--2013 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
29 #include "platform.h"
30 #include "gnunet_testbed_service.h"
31 #include "gnunet_core_service.h"
32 #include "gnunet_constants.h"
34 #include "gnunet_hello_lib.h"
35 #include <zlib.h>
36 
37 #include "testbed.h"
38 #include "testbed_api.h"
39 #include "testbed_api_hosts.h"
40 #include "testbed_api_peers.h"
41 #include "testbed_api_operations.h"
42 #include "testbed_api_sd.h"
43 
47 #define LOG(kind, ...) \
48  GNUNET_log_from (kind, "testbed-api", __VA_ARGS__)
49 
53 #define LOG_DEBUG(...) \
54  LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
55 
59 #define TIME_REL_SECS(sec) \
60  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
61 
62 
66 #define TIMEOUT_REL TIME_REL_SECS(1)
67 
68 
73 {
74 
79 
83  void *cc_cls;
84 
85 };
86 
87 
92 {
96  uint32_t slave_id;
97 
98 };
99 
100 
105 {
110 
114  uint32_t host_id;
115 
116 };
117 
118 
123 {
128 
132  void *cb_cls;
133 };
134 
135 
140 {
145 
150 
155 };
156 
157 
162 
167 
168 
174 static void
176 {
177  struct ExpireOperationEntry *entry;
178 
179  entry = GNUNET_new (struct ExpireOperationEntry);
180  entry->op = op;
181  GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry);
182 }
183 
184 
196 static int
198 {
199  struct ExpireOperationEntry *entry;
200  struct ExpireOperationEntry *entry2;
201  int found;
202 
203  found = GNUNET_NO;
204  entry = exop_head;
205  while (NULL != entry)
206  {
207  if (op == entry->op)
208  {
209  found = GNUNET_YES;
210  break;
211  }
212  entry = entry->next;
213  }
214  if (GNUNET_NO == found)
215  return GNUNET_NO;
216  /* Truncate the tail */
217  while (NULL != entry)
218  {
219  entry2 = entry->next;
220  GNUNET_CONTAINER_DLL_remove (exop_head,
221  exop_tail,
222  entry);
223  GNUNET_free (entry);
224  entry = entry2;
225  }
226  return GNUNET_YES;
227 }
228 
229 
234 {
239 
243  uint64_t id;
244 };
245 
246 
256 static int
258  uint32_t key,
259  void *value)
260 {
261  struct SearchContext *sc = cls;
262  struct OperationContext *opc = value;
263 
264  GNUNET_assert (NULL != opc);
265  GNUNET_assert (NULL == sc->opc);
266  if (opc->id != sc->id)
267  return GNUNET_YES;
268  sc->opc = opc;
269  return GNUNET_NO;
270 }
271 
272 
281 static struct OperationContext *
282 find_opc (const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
283 {
284  struct SearchContext sc;
285 
286  sc.id = id;
287  sc.opc = NULL;
288  GNUNET_assert (NULL != c->opc_map);
289  if (GNUNET_SYSERR !=
291  &opc_search_iterator, &sc))
292  return NULL;
293  return sc.opc;
294 }
295 
296 
305 void
307  struct OperationContext *opc)
308 {
309  if (NULL == c->opc_map)
313  (uint32_t) opc->id, opc,
315 }
316 
317 
325 void
327  struct OperationContext *opc)
328 {
329  GNUNET_assert (NULL != c->opc_map);
332  (uint32_t) opc->id,
333  opc));
335  && (NULL != c->opcq_empty_cb) )
337 }
338 
339 
340 
348 static int
351 {
352  const char *emsg;
353  uint16_t msg_size;
354 
355  msg_size = ntohs (msg->header.size) - sizeof (*msg);
356  if (0 == msg_size)
357  return GNUNET_OK;
358  /* We have an error message */
359  emsg = (const char *) &msg[1];
360  if ('\0' != emsg[msg_size - 1])
361  {
362  GNUNET_break (0);
363  return GNUNET_SYSERR;
364  }
365  return GNUNET_OK;
366 }
367 
368 
376 static void
379 {
380  struct GNUNET_TESTBED_Controller *c = cls;
382  const char *emsg;
383  uint16_t msg_size;
384 
385  if (NULL == rh)
386  return;
387  if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
388  {
389  LOG_DEBUG ("Mismatch in host id's %u, %u of host confirm msg\n",
391  ntohl (msg->host_id));
392  return;
393  }
394  c->rh = NULL;
395  msg_size = ntohs (msg->header.size) - sizeof (*msg);
396  if (0 == msg_size)
397  {
398  LOG_DEBUG ("Host %u successfully registered\n",
399  ntohl (msg->host_id));
401  c);
402  rh->cc (rh->cc_cls,
403  NULL);
404  GNUNET_free (rh);
405  return;
406  }
407  /* We have an error message */
408  emsg = (const char *) &msg[1];
410  _("Adding host %u failed with error: %s\n"),
411  ntohl (msg->host_id),
412  emsg);
413  rh->cc (rh->cc_cls,
414  emsg);
415  GNUNET_free (rh);
416 }
417 
418 
426 static void
428  struct OperationContext *opc,
429  const struct GNUNET_MessageHeader *msg)
430 {
431  struct GNUNET_TESTBED_Controller *c = cls;
432  struct ForwardedOperationData *fo_data;
433 
434  fo_data = opc->data;
435  if (NULL != fo_data->cc)
436  fo_data->cc (fo_data->cc_cls, msg);
438  GNUNET_free (fo_data);
439  GNUNET_free (opc);
440 }
441 
442 
450 static void
451 handle_opsuccess (void *cls,
453 {
454  struct GNUNET_TESTBED_Controller *c = cls;
455  struct OperationContext *opc;
457  void *op_comp_cb_cls;
458  struct GNUNET_TESTBED_EventInformation event;
459  uint64_t op_id;
460 
461  op_id = GNUNET_ntohll (msg->operation_id);
462  LOG_DEBUG ("Operation %lu successful\n", op_id);
463  if (NULL == (opc = find_opc (c, op_id)))
464  {
465  LOG_DEBUG ("Operation not found\n");
466  return;
467  }
469  event.op = opc->op;
470  event.op_cls = opc->op_cls;
471  event.details.operation_finished.emsg = NULL;
472  event.details.operation_finished.generic = NULL;
473  op_comp_cb = NULL;
474  op_comp_cb_cls = NULL;
475  switch (opc->type)
476  {
477  case OP_FORWARDED:
478  {
480  (const struct GNUNET_MessageHeader *) msg);
481  return;
482  }
483  break;
484  case OP_PEER_DESTROY:
485  {
486  struct GNUNET_TESTBED_Peer *peer;
487 
488  peer = opc->data;
490  GNUNET_free (peer);
491  opc->data = NULL;
492  //PEERDESTROYDATA
493  }
494  break;
495  case OP_SHUTDOWN_PEERS:
496  {
497  struct ShutdownPeersData *data;
498 
499  data = opc->data;
500  op_comp_cb = data->cb;
501  op_comp_cb_cls = data->cb_cls;
502  GNUNET_free (data);
503  opc->data = NULL;
505  }
506  break;
507  case OP_MANAGE_SERVICE:
508  {
509  struct ManageServiceData *data;
510 
511  GNUNET_assert (NULL != (data = opc->data));
512  op_comp_cb = data->cb;
513  op_comp_cb_cls = data->cb_cls;
514  GNUNET_free (data);
515  opc->data = NULL;
516  }
517  break;
518  case OP_PEER_RECONFIGURE:
519  break;
520  default:
521  GNUNET_assert (0);
522  }
523  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
524  opc->state = OPC_STATE_FINISHED;
525  exop_insert (event.op);
526  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
527  {
528  if (NULL != c->cc)
529  c->cc (c->cc_cls, &event);
530  if (GNUNET_NO == exop_check (event.op))
531  return;
532  }
533  else
534  LOG_DEBUG ("Not calling callback\n");
535  if (NULL != op_comp_cb)
536  op_comp_cb (op_comp_cb_cls, event.op, NULL);
537  /* You could have marked the operation as done by now */
538  GNUNET_break (GNUNET_NO == exop_check (event.op));
539 }
540 
541 
549 static void
552 {
553  struct GNUNET_TESTBED_Controller *c = cls;
554  struct OperationContext *opc;
555  struct PeerCreateData *data;
556  struct GNUNET_TESTBED_Peer *peer;
559  void *cb_cls;
560  uint64_t op_id;
561 
563  ntohs (msg->header.size));
564  op_id = GNUNET_ntohll (msg->operation_id);
565  if (NULL == (opc = find_opc (c, op_id)))
566  {
567  LOG_DEBUG ("Operation context for PeerCreateSuccessEvent not found\n");
568  return;
569  }
570  if (OP_FORWARDED == opc->type)
571  {
573  (const struct GNUNET_MessageHeader *) msg);
574  return;
575  }
577  GNUNET_assert (NULL != opc->data);
578  data = opc->data;
579  GNUNET_assert (NULL != data->peer);
580  peer = data->peer;
581  GNUNET_assert (peer->unique_id == ntohl (msg->peer_id));
582  peer->state = TESTBED_PS_CREATED;
584  cb = data->cb;
585  cb_cls = data->cls;
586  op = opc->op;
587  GNUNET_free (opc->data);
588  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
589  opc->state = OPC_STATE_FINISHED;
590  exop_insert (op);
591  if (NULL != cb)
592  cb (cb_cls, peer, NULL);
593  /* You could have marked the operation as done by now */
595 }
596 
597 
605 static void
606 handle_peer_event (void *cls,
607  const struct GNUNET_TESTBED_PeerEventMessage *msg)
608 {
609  struct GNUNET_TESTBED_Controller *c = cls;
610  struct OperationContext *opc;
611  struct GNUNET_TESTBED_Peer *peer;
612  struct PeerEventData *data;
614  void *pcc_cls;
615  struct GNUNET_TESTBED_EventInformation event;
616  uint64_t op_id;
617  uint64_t mask;
618 
620  ntohs (msg->header.size));
621  op_id = GNUNET_ntohll (msg->operation_id);
622  if (NULL == (opc = find_opc (c, op_id)))
623  {
624  LOG_DEBUG ("Operation not found\n");
625  return;
626  }
627  if (OP_FORWARDED == opc->type)
628  {
630  (const struct GNUNET_MessageHeader *) msg);
631  return;
632  }
633  GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
634  data = opc->data;
635  GNUNET_assert (NULL != data);
636  peer = data->peer;
637  GNUNET_assert (NULL != peer);
638  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
639  event.op = opc->op;
640  event.op_cls = opc->op_cls;
641  switch (event.type)
642  {
644  peer->state = TESTBED_PS_STARTED;
645  event.details.peer_start.host = peer->host;
646  event.details.peer_start.peer = peer;
647  break;
649  peer->state = TESTBED_PS_STOPPED;
650  event.details.peer_stop.peer = peer;
651  break;
652  default:
653  GNUNET_assert (0); /* We should never reach this state */
654  }
655  pcc = data->pcc;
656  pcc_cls = data->pcc_cls;
657  GNUNET_free (data);
658  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
659  opc->state = OPC_STATE_FINISHED;
660  exop_insert (event.op);
661  mask = 1LL << GNUNET_TESTBED_ET_PEER_START;
662  mask |= 1LL << GNUNET_TESTBED_ET_PEER_STOP;
663  if (0 != (mask & c->event_mask))
664  {
665  if (NULL != c->cc)
666  c->cc (c->cc_cls, &event);
667  if (GNUNET_NO == exop_check (event.op))
668  return;
669  }
670  if (NULL != pcc)
671  pcc (pcc_cls, NULL);
672  /* You could have marked the operation as done by now */
673  GNUNET_break (GNUNET_NO == exop_check (event.op));
674 }
675 
676 
684 static void
687 {
688  struct GNUNET_TESTBED_Controller *c = cls;
689  struct OperationContext *opc;
690  struct OverlayConnectData *data;
692  void *cb_cls;
693  struct GNUNET_TESTBED_EventInformation event;
694  uint64_t op_id;
695  uint64_t mask;
696 
697  op_id = GNUNET_ntohll (msg->operation_id);
698  if (NULL == (opc = find_opc (c, op_id)))
699  {
700  LOG_DEBUG ("Operation not found\n");
701  return;
702  }
703  if (OP_FORWARDED == opc->type)
704  {
706  (const struct GNUNET_MessageHeader *) msg);
707  return;
708  }
710  GNUNET_assert (NULL != (data = opc->data));
711  GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id) &&
712  (ntohl (msg->peer2) == data->p2->unique_id));
713  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
714  event.op = opc->op;
715  event.op_cls = opc->op_cls;
716  switch (event.type)
717  {
719  event.details.peer_connect.peer1 = data->p1;
720  event.details.peer_connect.peer2 = data->p2;
721  break;
723  GNUNET_assert (0); /* FIXME: implement */
724  break;
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
758 check_peer_config (void *cls,
760 {
761  /* anything goes? */
762  return GNUNET_OK;
763 }
764 
765 
773 static void
776 {
777  struct GNUNET_TESTBED_Controller *c = cls;
778  struct OperationContext *opc;
779  struct GNUNET_TESTBED_Peer *peer;
780  struct PeerInfoData *data;
781  struct GNUNET_TESTBED_PeerInformation *pinfo;
783  void *cb_cls;
784  uint64_t op_id;
785 
786  op_id = GNUNET_ntohll (msg->operation_id);
787  if (NULL == (opc = find_opc (c, op_id)))
788  {
789  LOG_DEBUG ("Operation not found\n");
790  return;
791  }
792  if (OP_FORWARDED == opc->type)
793  {
795  opc,
796  &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;
820  pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
822  break;
824  GNUNET_assert (0); /* never reach here */
825  break;
826  }
827  opc->data = pinfo;
828  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
829  opc->state = OPC_STATE_FINISHED;
830  cb (cb_cls, opc->op, pinfo, NULL);
831  /* We dont check whether the operation is marked as done here as the
832  operation contains data (cfg/identify) which will be freed at a later point
833  */
834 }
835 
836 
845 static int
848 {
849  /* we accept anything as a valid error message */
850  return GNUNET_OK;
851 }
852 
853 
861 static void
864 {
865  struct GNUNET_TESTBED_Controller *c = cls;
866  struct OperationContext *opc;
867  const char *emsg;
868  uint64_t op_id;
869  uint64_t mask;
870  struct GNUNET_TESTBED_EventInformation event;
871 
872  op_id = GNUNET_ntohll (msg->operation_id);
873  if (NULL == (opc = find_opc (c, op_id)))
874  {
875  LOG_DEBUG ("Operation not found\n");
876  return;
877  }
878  if (OP_FORWARDED == opc->type)
879  {
881  (const struct GNUNET_MessageHeader *) msg);
882  return;
883  }
884  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
885  opc->state = OPC_STATE_FINISHED;
887  if (NULL == emsg)
888  emsg = "Unknown error";
889  if (OP_PEER_INFO == opc->type)
890  {
891  struct PeerInfoData *data;
892 
893  data = opc->data;
894  if (NULL != data->cb)
895  data->cb (data->cb_cls, opc->op, NULL, emsg);
896  GNUNET_free (data);
897  return; /* We do not call controller callback for peer info */
898  }
900  event.op = opc->op;
901  event.op_cls = opc->op_cls;
902  event.details.operation_finished.emsg = emsg;
903  event.details.operation_finished.generic = NULL;
904  mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
905  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
906  {
907  exop_insert (event.op);
908  c->cc (c->cc_cls, &event);
909  if (GNUNET_NO == exop_check (event.op))
910  return;
911  }
912  switch (opc->type)
913  {
914  case OP_PEER_CREATE:
915  {
916  struct PeerCreateData *data;
917 
918  data = opc->data;
919  GNUNET_free (data->peer);
920  if (NULL != data->cb)
921  data->cb (data->cls, NULL, emsg);
922  GNUNET_free (data);
923  }
924  break;
925  case OP_PEER_START:
926  case OP_PEER_STOP:
927  {
928  struct PeerEventData *data;
929 
930  data = opc->data;
931  if (NULL != data->pcc)
932  data->pcc (data->pcc_cls, emsg);
933  GNUNET_free (data);
934  }
935  break;
936  case OP_PEER_DESTROY:
937  break;
938  case OP_PEER_INFO:
939  GNUNET_assert (0);
940  case OP_OVERLAY_CONNECT:
941  {
942  struct OverlayConnectData *data;
943 
944  data = opc->data;
946  if (NULL != data->cb)
947  data->cb (data->cb_cls, opc->op, emsg);
948  }
949  break;
950  case OP_FORWARDED:
951  GNUNET_assert (0);
952  case OP_LINK_CONTROLLERS: /* No secondary callback */
953  break;
954  case OP_SHUTDOWN_PEERS:
955  {
956  struct ShutdownPeersData *data;
957 
958  data = opc->data;
959  GNUNET_free (data); /* FIXME: Decide whether we call data->op_cb */
960  opc->data = NULL;
961  }
962  break;
963  case OP_MANAGE_SERVICE:
964  {
965  struct ManageServiceData *data = opc->data;
967  void *cb_cls;
968 
969  GNUNET_assert (NULL != data);
970  cb = data->cb;
971  cb_cls = data->cb_cls;
972  GNUNET_free (data);
973  opc->data = NULL;
974  exop_insert (event.op);
975  if (NULL != cb)
976  cb (cb_cls, opc->op, emsg);
977  /* You could have marked the operation as done by now */
978  GNUNET_break (GNUNET_NO == exop_check (event.op));
979  }
980  break;
981  default:
982  GNUNET_break (0);
983  }
984 }
985 
986 
996 {
998  uint16_t msize;
999 
1000  msize = sizeof (struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
1001  msg = GNUNET_malloc (msize);
1002  msg->header.size = htons (msize);
1003  msg->header.type =
1005  msg->operation_id = GNUNET_htonll (op_id);
1006  msg->slave_id = htonl (slave_id);
1007  return msg;
1008 }
1009 
1010 
1011 
1019 static int
1021  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1022 {
1023  /* anything goes? */
1024  return GNUNET_OK;
1025 }
1026 
1027 
1035 static void
1037  const struct GNUNET_TESTBED_SlaveConfiguration *msg)
1038 {
1039  struct GNUNET_TESTBED_Controller *c = cls;
1040  struct OperationContext *opc;
1041  uint64_t op_id;
1042  uint64_t mask;
1043  struct GNUNET_TESTBED_EventInformation event;
1044 
1045  op_id = GNUNET_ntohll (msg->operation_id);
1046  if (NULL == (opc = find_opc (c, op_id)))
1047  {
1048  LOG_DEBUG ("Operation not found\n");
1049  return;
1050  }
1051  if (OP_GET_SLAVE_CONFIG != opc->type)
1052  {
1053  GNUNET_break (0);
1054  return;
1055  }
1056  opc->state = OPC_STATE_FINISHED;
1057  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1059  if ((0 != (mask & c->event_mask)) &&
1060  (NULL != c->cc))
1061  {
1064  event.op = opc->op;
1065  event.op_cls = opc->op_cls;
1066  event.details.operation_finished.generic = opc->data;
1067  event.details.operation_finished.emsg = NULL;
1068  c->cc (c->cc_cls, &event);
1069  }
1070 }
1071 
1072 
1081 static int
1084 {
1085  /* actual check to be implemented */
1086  return GNUNET_OK;
1087 }
1088 
1089 
1097 static void
1100 {
1101  struct GNUNET_TESTBED_Controller *c = cls;
1102  struct OperationContext *opc;
1103  struct ControllerLinkData *data;
1105  struct GNUNET_TESTBED_Host *host;
1106  char *emsg;
1107  uint64_t op_id;
1108  struct GNUNET_TESTBED_EventInformation event;
1109 
1110  op_id = GNUNET_ntohll (msg->operation_id);
1111  if (NULL == (opc = find_opc (c, op_id)))
1112  {
1113  LOG_DEBUG ("Operation not found\n");
1114  return;
1115  }
1116  if (OP_FORWARDED == opc->type)
1117  {
1119  (const struct GNUNET_MessageHeader *) msg);
1120  return;
1121  }
1122  if (OP_LINK_CONTROLLERS != opc->type)
1123  {
1124  GNUNET_break (0);
1125  return;
1126  }
1127  GNUNET_assert (NULL != (data = opc->data));
1129  GNUNET_assert (NULL != host);
1130  GNUNET_free (data);
1131  opc->data = NULL;
1132  opc->state = OPC_STATE_FINISHED;
1133  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1135  event.op = opc->op;
1136  event.op_cls = opc->op_cls;
1137  event.details.operation_finished.emsg = NULL;
1138  event.details.operation_finished.generic = NULL;
1139  emsg = NULL;
1140  cfg = NULL;
1141  if (GNUNET_NO == ntohs (msg->success))
1142  {
1143  emsg = GNUNET_malloc (ntohs (msg->header.size)
1144  - sizeof (struct
1146  GNUNET_memcpy (emsg,
1147  &msg[1],
1148  ntohs (msg->header.size)- sizeof (struct GNUNET_TESTBED_ControllerLinkResponse));
1149  event.details.operation_finished.emsg = emsg;
1150  }
1151  else
1152  {
1153  if (0 != ntohs (msg->config_size))
1154  {
1155  cfg = GNUNET_TESTBED_extract_config_ ((const struct GNUNET_MessageHeader *) msg);
1156  GNUNET_assert (NULL != cfg);
1158  }
1159  }
1160  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
1161  {
1162  if (NULL != c->cc)
1163  c->cc (c->cc_cls, &event);
1164  }
1165  else
1166  LOG_DEBUG ("Not calling callback\n");
1167  if (NULL != cfg)
1169  GNUNET_free_non_null (emsg);
1170 }
1171 
1172 
1182 static int
1184  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1185 {
1186  uint16_t msize;
1187  uint16_t name_len;
1188  int status;
1189  const char *name;
1190  size_t emsg_len;
1191 
1192  msize = ntohs (msg->header.size);
1193  name = msg->data;
1194  name_len = ntohs (msg->name_len);
1195 
1196  if (sizeof (struct GNUNET_TESTBED_BarrierStatusMsg) + name_len + 1 > msize)
1197  {
1198  GNUNET_break_op (0);
1199  return GNUNET_SYSERR;
1200  }
1201  if ('\0' != name[name_len])
1202  {
1203  GNUNET_break_op (0);
1204  return GNUNET_SYSERR;
1205  }
1206  status = ntohs (msg->status);
1207  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1208  {
1209  emsg_len = msize - (sizeof (struct GNUNET_TESTBED_BarrierStatusMsg) + name_len
1210  + 1); /* +1!? */
1211  if (0 == emsg_len)
1212  {
1213  GNUNET_break_op (0);
1214  return GNUNET_SYSERR;
1215  }
1216  }
1217  return GNUNET_OK;
1218 }
1219 
1220 
1228 static void
1230  const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
1231 {
1232  struct GNUNET_TESTBED_Controller *c = cls;
1233  struct GNUNET_TESTBED_Barrier *barrier;
1234  char *emsg;
1235  const char *name;
1236  struct GNUNET_HashCode key;
1237  size_t emsg_len;
1238  int status;
1239  uint16_t msize;
1240  uint16_t name_len;
1241 
1242  emsg = NULL;
1243  barrier = NULL;
1244  msize = ntohs (msg->header.size);
1245  if (msize <= sizeof (struct GNUNET_TESTBED_BarrierStatusMsg))
1246  {
1247  GNUNET_break_op (0);
1248  goto cleanup;
1249  }
1250  name = msg->data;
1251  name_len = ntohs (msg->name_len);
1252  if (name_len >= //name_len is strlen(barrier_name)
1253  (msize - ((sizeof msg->header) + sizeof (msg->status)) ) )
1254  {
1255  GNUNET_break_op (0);
1256  goto cleanup;
1257  }
1258  if ('\0' != name[name_len])
1259  {
1260  GNUNET_break_op (0);
1261  goto cleanup;
1262  }
1263  LOG_DEBUG ("Received BARRIER_STATUS msg\n");
1264  status = ntohs (msg->status);
1265  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1266  {
1267  status = -1;
1268  //unlike name_len, emsg_len includes the trailing zero
1269  emsg_len = msize - (sizeof (struct GNUNET_TESTBED_BarrierStatusMsg)
1270  + (name_len + 1));
1271  if (0 == emsg_len)
1272  {
1273  GNUNET_break_op (0);
1274  goto cleanup;
1275  }
1276  if ('\0' != (msg->data[(name_len + 1) + (emsg_len - 1)]))
1277  {
1278  GNUNET_break_op (0);
1279  goto cleanup;
1280  }
1281  emsg = GNUNET_malloc (emsg_len);
1282  GNUNET_memcpy (emsg,
1283  msg->data + name_len + 1,
1284  emsg_len);
1285  }
1286  if (NULL == c->barrier_map)
1287  {
1288  GNUNET_break_op (0);
1289  goto cleanup;
1290  }
1291  GNUNET_CRYPTO_hash (name, name_len, &key);
1292  barrier = GNUNET_CONTAINER_multihashmap_get (c->barrier_map, &key);
1293  if (NULL == barrier)
1294  {
1295  GNUNET_break_op (0);
1296  goto cleanup;
1297  }
1298  GNUNET_assert (NULL != barrier->cb);
1299  if ((GNUNET_YES == barrier->echo) &&
1302  GNUNET_copy_message (&msg->header));
1303  barrier->cb (barrier->cls,
1304  name,
1305  barrier,
1306  status,
1307  emsg);
1309  return; /* just initialised; skip cleanup */
1310 
1311  cleanup:
1312  GNUNET_free_non_null (emsg);
1319  if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
1321 }
1322 
1323 
1330 void
1332  struct GNUNET_MessageHeader *msg)
1333 {
1334  struct GNUNET_MQ_Envelope *env;
1335  struct GNUNET_MessageHeader *m2;
1336  uint16_t type;
1337  uint16_t size;
1338 
1339  type = ntohs (msg->type);
1340  size = ntohs (msg->size);
1343  env = GNUNET_MQ_msg_extra (m2,
1344  size - sizeof (*m2),
1345  type);
1346  GNUNET_memcpy (m2, msg, size);
1347  GNUNET_free (msg);
1348  GNUNET_MQ_send (controller->mq,
1349  env);
1350 }
1351 
1352 
1367 struct OperationContext *
1369  uint64_t operation_id,
1370  const struct GNUNET_MessageHeader *msg,
1372  void *cc_cls)
1373 {
1374  struct OperationContext *opc;
1375  struct ForwardedOperationData *data;
1376  struct GNUNET_MQ_Envelope *env;
1377  struct GNUNET_MessageHeader *m2;
1378  uint16_t type = ntohs (msg->type);
1379  uint16_t size = ntohs (msg->size);
1380 
1381  env = GNUNET_MQ_msg_extra (m2,
1382  size - sizeof (*m2),
1383  type);
1384  GNUNET_memcpy (m2,
1385  msg,
1386  size);
1387  GNUNET_MQ_send (controller->mq,
1388  env);
1389  data = GNUNET_new (struct ForwardedOperationData);
1390  data->cc = cc;
1391  data->cc_cls = cc_cls;
1392  opc = GNUNET_new (struct OperationContext);
1393  opc->c = controller;
1394  opc->type = OP_FORWARDED;
1395  opc->data = data;
1396  opc->id = operation_id;
1397  GNUNET_TESTBED_insert_opc_ (controller,
1398  opc);
1399  return opc;
1400 }
1401 
1402 
1409 void
1411 {
1413  opc);
1414  GNUNET_free (opc->data);
1415  GNUNET_free (opc);
1416 }
1417 
1418 
1425 static void
1427 {
1428  struct OperationContext *opc = cls;
1429  struct ControllerLinkData *data;
1431 
1432  GNUNET_assert (NULL != opc->data);
1433  data = opc->data;
1434  msg = data->msg;
1435  data->msg = NULL;
1436  opc->state = OPC_STATE_STARTED;
1437  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1438  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1439 }
1440 
1441 
1447 static void
1449 {
1450  struct OperationContext *opc = cls;
1451  struct ControllerLinkData *data;
1452 
1453  data = opc->data;
1454  switch (opc->state)
1455  {
1456  case OPC_STATE_INIT:
1457  GNUNET_free (data->msg);
1458  break;
1459  case OPC_STATE_STARTED:
1460  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1461  break;
1462  case OPC_STATE_FINISHED:
1463  break;
1464  }
1465  GNUNET_free_non_null (data);
1466  GNUNET_free (opc);
1467 }
1468 
1469 
1475 static void
1477 {
1478  struct OperationContext *opc = cls;
1479  struct GetSlaveConfigData *data = opc->data;
1481 
1482  GNUNET_assert (NULL != data);
1484  GNUNET_free (opc->data);
1485  data = NULL;
1486  opc->data = NULL;
1487  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1488  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1489  opc->state = OPC_STATE_STARTED;
1490 }
1491 
1492 
1498 static void
1500 {
1501  struct OperationContext *opc = cls;
1502 
1503  switch (opc->state)
1504  {
1505  case OPC_STATE_INIT:
1506  GNUNET_free (opc->data);
1507  break;
1508  case OPC_STATE_STARTED:
1509  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1510  break;
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,
1530  enum GNUNET_MQ_Error error)
1531 {
1532  /* struct GNUNET_TESTBED_Controller *c = cls; */
1533 
1535  "Encountered MQ error: %d\n",
1536  error);
1537  /* now what? */
1538  GNUNET_SCHEDULER_shutdown (); /* seems most reasonable */
1539 }
1540 
1541 
1559  uint64_t event_mask,
1561  void *cc_cls)
1562 {
1563  struct GNUNET_TESTBED_Controller *controller
1565  struct GNUNET_MQ_MessageHandler handlers[] = {
1566  GNUNET_MQ_hd_var_size (add_host_confirm,
1569  controller),
1570  GNUNET_MQ_hd_fixed_size (peer_conevent,
1573  controller),
1574  GNUNET_MQ_hd_fixed_size (opsuccess,
1577  controller),
1578  GNUNET_MQ_hd_var_size (op_fail_event,
1581  controller),
1582  GNUNET_MQ_hd_fixed_size (peer_create_success,
1585  controller),
1586  GNUNET_MQ_hd_fixed_size (peer_event,
1589  controller),
1590  GNUNET_MQ_hd_var_size (peer_config,
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),
1607  };
1609  struct GNUNET_MQ_Envelope *env;
1610  const struct GNUNET_CONFIGURATION_Handle *cfg;
1611  const char *controller_hostname;
1612  unsigned long long max_parallel_operations;
1613  unsigned long long max_parallel_service_connections;
1614  unsigned long long max_parallel_topology_config_operations;
1615  size_t slen;
1616 
1617  GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host)));
1618  if (GNUNET_OK !=
1619  GNUNET_CONFIGURATION_get_value_number (cfg, "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 !=
1628  GNUNET_CONFIGURATION_get_value_number (cfg, "testbed",
1629  "MAX_PARALLEL_SERVICE_CONNECTIONS",
1630  &max_parallel_service_connections))
1631  {
1632  GNUNET_break (0);
1633  GNUNET_free (controller);
1634  return NULL;
1635  }
1636  if (GNUNET_OK !=
1637  GNUNET_CONFIGURATION_get_value_number (cfg, "testbed",
1638  "MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS",
1639  &max_parallel_topology_config_operations))
1640  {
1641  GNUNET_break (0);
1642  GNUNET_free (controller);
1643  return NULL;
1644  }
1645  controller->cc = cc;
1646  controller->cc_cls = cc_cls;
1647  controller->event_mask = event_mask;
1648  controller->cfg = GNUNET_CONFIGURATION_dup (cfg);
1649  controller->mq = GNUNET_CLIENT_connect (controller->cfg,
1650  "testbed",
1651  handlers,
1653  controller);
1654  if (NULL == controller->mq)
1655  {
1656  GNUNET_break (0);
1658  return NULL;
1659  }
1660  GNUNET_TESTBED_mark_host_registered_at_ (host, controller);
1661  controller->host = host;
1662  controller->opq_parallel_operations =
1664  (unsigned int) max_parallel_operations);
1665  controller->opq_parallel_service_connections =
1667  (unsigned int)
1668  max_parallel_service_connections);
1671  (unsigned int)
1672  max_parallel_topology_config_operations);
1673  controller_hostname = GNUNET_TESTBED_host_get_hostname (host);
1674  if (NULL == controller_hostname)
1675  controller_hostname = "127.0.0.1";
1676  slen = strlen (controller_hostname) + 1;
1677  env = GNUNET_MQ_msg_extra (msg,
1678  slen,
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],
1683  controller_hostname,
1684  slen);
1685  GNUNET_MQ_send (controller->mq,
1686  env);
1687  return controller;
1688 }
1689 
1690 
1700 static int
1701 opc_free_iterator (void *cls, uint32_t key, void *value)
1702 {
1703  struct GNUNET_CONTAINER_MultiHashMap32 *map = cls;
1704  struct OperationContext *opc = value;
1705 
1706  GNUNET_assert (NULL != opc);
1707  GNUNET_break (0);
1709  GNUNET_CONTAINER_multihashmap32_remove (map, key, value));
1710  GNUNET_free (opc);
1711  return GNUNET_YES;
1712 }
1713 
1714 
1722 void
1724 {
1725  if (NULL != c->mq)
1726  {
1727  GNUNET_MQ_destroy (c->mq);
1728  c->mq = NULL;
1729  }
1730  if (NULL != c->host)
1738  if (NULL != c->opc_map)
1739  {
1743  c->opc_map));
1746  }
1747  GNUNET_free (c);
1748 }
1749 
1750 
1760 size_t
1762  size_t size,
1763  char **xconfig)
1764 {
1765  size_t xsize;
1766 
1767  xsize = compressBound ((uLong) size);
1768  *xconfig = GNUNET_malloc (xsize);
1769  GNUNET_assert (Z_OK ==
1770  compress2 ((Bytef *) * xconfig, (uLongf *) & xsize,
1771  (const Bytef *) config, (uLongf) size,
1772  Z_BEST_SPEED));
1773  return xsize;
1774 }
1775 
1776 
1786 char *
1788  size_t *size, size_t *xsize)
1789 {
1790  char *config;
1791  char *xconfig;
1792  size_t size_;
1793  size_t xsize_;
1794 
1795  config = GNUNET_CONFIGURATION_serialize (cfg, &size_);
1796  xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig);
1797  GNUNET_free (config);
1798  *size = size_;
1799  *xsize = xsize_;
1800  return xconfig;
1801 }
1802 
1803 
1832 struct GNUNET_TESTBED_Operation *
1834  struct GNUNET_TESTBED_Controller *master,
1835  struct GNUNET_TESTBED_Host *delegated_host,
1836  struct GNUNET_TESTBED_Host *slave_host,
1837  int is_subordinate)
1838 {
1839  struct OperationContext *opc;
1841  struct ControllerLinkData *data;
1842  uint32_t slave_host_id;
1843  uint32_t delegated_host_id;
1844  uint16_t msg_size;
1845 
1847  GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
1848  slave_host_id =
1849  GNUNET_TESTBED_host_get_id_ ((NULL !=
1850  slave_host) ? slave_host : master->host);
1851  delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
1852  if ((NULL != slave_host) && (0 != slave_host_id))
1854  GNUNET_TESTBED_is_host_registered_ (slave_host, master));
1855  msg_size = sizeof (struct GNUNET_TESTBED_ControllerLinkRequest);
1856  msg = GNUNET_malloc (msg_size);
1858  msg->header.size = htons (msg_size);
1859  msg->delegated_host_id = htonl (delegated_host_id);
1860  msg->slave_host_id = htonl (slave_host_id);
1861  msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
1862  data = GNUNET_new (struct ControllerLinkData);
1863  data->msg = msg;
1864  data->host_id = delegated_host_id;
1865  opc = GNUNET_new (struct OperationContext);
1866  opc->c = master;
1867  opc->data = data;
1868  opc->type = OP_LINK_CONTROLLERS;
1869  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
1870  opc->state = OPC_STATE_INIT;
1871  opc->op_cls = op_cls;
1872  msg->operation_id = GNUNET_htonll (opc->id);
1873  opc->op =
1877  opc->op);
1879  return opc->op;
1880 }
1881 
1882 
1895 struct GNUNET_TESTBED_Operation *
1897  struct GNUNET_TESTBED_Controller *master,
1898  uint32_t slave_host_id)
1899 {
1900  struct OperationContext *opc;
1901  struct GetSlaveConfigData *data;
1902 
1903  data = GNUNET_new (struct GetSlaveConfigData);
1904  data->slave_id = slave_host_id;
1905  opc = GNUNET_new (struct OperationContext);
1906  opc->state = OPC_STATE_INIT;
1907  opc->c = master;
1908  opc->id = GNUNET_TESTBED_get_next_op_id (master);
1909  opc->type = OP_GET_SLAVE_CONFIG;
1910  opc->data = data;
1911  opc->op_cls = op_cls;
1912  opc->op =
1916  opc->op);
1918  return opc->op;
1919 }
1920 
1921 
1937 struct GNUNET_TESTBED_Operation *
1939  struct GNUNET_TESTBED_Controller *master,
1940  struct GNUNET_TESTBED_Host *slave_host)
1941 {
1942  if (GNUNET_NO == GNUNET_TESTBED_is_host_registered_ (slave_host, master))
1943  return NULL;
1944  return GNUNET_TESTBED_get_slave_config_ (op_cls, master,
1946  (slave_host));
1947 }
1948 
1949 
1959 void
1961  *controller,
1962  const char *filename)
1963 {
1964  GNUNET_break (0);
1965 }
1966 
1967 
1983  const char *hostname,
1984  const struct GNUNET_CONFIGURATION_Handle
1985  *cfg)
1986 {
1988  char *config;
1989  char *xconfig;
1990  size_t config_size;
1991  size_t xconfig_size;
1992  uint16_t trusted_ip_len;
1993  uint16_t hostname_len;
1994  uint16_t msg_size;
1995 
1996  config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
1997  GNUNET_assert (NULL != config);
1998  xconfig_size =
1999  GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
2000  GNUNET_free (config);
2001  trusted_ip_len = strlen (trusted_ip);
2002  hostname_len = (NULL == hostname) ? 0 : strlen (hostname);
2003  msg_size =
2004  xconfig_size + trusted_ip_len + 1 +
2005  sizeof (struct GNUNET_TESTBED_HelperInit);
2006  msg_size += hostname_len;
2007  msg = GNUNET_realloc (xconfig, msg_size);
2008  (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len, msg,
2009  xconfig_size);
2010  msg->header.size = htons (msg_size);
2011  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
2012  msg->trusted_ip_size = htons (trusted_ip_len);
2013  msg->hostname_size = htons (hostname_len);
2014  msg->config_size = htons (config_size);
2015  (void) strcpy ((char *) &msg[1], trusted_ip);
2016  if (0 != hostname_len)
2017  GNUNET_memcpy (&msg[1] + trusted_ip_len + 1,
2018  hostname,
2019  hostname_len);
2020  return msg;
2021 }
2022 
2023 
2045 void
2047 {
2048  (void) exop_check (operation);
2050 }
2051 
2052 
2069 {
2071  Bytef *data;
2072  const Bytef *xdata;
2073  uLong data_len;
2074  uLong xdata_len;
2075  int ret;
2076 
2077  switch (ntohs (msg->type))
2078  {
2080  {
2082 
2083  imsg =
2085  data_len = (uLong) ntohs (imsg->config_size);
2086  xdata_len =
2087  ntohs (imsg->header.size) -
2089  xdata = (const Bytef *) &imsg[1];
2090  }
2091  break;
2093  {
2094  const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
2095 
2096  imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *) msg;
2097  data_len = (uLong) ntohs (imsg->config_size);
2098  xdata_len =
2099  ntohs (imsg->header.size) -
2100  sizeof (struct GNUNET_TESTBED_SlaveConfiguration);
2101  xdata = (const Bytef *) &imsg[1];
2102  }
2103  break;
2105  {
2106  const struct GNUNET_TESTBED_AddHostMessage *imsg;
2107  uint16_t osize;
2108 
2109  imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
2110  data_len = (uLong) ntohs (imsg->config_size);
2111  osize = sizeof (struct GNUNET_TESTBED_AddHostMessage) +
2112  ntohs (imsg->username_length) + ntohs (imsg->hostname_length);
2113  xdata_len = ntohs (imsg->header.size) - osize;
2114  xdata = (const Bytef *) ((const void *) imsg + osize);
2115  }
2116  break;
2118  {
2119  const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
2120 
2121  imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg;
2122  data_len = ntohs (imsg->config_size);
2123  xdata_len = ntohs (imsg->header.size) -
2124  sizeof (const struct GNUNET_TESTBED_ControllerLinkResponse);
2125  xdata = (const Bytef *) &imsg[1];
2126  }
2127  break;
2129  {
2130  const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
2131 
2132  imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *) msg;
2133  data_len = ntohs (imsg->config_size);
2134  xdata_len = ntohs (imsg->header.size) -
2135  sizeof (struct GNUNET_TESTBED_PeerCreateMessage);
2136  xdata = (const Bytef *) &imsg[1];
2137  }
2138  break;
2140  {
2141  const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
2142 
2143  imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *) msg;
2144  data_len = ntohs (imsg->config_size);
2145  xdata_len = ntohs (imsg->header.size) -
2146  sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage);
2147  xdata = (const Bytef *) &imsg[1];
2148  }
2149  break;
2150  default:
2151  GNUNET_assert (0);
2152  }
2153  data = GNUNET_malloc (data_len);
2154  if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
2155  {
2156  GNUNET_free (data);
2157  GNUNET_break_op (0); /* Un-compression failure */
2158  return NULL;
2159  }
2160  cfg = GNUNET_CONFIGURATION_create ();
2161  if (GNUNET_OK !=
2163  (const char *) data,
2164  (size_t) data_len,
2165  NULL))
2166  {
2167  GNUNET_free (data);
2168  GNUNET_break_op (0); /* De-serialization failure */
2169  return NULL;
2170  }
2171  GNUNET_free (data);
2172  return cfg;
2173 }
2174 
2175 
2183 const char *
2186  *msg)
2187 {
2188  uint16_t msize;
2189  const char *emsg;
2190 
2191  msize = ntohs (msg->header.size);
2192  if (sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
2193  return NULL;
2194  msize -= sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage);
2195  emsg = (const char *) &msg[1];
2196  if ('\0' != emsg[msize - 1])
2197  {
2198  GNUNET_break (0);
2199  return NULL;
2200  }
2201  return emsg;
2202 }
2203 
2204 
2212 uint64_t
2214 {
2215  uint64_t op_id;
2216 
2217  op_id = (uint64_t) GNUNET_TESTBED_host_get_id_ (controller->host);
2218  op_id = op_id << 32;
2219  op_id |= (uint64_t) controller->operation_counter++;
2220  return op_id;
2221 }
2222 
2223 
2229 static void
2231 {
2232  struct OperationContext *opc = cls;
2233  struct GNUNET_MQ_Envelope *env;
2235 
2236  opc->state = OPC_STATE_STARTED;
2237  env = GNUNET_MQ_msg (msg,
2239  msg->operation_id = GNUNET_htonll (opc->id);
2241  opc);
2242  GNUNET_MQ_send (opc->c->mq,
2243  env);
2244 }
2245 
2246 
2252 static void
2254 {
2255  struct OperationContext *opc = cls;
2256 
2257  switch (opc->state)
2258  {
2259  case OPC_STATE_STARTED:
2260  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
2261  /* no break; continue */
2262  case OPC_STATE_INIT:
2263  GNUNET_free (opc->data);
2264  break;
2265  case OPC_STATE_FINISHED:
2266  break;
2267  }
2268  GNUNET_free (opc);
2269 }
2270 
2271 
2287 struct GNUNET_TESTBED_Operation *
2289  void *op_cls,
2291  void *cb_cls)
2292 {
2293  struct OperationContext *opc;
2294  struct ShutdownPeersData *data;
2295 
2297  return NULL;
2298  data = GNUNET_new (struct ShutdownPeersData);
2299  data->cb = cb;
2300  data->cb_cls = cb_cls;
2301  opc = GNUNET_new (struct OperationContext);
2302  opc->c = c;
2303  opc->op_cls = op_cls;
2304  opc->data = data;
2305  opc->id = GNUNET_TESTBED_get_next_op_id (c);
2306  opc->type = OP_SHUTDOWN_PEERS;
2307  opc->state = OPC_STATE_INIT;
2311  opc->op);
2313  return opc->op;
2314 }
2315 
2316 
2325 uint32_t
2327 {
2328  return peer->unique_id;
2329 }
2330 
2331 
2338 void
2340 {
2341  struct GNUNET_TESTBED_Controller *c = barrier->c;
2342 
2343  GNUNET_assert (NULL != c->barrier_map); /* No barriers present */
2346  &barrier->key,
2347  barrier));
2348  GNUNET_free (barrier->name);
2349  GNUNET_free (barrier);
2351  {
2353  c->barrier_map = NULL;
2354  }
2355 }
2356 
2357 
2374 struct GNUNET_TESTBED_Barrier *
2376  const char *name,
2377  unsigned int quorum,
2379  int echo)
2380 {
2382  struct GNUNET_MQ_Envelope *env;
2383  struct GNUNET_TESTBED_Barrier *barrier;
2384  struct GNUNET_HashCode key;
2385  size_t name_len;
2386 
2387  GNUNET_assert (quorum <= 100);
2388  GNUNET_assert (NULL != cb);
2389  name_len = strlen (name);
2390  GNUNET_assert (0 < name_len);
2391  GNUNET_CRYPTO_hash (name, name_len, &key);
2392  if (NULL == controller->barrier_map)
2394  if (GNUNET_YES ==
2396  &key))
2397  {
2398  GNUNET_break (0);
2399  return NULL;
2400  }
2401  LOG_DEBUG ("Initialising barrier `%s'\n", name);
2402  barrier = GNUNET_new (struct GNUNET_TESTBED_Barrier);
2403  barrier->c = controller;
2404  barrier->name = GNUNET_strdup (name);
2405  barrier->cb = cb;
2406  barrier->cls = cls;
2407  barrier->echo = echo;
2408  GNUNET_memcpy (&barrier->key, &key, sizeof (struct GNUNET_HashCode));
2411  &barrier->key,
2412  barrier,
2414 
2415  env = GNUNET_MQ_msg_extra (msg,
2416  name_len,
2418  msg->quorum = (uint8_t) quorum;
2419  GNUNET_memcpy (msg->name,
2420  barrier->name,
2421  name_len);
2422  GNUNET_MQ_send (barrier->c->mq,
2423  env);
2424  return barrier;
2425 }
2426 
2427 
2442 struct GNUNET_TESTBED_Barrier *
2444  const char *name,
2445  unsigned int quorum,
2447 {
2448  return GNUNET_TESTBED_barrier_init_ (controller,
2449  name, quorum, cb, cls, 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 = GNUNET_MQ_msg_extra (msg,
2467  slen,
2469  GNUNET_memcpy (msg->name,
2470  barrier->name,
2471  slen);
2472  GNUNET_MQ_send (barrier->c->mq,
2473  env);
2475 }
2476 
2477 
2478 /* 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:1982
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:493
Event notification from a controller to a client.
Definition: testbed.h:563
#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:451
Confirmation from the service that adding a host worked (or failed).
Definition: testbed.h:117
uint32_t peer_id
The id of the peer relevant to this information.
Definition: testbed.h:650
Message to request configuration of a slave controller.
Definition: testbed.h:675
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:501
static void handle_slave_config(void *cls, const struct GNUNET_TESTBED_SlaveConfiguration *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION message from controller (testbed service)...
Definition: testbed_api.c:1036
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
Message to link delegated controller to slave controller.
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
Definition: testbed_api.c:166
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:1723
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:198
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:161
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
struct GNUNET_TESTBED_Barrier * GNUNET_TESTBED_barrier_init(struct GNUNET_TESTBED_Controller *controller, const char *name, unsigned int quorum, GNUNET_TESTBED_barrier_status_cb cb, void *cls)
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach...
Definition: testbed_api.c:2443
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER.
Definition: testbed.h:257
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:1960
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:1229
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:194
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:142
Message sent from client to testing service to reconfigure a (stopped) a peer.
Definition: testbed.h:251
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:197
Message to cancel a barrier.
Definition: testbed.h:845
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT.
Definition: testbed.h:542
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:901
#define GNUNET_MESSAGE_TYPE_TESTBED_MAX
Not really a message, but for careful checks on the testbed messages; Should always be the maximum an...
union GNUNET_TESTBED_PeerInformation::@64 result
The result of the get information operation; Choose according to the pit.
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
Message to request configuration of a slave controller.
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:147
void * cb_cls
The closure for peer info callback.
void * op_cls
The operation closure.
Definition: testbed_api.h:152
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:877
The operation has been started.
Definition: testbed_api.h:124
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:182
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:214
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:728
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:235
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER.
Definition: testbed.h:219
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:225
#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:377
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:1833
Notify the service about a host that we intend to use.
Definition: testbed.h:65
uint64_t operation_id
Operation ID.
Definition: testbed.h:713
uint16_t config_size
The length of the uncompressed configuration.
Definition: testbed.h:99
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:569
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:639
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:718
Context data for get slave config operations.
Definition: testbed_api.c:91
Event notification from a controller to a client.
Definition: testbed.h:466
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_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:550
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:645
#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:81
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:78
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:309
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:2213
#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:995
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:574
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS.
Definition: testbed.h:867
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:304
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:606
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:655
static void oprelease_link_controllers(void *cls)
Callback which will be called when link-controllers type operation is released.
Definition: testbed_api.c:1448
Event notification from a controller to a client.
Definition: testbed.h:536
Initial message from a client to a testing control service.
Definition: testbed.h:36
uint64_t operation_id
Operation ID.
Definition: testbed.h:738
Initialization message for gnunet-helper-testbed to start testbed service.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
static int ret
Final status code.
Definition: gnunet-arm.c:89
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Definition: testbed_api.c: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:2068
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:154
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:271
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:176
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:208
void GNUNET_TESTBED_cleanup_peers_(void)
Frees all peers.
uint16_t status
status.
Definition: testbed.h:872
#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:606
uint16_t config_size
The length of the serialized configuration when uncompressed.
Definition: testbed.h:272
uint32_t delegated_host_id
For which host should requests be delegated? NBO.
Definition: testbed.h:152
uint16_t config_size
The size of configuration when uncompressed.
Definition: testbed.h:665
int32_t event_type
enum GNUNET_TESTBED_EventType (in NBO); either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER...
Definition: testbed.h:478
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:862
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:175
struct GNUNET_PeerIdentity * id
The identity of the peer.
static int check_slave_config(void *cls, const struct GNUNET_TESTBED_SlaveConfiguration *msg)
Validate #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_INFORMATION message from controller (testbed service) ...
Definition: testbed_api.c:1020
static void oprelease_get_slave_config(void *cls)
Function to be called when get slave config operation is cancelled or finished.
Definition: testbed_api.c:1499
#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:53
#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:266
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:1787
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:114
Link controllers operation.
Definition: testbed_api.h:89
#define GNUNET_memcpy(dst, src, n)
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:162
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:139
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:553
#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:2339
#define GNUNET_realloc(ptr, size)
Wrapper around realloc.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:44
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
Message for peer events.
void * pcc_cls
Closure for the above callback.
static int opc_free_iterator(void *cls, uint32_t key, void *value)
Iterator to free opc map entries.
Definition: testbed_api.c:1701
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:1410
#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:523
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:250
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:1426
struct OperationContext * opc
The result of the search.
Definition: testbed_api.c:238
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:1183
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:172
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:2230
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:1938
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:230
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:855
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:528
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:128
Peer start operation.
Definition: testbed_api.h:54
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Definition: testbed_api.c:78
char * name
The name of the barrier.
Definition: testbed_api.h:294
#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:660
void * cc_cls
The closure for the above callback.
Definition: testbed_api.c:83
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:2046
enum OperationType type
The type of operation.
Definition: testbed_api.h:167
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:279
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:2375
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:213
uint32_t slave_id
The id of the slave controller.
Definition: testbed_api.c:96
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:127
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
uint64_t operation_id
Operation ID.
Definition: testbed.h:690
#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:255
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:79
uint32_t peer1
First peer.
Definition: testbed.h:518
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:193
char data[0]
the barrier name (0-terminated) concatenated with an error message (0-terminated) if the status were ...
Definition: testbed.h:883
Context data for forwarded Operation.
Definition: testbed_api.c:72
GUID host
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:1331
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:698
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:685
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:71
const char * name
static void handle_link_controllers_result(void *cls, const struct GNUNET_TESTBED_ControllerLinkResponse *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller (testbed serv...
Definition: testbed_api.c:1098
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
Forwarded operation.
Definition: testbed_api.h: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:579
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:1368
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:1558
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:118
static int opc_search_iterator(void *cls, uint32_t key, void *value)
Search iterator for searching an operation context.
Definition: testbed_api.c:257
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:188
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:513
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:130
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:50
#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:122
internal API to access the &#39;peers&#39; subsystem
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_HashMapIterator32 it, void *it_cls)
Iterate over all entries in the map.
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:1761
struct GNUNET_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:289
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:240
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:132
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:245
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:284
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:233
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:2288
uint32_t slave_host_id
Which host is responsible for managing the delegation? NBO.
Definition: testbed.h:162
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:282
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS.
Definition: testbed.h:123
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:349
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:219
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:168
#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:472
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION.
Definition: testbed.h:680
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:2326
#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:833
uint64_t id
The id of the operation context we are searching for.
Definition: testbed_api.c:243
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:209
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:261
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:199
uint64_t event_mask
Event mask that specifies which events this client is interested in.
Definition: testbed.h:56
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:104
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:1896
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:144
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:306
static void opstart_get_slave_config(void *cls)
Function to be called when get slave config operation is ready.
Definition: testbed_api.c:1476
Event notification from a controller to a client for a generic operational success where the operatio...
Definition: testbed.h:589
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:157
#define GNUNET_YES
Definition: gnunet_common.h:80
Message for signalling status changes of a barrier.
Definition: testbed.h:862
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:838
int GNUNET_CONTAINER_multihashmap32_get_multiple(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_HashMapIterator32 it, void *it_cls)
Iterate over all entries in the map that match a particular key.
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:2253
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:427
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:685
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
Message to cancel a barrier.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
Message to initialise a barrier.
Definition: testbed.h:823
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:149
uint16_t config_size
The size of the uncompressed configuration.
void * data
Data relevant to the operation.
Definition: testbed_api.h:157
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:2184
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:846
#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:147
uint16_t config_size
Size of the uncompressed configuration.
Definition: testbed.h:239
#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:137
#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:299
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:204
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:326
Client notifies controller that it should delegate requests for a particular client to a particular s...
Definition: testbed.h:141
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:703
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:109
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:1082