Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
5099d1b84bdb006e1a102d67f6672be70cee3fc4
[simgrid.git] / examples / msg / app-chainsend / peer.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 PEER_H
8 #define PEER_H
9
10 #include "simgrid/msg.h"
11 #include "xbt/dynar.h"
12
13 #include "messages.h"
14 #include "common.h"
15
16 #define PEER_SHUTDOWN_DEADLINE 60000
17
18 /* Peer struct */
19 typedef struct s_peer {
20   int init;
21   char *prev;
22   char *next;
23   char *me;
24   int pieces;
25   unsigned long long bytes;
26   xbt_dynar_t pending_recvs;
27   xbt_dynar_t pending_sends;
28   unsigned int total_pieces;
29 } s_peer_t;
30 typedef s_peer_t *peer_t;
31
32 /* Peer: helper functions */
33 msg_error_t peer_wait_for_message(peer_t peer);
34 int peer_execute_task(peer_t peer, msg_task_t task);
35 void peer_init_chain(peer_t peer, message_t msg);
36 void peer_delete(peer_t p);
37 void peer_shutdown(peer_t p);
38 void peer_init(peer_t p, int argc, char *argv[]);
39 void peer_print_stats(peer_t p, float elapsed_time);
40
41 int peer(int argc, char *argv[]);
42
43 #endif /* PEER_H */