Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / examples / c / dht-kademlia / message.h
1 /* Copyright (c) 2012-2021. 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 _DHT_KADEMLIA_MESSAGE
8 #define _DHT_KADEMLIA_MESSAGE
9 #include "answer.h"
10 #include "common.h"
11 #include "simgrid/mailbox.h"
12 #include "xbt/sysdep.h"
13
14 typedef struct s_kademlia_message {
15   unsigned int sender_id;       // Id of the guy who sent the task
16   unsigned int destination_id;  // Id we are trying to find, if needed.
17   answer_t answer;              // Answer to the request made, if needed.
18   sg_mailbox_t answer_to;       // mailbox to send the answer to (if not an answer).
19   const char* issuer_host_name; // used for logging
20 } s_kademlia_message_t;
21
22 typedef s_kademlia_message_t* kademlia_message_t;
23 typedef const s_kademlia_message_t* const_kademlia_message_t;
24
25 // Task handling functions
26 kademlia_message_t task_new_find_node(unsigned int sender_id, unsigned int destination_id, sg_mailbox_t mailbox,
27                                       const char* hostname);
28 kademlia_message_t new_message(unsigned int sender_id, unsigned int destination_id, answer_t answer,
29                                sg_mailbox_t mailbox, const char* hostname);
30 void free_message(void* message);
31 #endif /* _DHT_KADEMLIA_MESSAGE */