Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / examples / c / app-chainsend / chainsend.h
1 /* Copyright (c) 2012-2022. 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   unsigned 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 typedef const s_broadcaster_t* const_broadcaster_t;
39 void broadcaster(int argc, char* argv[]);
40
41 /* Message struct */
42 typedef struct s_chain_message {
43   sg_mailbox_t prev_;
44   sg_mailbox_t next_;
45   unsigned int num_pieces;
46 } s_chain_message_t;
47
48 typedef s_chain_message_t* chain_message_t;
49
50 /* Peer struct */
51 typedef struct s_peer {
52   sg_mailbox_t prev;
53   sg_mailbox_t next;
54   sg_mailbox_t me;
55   unsigned long long received_bytes;
56   unsigned int received_pieces;
57   unsigned int total_pieces;
58   sg_comm_t* pending_recvs;
59   sg_comm_t* pending_sends;
60 } s_peer_t;
61
62 typedef s_peer_t* peer_t;
63 void peer(int argc, char* argv[]);
64
65 #endif /* CHAINSEND_H */