Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Disable the chord tests for now since it's still borken
[simgrid.git] / examples / gras / p2p / chord / chord.c
index b74944e..3042c2f 100644 (file)
@@ -2,13 +2,69 @@
  * vim:ts=2:sw=2:noexpandtab
  */
 
-#include "chord.h"
+#include "xbt/sysdep.h"
+#include "gras.h"
 
 static int closest_preceding_node(int id);
 static void check_predecessor(void);
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(chord,"Messages specific to this example");
 
+typedef enum msg_typus{
+       PING,
+       PONG,
+       GET_PRE,
+       REP_PRE,
+       GET_SUC,
+       REP_SUC,
+       STD,
+}msg_typus;
+
+/*GRAS_DEFINE_TYPE(s_pbio,
+       struct s_pbio{
+               msg_typus type;
+               int dest;
+               char msg[1024];
+       };
+);
+typedef struct s_pbio pbio_t;*/
+
+//GRAS_DEFINE_TYPE(s_ping,
+       struct s_ping{
+               int id;
+       };
+//);
+typedef struct s_ping ping_t;
+
+//GRAS_DEFINE_TYPE(s_pong,
+       struct s_pong{
+               int id;
+               int failed;
+       };
+//);
+typedef struct s_pong pong_t;
+
+GRAS_DEFINE_TYPE(s_get_suc,
+       struct s_get_suc{
+               int id;
+       };
+);
+typedef struct s_get_suc get_suc_t;
+
+GRAS_DEFINE_TYPE(s_rep_suc,
+       struct s_rep_suc{
+               int id;
+               char host[1024];
+               int port;
+       };
+);
+typedef struct s_rep_suc rep_suc_t;
+
+typedef struct finger_elem{
+       int id;
+       char host[1024];
+       int port;
+}finger_elem;
 
 
 
@@ -149,6 +205,9 @@ int node(int argc,char **argv){
 
        /* 1. Init the GRAS infrastructure and declare my globals */
        gras_init(&argc,argv);
+   
+   gras_os_sleep((15-gras_os_getpid())*20);
+   
        globals=gras_userdata_new(node_data_t);
 
        globals->id=atoi(argv[1]);