1 /* Copyright (c) 2012-2019. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "bittorrent.h"
7 #include "bittorrent-peer.h"
9 #include <simgrid/msg.h>
11 #include <stdio.h> /* snprintf */
13 /** Bittorrent example launcher */
14 int main(int argc, char* argv[])
19 MSG_init(&argc, argv);
21 /* Check the arguments */
22 xbt_assert(argc > 2, "Usage: %s platform_file deployment_file", argv[0]);
24 MSG_create_environment(argv[1]);
26 xbt_dynar_t host_list = MSG_hosts_as_dynar();
27 xbt_dynar_foreach (host_list, i, host) {
29 snprintf(descr, sizeof descr, "RngSream<%s>", MSG_host_get_name(host));
32 MSG_function_register("tracker", tracker);
33 MSG_function_register("peer", peer);
35 MSG_launch_application(argv[2]);
39 xbt_dynar_free(&host_list);