Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
baef90ac5340f6cee15d70a12081ae1032248295
[simgrid.git] / examples / c / app-chainsend / chainsend.h
1 /* Copyright (c) 2012-2020. 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 CHAINSEND_H
8 #define CHAINSEND_H
9
10 #include "simgrid/actor.h"
11 #include "simgrid/comm.h"
12 #include "simgrid/engine.h"
13 #include "simgrid/host.h"
14 #include "simgrid/instr.h"
15 #include "simgrid/mailbox.h"
16
17 #include "xbt/log.h"
18 #include "xbt/str.h"
19
20 #include <stdlib.h>
21
22 /* Connection parameters */
23 #define MAX_PENDING_COMMS 256
24 #define PIECE_SIZE 65536
25 #define MESSAGE_BUILD_CHAIN_SIZE 40
26 #define MESSAGE_SEND_DATA_HEADER_SIZE 1
27
28 /* Broadcaster struct */
29 typedef struct s_broadcaster {
30   unsigned int host_count;
31   int piece_count;
32   sg_mailbox_t first;
33   sg_mailbox_t* mailboxes;
34   sg_comm_t* pending_sends;
35 } s_broadcaster_t;
36
37 typedef s_broadcaster_t* broadcaster_t;
38 void broadcaster(int argc, char* argv[]);
39
40 /* Message struct */
41 typedef struct s_chain_message {
42   sg_mailbox_t prev_;
43   sg_mailbox_t next_;
44   unsigned int num_pieces;
45 } s_chain_message_t;
46
47 typedef s_chain_message_t* chain_message_t;
48
49 /* Peer struct */
50 typedef struct s_peer {
51   sg_mailbox_t prev;
52   sg_mailbox_t next;
53   sg_mailbox_t me;
54   unsigned long long received_bytes;
55   unsigned int received_pieces;
56   unsigned int total_pieces;
57   sg_comm_t* pending_recvs;
58   sg_comm_t* pending_sends;
59 } s_peer_t;
60
61 typedef s_peer_t* peer_t;
62 void peer(int argc, char* argv[]);
63
64 #endif /* CHAINSEND_H */