Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reindent.
[simgrid.git] / examples / msg / bittorrent / bittorrent.h
1 /* Copyright (c) 2012. 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 BITTORRENT_BITTORRENT_H_
8 #define BITTORRENT_BITTORRENT_H_
9 //TODO: Let users change this
10 /*
11  * File transfered data
12  */
13 static int FILE_SIZE = 5120;
14 static int FILE_PIECE_SIZE = 512;
15 static int FILE_PIECES = 10;
16
17 static int PIECES_BLOCKS = 5;
18 static int BLOCKS_REQUESTED = 2;
19
20 static int PIECE_COMM_SIZE = 1;
21 /**
22  * Information message size
23  */
24 #define MESSAGE_SIZE 1
25
26
27 #define MAILBOX_SIZE 40         /* Size of mailboxes */
28 /**
29  * Mailbox used to communicate with the tracker.
30  */
31 #define TRACKER_MAILBOX "tracker_mailbox"
32 /**
33  * Max number of pairs sent by the tracker to clients
34  */
35 #define MAXIMUM_PAIRS 50
36 /**
37  * Interval of time where the peer should send a request to the tracker
38  */
39 #define TRACKER_QUERY_INTERVAL 1000
40 /**
41  * Communication size for a task to the tracker
42  */
43 #define TRACKER_COMM_SIZE 0.01
44 /**
45  * Timeout for the get peers data
46  */
47 #define GET_PEERS_TIMEOUT 10000
48 /**
49  * Timeout for "standard" messages.
50  */
51 #define TIMEOUT_MESSAGE 10
52 /**
53  * Timeout for tracker receive.
54  */
55 #define TRACKER_RECEIVE_TIMEOUT 10
56 /**
57  * Number of peers that can be unchocked at a given time
58  */
59 #define MAX_UNCHOKED_PEERS 4
60
61 /**
62  * Interval between each update of the choked peers
63  */
64 #define UPDATE_CHOKED_INTERVAL 30
65
66 /**
67  * Number of pieces the peer asks for simultaneously
68  */
69 #define MAX_PIECES 1
70 #endif                          /* BITTORRENT_BITTORRENT_H_ */