2 This file is part of GNUnet.
3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
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.
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.
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.
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
27 #ifndef GNUNET_SERVICE_DHT_CLIENT_H
28 #define GNUNET_SERVICE_DHT_CLIENT_H
30 #include "gnunet_util_lib.h"
31 #include "gnunet_block_lib.h"
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
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
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,
60 * Check if some client is monitoring GET messages and notify
63 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
64 * @param type The type of data in the request.
65 * @param hop_count Hop count so far.
66 * @param path_length number of entries in path (or 0 if not recorded).
67 * @param path peers on the GET path (or NULL if not recorded).
68 * @param desired_replication_level Desired replication level.
69 * @param key Key of the requested data.
72 GDS_CLIENTS_process_get (uint32_t options,
73 enum GNUNET_BLOCK_Type type,
75 uint32_t desired_replication_level,
76 unsigned int path_length,
77 const struct GNUNET_PeerIdentity *path,
78 const GNUNET_HashCode * key);
81 * Check if some client is monitoring GET RESP messages and notify
84 * @param type The type of data in the result.
85 * @param get_path Peers on GET path (or NULL if not recorded).
86 * @param get_path_length number of entries in get_path.
87 * @param put_path peers on the PUT path (or NULL if not recorded).
88 * @param put_path_length number of entries in get_path.
89 * @param exp Expiration time of the data.
90 * @param key Key of the data.
91 * @param data Pointer to the result data.
92 * @param size Number of bytes in data.
95 GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
96 const struct GNUNET_PeerIdentity *get_path,
97 unsigned int get_path_length,
98 const struct GNUNET_PeerIdentity *put_path,
99 unsigned int put_path_length,
100 struct GNUNET_TIME_Absolute exp,
101 const GNUNET_HashCode * key,
106 * Check if some client is monitoring PUT messages and notify
109 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
110 * @param type The type of data in the request.
111 * @param hop_count Hop count so far.
112 * @param path_length number of entries in path (or 0 if not recorded).
113 * @param path peers on the PUT path (or NULL if not recorded).
114 * @param desired_replication_level Desired replication level.
115 * @param exp Expiration time of the data.
116 * @param key Key under which data is to be stored.
117 * @param data Pointer to the data carried.
118 * @param size Number of bytes in data.
121 GDS_CLIENTS_process_put (uint32_t options,
122 enum GNUNET_BLOCK_Type type,
124 uint32_t desired_replication_level,
125 unsigned int path_length,
126 const struct GNUNET_PeerIdentity *path,
127 struct GNUNET_TIME_Absolute exp,
128 const GNUNET_HashCode * key,
133 * Initialize client subsystem.
135 * @param server the initialized server
138 GDS_CLIENTS_init (struct GNUNET_SERVER_Handle *server);
142 * Shutdown client subsystem.
145 GDS_CLIENTS_done (void);