Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
yet another cleaning pass
[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 BROADCASTER_H
8 #define BROADCASTER_H
9
10 #include "xbt/dynar.h"
11 #include "messages.h"
12 #include "iterator.h"
13 #include "common.h"
14
15 /* Connection parameters */
16 #define MAX_PENDING_SENDS 10
17
18 /* Default values for the ``file'' details */
19 #define PIECE_SIZE 65536
20 #define PIECE_COUNT 16384
21
22 /* Broadcaster struct */
23 typedef struct s_broadcaster {
24   const char *first;
25   int piece_count;
26   int current_piece;
27   xbt_dynar_t host_list;
28   xbt_dynar_iterator_t it;
29   int max_pending_sends;
30   xbt_dynar_t pending_sends;
31 } s_broadcaster_t, *broadcaster_t;
32
33 xbt_dynar_t build_hostlist_from_hostcount(int hostcount); 
34
35 /* Broadcaster: helper functions */
36 broadcaster_t broadcaster_init(xbt_dynar_t host_list, unsigned int piece_count);
37 int broadcaster_build_chain(broadcaster_t bc);
38 int broadcaster_send_file(broadcaster_t bc);
39
40 /* Tasks */
41 int broadcaster(int argc, char *argv[]);
42
43 #endif /* BROADCASTER_H */