Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
71306b1b820ad0efbdd38ed223be6d3a7c92359b
[simgrid.git] / examples / msg / 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 KADEPLOY_PEER_H
8 #define KADEPLOY_PEER_H
9
10 #include "simgrid/msg.h"
11 #include "xbt/sysdep.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, *peer_t;
30
31 /* Peer: helper functions */
32 msg_error_t peer_wait_for_message(peer_t peer);
33 int peer_execute_task(peer_t peer, msg_task_t task);
34 void peer_init_chain(peer_t peer, message_t msg);
35 void peer_delete(peer_t p);
36 void peer_shutdown(peer_t p);
37 void peer_init(peer_t p, int argc, char *argv[]);
38 void peer_print_stats(peer_t p, float elapsed_time);
39
40 int peer(int argc, char *argv[]);
41
42 #endif /* KADEPLOY_PEER_H */