Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add more tests in msg-suspend.
[simgrid.git] / examples / msg / bittorrent / messages.h
index 2a87b7c..dab23af 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012. The SimGrid Team.
+/* Copyright (c) 2012-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -10,6 +10,8 @@
 
 /**
  * Message sizes
 
 /**
  * Message sizes
+ * Sizes based on report by A. Legout et al, Understanding BitTorrent: An Experimental Perspective
+ * http://hal.inria.fr/inria-00000156/en
  */
 #define MESSAGE_HANDSHAKE_SIZE 68
 #define MESSAGE_CHOKE_SIZE 5
  */
 #define MESSAGE_HANDSHAKE_SIZE 68
 #define MESSAGE_CHOKE_SIZE 5
@@ -34,7 +36,8 @@ typedef enum {
   MESSAGE_HAVE,
   MESSAGE_BITFIELD,
   MESSAGE_REQUEST,
   MESSAGE_HAVE,
   MESSAGE_BITFIELD,
   MESSAGE_REQUEST,
-  MESSAGE_PIECE
+  MESSAGE_PIECE,
+  MESSAGE_CANCEL
 } e_message_type;
 
 /**
 } e_message_type;
 
 /**
@@ -49,22 +52,20 @@ typedef struct s_message {
   int index;
   int block_index;
   int block_length;
   int index;
   int block_index;
   int block_length;
-  int stalled:1;
 } s_message_t, *message_t;
 /**
  * Builds a new value-less message
  */
 msg_task_t task_message_new(e_message_type type,
 } s_message_t, *message_t;
 /**
  * Builds a new value-less message
  */
 msg_task_t task_message_new(e_message_type type,
-                                       const char *issuer_host_name,
-                                       const char *mailbox, int peer_id, 
-                                       int size);
+                            const char *issuer_host_name,
+                            const char *mailbox, int peer_id, int size);
 /**
  * Builds a new "have/piece" message
  */
 msg_task_t task_message_index_new(e_message_type type,
 /**
  * Builds a new "have/piece" message
  */
 msg_task_t task_message_index_new(e_message_type type,
-                                             const char *issuer_host_name,
-                                             const char *mailbox, int peer_id,
-                                             int index, int varsize);
+                                  const char *issuer_host_name,
+                                  const char *mailbox, int peer_id,
+                                  int index, int varsize);
 /**
  * Builds a new bitfield message
  */
 /**
  * Builds a new bitfield message
  */
@@ -75,15 +76,16 @@ msg_task_t task_message_bitfield_new(const char *issuer_host_name,
  * Builds a new "request" message
  */
 msg_task_t task_message_request_new(const char *issuer_host_name,
  * Builds a new "request" message
  */
 msg_task_t task_message_request_new(const char *issuer_host_name,
-                                    const char *mailbox, int peer_id, int index,
-                                    int block_index, int block_length);
+                                    const char *mailbox, int peer_id,
+                                    int index, int block_index,
+                                    int block_length);
 
 /**
  * Build a new "piece" message
  */
 msg_task_t task_message_piece_new(const char *issuer_host_name,
                                   const char *mailbox, int peer_id, int index,
 
 /**
  * Build a new "piece" message
  */
 msg_task_t task_message_piece_new(const char *issuer_host_name,
                                   const char *mailbox, int peer_id, int index,
-                                  int stalled, int block_index,
+                                  int block_index,
                                   int block_length, int block_size);
 /**
  * Free a message task
                                   int block_length, int block_size);
 /**
  * Free a message task