X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/aed6c0fceb5d7963006a105350770507030878ba..a1c2fd1f61bd5733f3ddb126713ec5da13f1e440:/examples/msg/app-bittorrent/connection.h diff --git a/examples/msg/app-bittorrent/connection.h b/examples/msg/app-bittorrent/connection.h index 057e3d8cbe..cd3362014f 100644 --- a/examples/msg/app-bittorrent/connection.h +++ b/examples/msg/app-bittorrent/connection.h @@ -10,17 +10,19 @@ /** Contains the connection data of a peer. */ typedef struct s_connection { int id; //Peer id - char *bitfield; //Fields + unsigned int bitfield; //Fields char *mailbox; int messages_count; double peer_speed; double last_unchoke; int current_piece; - int am_interested:1; //Indicates if we are interested in something the peer has - int interested:1; //Indicates if the peer is interested in one of our pieces - int choked_upload:1; //Indicates if the peer is choked for the current peer - int choked_download:1; //Indicates if the peer has choked the current peer -} s_connection_t, *connection_t; + unsigned int am_interested:1; //Indicates if we are interested in something the peer has + unsigned int interested:1; //Indicates if the peer is interested in one of our pieces + unsigned int choked_upload:1; //Indicates if the peer is choked for the current peer + unsigned int choked_download:1; //Indicates if the peer has choked the current peer +} s_connection_t; + +typedef s_connection_t *connection_t; /** @brief Build a new connection object from the peer id. * @param id id of the peer @@ -33,4 +35,5 @@ connection_t connection_new(int id); void connection_add_speed_value(connection_t connection, double speed); /** Frees a connection object */ void connection_free(void *data); +int connection_has_piece(connection_t connection, unsigned int piece); #endif /* BITTORRENT_CONNECTION_H_ */