Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add bittorrent example
[simgrid.git] / examples / msg / bittorrent / bittorrent.c
1 /* Copyright (c) 2012. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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"
7 #include "peer.h"
8 #include "tracker.h"
9 #include <msg/msg.h>
10 /**
11  * Bittorrent example launcher
12  */
13 int main(int argc, char *argv[]) {
14   MSG_init(&argc, argv);
15
16   /* Check the arguments */
17   if (argc < 3) {
18     printf("Usage: %s platform_file deployment_file \n",argv[0]);
19     return -1;
20   }
21
22   const char *platform_file = argv[1];
23   const char *deployment_file = argv[2];
24
25   MSG_create_environment(platform_file);
26
27   MSG_function_register("tracker",tracker);
28   MSG_function_register("peer",peer);
29
30   MSG_launch_application(deployment_file);
31
32   msg_error_t res = MSG_main();
33
34   MSG_clean();
35
36   return 0;
37 }