Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill dead code in kademlia examples.
[simgrid.git] / examples / deprecated / msg / dht-kademlia / task.h
1 /* Copyright (c) 2012-2019. 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 _MSG_KADEMLIA_EXAMPLES_TASK
8 #define _MSG_KADEMLIA_EXAMPLES_TASK
9 #include "common.h"
10 #include "node.h"
11 #include "simgrid/msg.h"
12
13 /* Types of tasks exchanged */
14 typedef enum {
15   TASK_FIND_NODE,
16   TASK_FIND_NODE_ANSWER,
17   TASK_FIND_VALUE,
18   TASK_FIND_VALUE_ANSWER,
19   TASK_LEAVING
20 } e_task_type_t;
21
22 /* Data attached with the tasks */
23 typedef struct s_task_data {
24   e_task_type_t type;
25   unsigned int sender_id;       //Id of the guy who sent the task
26   unsigned int destination_id;  //Id we are trying to find, if needed.
27   answer_t answer;              //Answer to the request made, if needed.
28   char *answer_to;              // mailbox to send the answer to (if not an answer).
29   const char *issuer_host_name; // used for logging
30 } s_task_data_t;
31
32 typedef s_task_data_t *task_data_t;
33
34 //Task handling functions
35 msg_task_t task_new_find_node(unsigned int sender_id, unsigned int destination_id, char *mailbox, const char *hostname);
36 msg_task_t task_new_find_node_answer(unsigned int sender_id, unsigned int destination_id, answer_t answer,
37                                      char *mailbox, const char *hostname);
38 void task_free(msg_task_t task);
39 void task_free_v(void *task);
40 #endif                          /* _MSG_KADEMLIA_EXAMPLES_TASK */