Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change the comment of Task.setBound to fit the native semantic
[simgrid.git] / examples / msg / chainsend / broadcaster.h
1 /* Copyright (c) 2012-2015. 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
7 #ifndef KADEPLOY_BROADCASTER_H
8 #define KADEPLOY_BROADCASTER_H
9
10 #include "simgrid/msg.h"
11 #include "xbt/sysdep.h"
12
13 /* Create a log channel to have nice outputs. */
14 #include "xbt/log.h"
15 #include "xbt/asserts.h"
16
17 #include "messages.h"
18 #include "iterator.h"
19 #include "common.h"
20
21 /* Connection parameters */
22 #define MAX_PENDING_SENDS 10
23
24 /* Default values for the ``file'' details */
25 #define PIECE_SIZE 65536
26 #define PIECE_COUNT 16384
27
28 /* Broadcaster struct */
29 typedef struct s_broadcaster {
30   const char *first;
31   int piece_count;
32   int current_piece;
33   xbt_dynar_t host_list;
34   xbt_dynar_iterator_t it;
35   int max_pending_sends;
36   xbt_dynar_t pending_sends;
37 } s_broadcaster_t, *broadcaster_t;
38
39 xbt_dynar_t build_hostlist_from_hostcount(int hostcount); 
40
41 /* Broadcaster: helper functions */
42 broadcaster_t broadcaster_init(xbt_dynar_t host_list, unsigned int piece_count);
43 int broadcaster_build_chain(broadcaster_t bc);
44 int broadcaster_send_file(broadcaster_t bc);
45
46 /* Tasks */
47 int broadcaster(int argc, char *argv[]);
48
49 #endif /* KADEPLOY_BROADCASTER_H */