1 /* Copyright (c) 2012. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "bittorrent.h"
10 #include <xbt/RngStream.h>
13 * Bittorrent example launcher
15 int main(int argc, char *argv[])
17 xbt_dynar_t host_list;
21 MSG_init(&argc, argv);
23 /* Check the arguments */
25 printf("Usage: %s platform_file deployment_file \n", argv[0]);
29 const char *platform_file = argv[1];
30 const char *deployment_file = argv[2];
32 MSG_create_environment(platform_file);
34 host_list = MSG_hosts_as_dynar();
35 xbt_dynar_foreach(host_list, i, host) {
38 snprintf(descr, sizeof descr, "RngSream<%s>", MSG_host_get_name(host));
39 stream = RngStream_CreateStream(descr);
40 MSG_host_set_data(host, stream);
43 MSG_function_register("tracker", tracker);
44 MSG_function_register("peer", peer);
46 MSG_launch_application(deployment_file);
50 xbt_dynar_foreach(host_list, i, host) {
51 RngStream stream = MSG_host_get_data(host);
52 RngStream_DeleteStream(&stream);
54 xbt_dynar_free(&host_list);