-doxygen
[oweals/gnunet.git] / src / dht / gnunet-service-xdht_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-xdht_clients.h
23  * @brief GNUnet DHT service's client management code
24  * @author Supriti Singh
25  */
26 #ifndef GNUNET_SERVICE_XDHT_CLIENT_H
27 #define GNUNET_SERVICE_XDHT_CLIENT_H
28
29 #include "gnunet_util_lib.h"
30 #include "gnunet_block_lib.h"
31
32 /**
33  * Handle a reply we've received from another peer.  If the reply
34  * matches any of our pending queries, forward it to the respective
35  * client(s).
36  *
37  * @param expiration when will the reply expire
38  * @param key the query this reply is for
39  * @param get_path_length number of peers in 'get_path'
40  * @param get_path path the reply took on get
41  * @param put_path_length number of peers in 'put_path'
42  * @param put_path path the reply took on put
43  * @param type type of the reply
44  * @param data_size number of bytes in 'data'
45  * @param data application payload data
46  */
47 void
48 GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
49                           const struct GNUNET_HashCode * key,
50                           unsigned int get_path_length,
51                           const struct GNUNET_PeerIdentity *get_path,
52                           unsigned int put_path_length,
53                           const struct GNUNET_PeerIdentity *put_path,
54                           enum GNUNET_BLOCK_Type type, size_t data_size,
55                           const void *data);
56
57
58 /**
59  * Check if some client is monitoring GET messages and notify
60  * them in that case.
61  *
62  * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
63  * @param type The type of data in the request.
64  * @param hop_count Hop count so far.
65  * @param path_length number of entries in path (or 0 if not recorded).
66  * @param path peers on the GET path (or NULL if not recorded).
67  * @param desired_replication_level Desired replication level.
68  * @param key Key of the requested data.
69  */
70 void
71 GDS_CLIENTS_process_get (uint32_t options,
72                          enum GNUNET_BLOCK_Type type,
73                          uint32_t hop_count,
74                          uint32_t desired_replication_level,
75                          unsigned int path_length,
76                          const struct GNUNET_PeerIdentity *path,
77                          const struct GNUNET_HashCode * key);
78
79 /**
80  * Check if some client is monitoring GET RESP messages and notify
81  * them in that case.
82  *
83  * @param type The type of data in the result.
84  * @param get_path Peers on GET path (or NULL if not recorded).
85  * @param get_path_length number of entries in get_path.
86  * @param put_path peers on the PUT path (or NULL if not recorded).
87  * @param put_path_length number of entries in get_path.
88  * @param exp Expiration time of the data.
89  * @param key Key of the data.
90  * @param data Pointer to the result data.
91  * @param size Number of bytes in data.
92  */
93 void
94 GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
95                               const struct GNUNET_PeerIdentity *get_path,
96                               unsigned int get_path_length,
97                               const struct GNUNET_PeerIdentity *put_path,
98                               unsigned int put_path_length,
99                               struct GNUNET_TIME_Absolute exp,
100                               const struct GNUNET_HashCode * key,
101                               const void *data,
102                               size_t size);
103
104 /**
105  * Check if some client is monitoring PUT messages and notify
106  * them in that case.
107  *
108  * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
109  * @param type The type of data in the request.
110  * @param hop_count Hop count so far.
111  * @param path_length number of entries in path (or 0 if not recorded).
112  * @param path peers on the PUT path (or NULL if not recorded).
113  * @param desired_replication_level Desired replication level.
114  * @param exp Expiration time of the data.
115  * @param key Key under which data is to be stored.
116  * @param data Pointer to the data carried.
117  * @param size Number of bytes in data.
118  */
119 void
120 GDS_CLIENTS_process_put (uint32_t options,
121                          enum GNUNET_BLOCK_Type type,
122                          uint32_t hop_count,
123                          uint32_t desired_replication_level,
124                          unsigned int path_length,
125                          const struct GNUNET_PeerIdentity *path,
126                          struct GNUNET_TIME_Absolute exp,
127                          const struct GNUNET_HashCode * key,
128                          const void *data,
129                          size_t size);
130
131 /**
132  * 
133  */
134 void 
135 GDS_CLIENTS_process_get_result();
136
137 /**
138  * Initialize client subsystem.
139  *
140  * @param server the initialized server
141  */
142 void
143 GDS_CLIENTS_init (struct GNUNET_SERVER_Handle *server);
144
145
146 /**
147  * Shutdown client subsystem.
148  */
149 void
150 GDS_CLIENTS_done (void);
151
152 #endif