-add missing comments, expand error checking
[oweals/gnunet.git] / src / dht / gnunet-service-dht_clients.h
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file dht/gnunet-service-dht_clients.h
23  * @brief GNUnet DHT service's client management code
24  * @author Christian Grothoff
25  * @author Nathan Evans
26  */
27 #ifndef GNUNET_SERVICE_DHT_CLIENT_H
28 #define GNUNET_SERVICE_DHT_CLIENT_H
29
30 #include "gnunet_util_lib.h"
31 #include "gnunet_block_lib.h"
32
33 /**
34  * Handle a reply we've received from another peer.  If the reply
35  * matches any of our pending queries, forward it to the respective
36  * client(s).
37  *
38  * @param expiration when will the reply expire
39  * @param key the query this reply is for
40  * @param get_path_length number of peers in 'get_path'
41  * @param get_path path the reply took on get
42  * @param put_path_length number of peers in 'put_path'
43  * @param put_path path the reply took on put
44  * @param type type of the reply
45  * @param data_size number of bytes in 'data'
46  * @param data application payload data
47  */
48 void
49 GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
50                           const GNUNET_HashCode * key,
51                           unsigned int get_path_length,
52                           const struct GNUNET_PeerIdentity *get_path,
53                           unsigned int put_path_length,
54                           const struct GNUNET_PeerIdentity *put_path,
55                           enum GNUNET_BLOCK_Type type, size_t data_size,
56                           const void *data);
57
58
59 /**
60  * Check if some client is monitoring messages of this type and notify
61  * him in that case.
62  *
63  * @param mtype Type of the DHT message.
64  * @param exp When will this value expire.
65  * @param key Key of the result/request.
66  * @param get_path Peers on reply path (or NULL if not recorded).
67  * @param get_path_length number of entries in get_path.
68  * @param put_path peers on the PUT path (or NULL if not recorded).
69  * @param put_path_length number of entries in get_path.
70  * @param desired_replication_level Desired replication level.
71  * @param type Type of the result/request.
72  * @param data Pointer to the result data.
73  * @param size Number of bytes in data.
74  */
75 void
76 GDS_CLIENTS_process_monitor (uint16_t mtype,
77                              const struct GNUNET_TIME_Absolute exp,
78                              const GNUNET_HashCode *key,
79                              uint32_t putl,
80                              const struct GNUNET_PeerIdentity *put_path,
81                              uint32_t getl,
82                              const struct GNUNET_PeerIdentity *get_path,
83                              uint32_t replevel,
84                              enum GNUNET_BLOCK_Type type,
85                              const struct GNUNET_MessageHeader *data,
86                              uint16_t size);
87
88 /**
89  * Initialize client subsystem.
90  *
91  * @param server the initialized server
92  */
93 void
94 GDS_CLIENTS_init (struct GNUNET_SERVER_Handle *server);
95
96
97 /**
98  * Shutdown client subsystem.
99  */
100 void
101 GDS_CLIENTS_done (void);
102
103 #endif