1 /* Copyright (c) 2012. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef BITTORRENT_BITTORRENT_H_
8 #define BITTORRENT_BITTORRENT_H_
9 //TODO: Let users change this
11 * File transfered data
13 static int FILE_SIZE = 5120;
14 static int FILE_PIECE_SIZE = 512;
15 static int FILE_PIECES = 10;
17 static int PIECES_BLOCKS = 5;
18 static int BLOCKS_REQUESTED = 2;
20 static int PIECE_COMM_SIZE = 1;
22 * Information message size
24 #define MESSAGE_SIZE 1
27 #define MAILBOX_SIZE 40 /* Size of mailboxes */
29 * Mailbox used to communicate with the tracker.
31 #define TRACKER_MAILBOX "tracker_mailbox"
33 * Max number of pairs sent by the tracker to clients
35 #define MAXIMUM_PAIRS 50
37 * Interval of time where the peer should send a request to the tracker
39 #define TRACKER_QUERY_INTERVAL 1000
41 * Communication size for a task to the tracker
43 #define TRACKER_COMM_SIZE 0.01
45 * Timeout for the get peers data
47 #define GET_PEERS_TIMEOUT 10000
49 * Timeout for "standard" messages.
51 #define TIMEOUT_MESSAGE 10
53 * Timeout for tracker receive.
55 #define TRACKER_RECEIVE_TIMEOUT 10
57 * Number of peers that can be unchocked at a given time
59 #define MAX_UNCHOKED_PEERS 4
62 * Interval between each update of the choked peers
64 #define UPDATE_CHOKED_INTERVAL 30
67 * Number of pieces the peer asks for simultaneously
70 #endif /* BITTORRENT_BITTORRENT_H_ */