aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-wdht_clients.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-service-wdht_clients.h')
-rw-r--r--src/dht/gnunet-service-wdht_clients.h149
1 files changed, 149 insertions, 0 deletions
diff --git a/src/dht/gnunet-service-wdht_clients.h b/src/dht/gnunet-service-wdht_clients.h
new file mode 100644
index 000000000..f1781332c
--- /dev/null
+++ b/src/dht/gnunet-service-wdht_clients.h
@@ -0,0 +1,149 @@
1/*
2 This file is part of GNUnet.
3 Copyright (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 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 @a get_path
41 * @param get_path path the reply took on get
42 * @param put_path_length number of peers in @a 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 @a data
46 * @param data application payload data
47 */
48void
49GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
50 const struct 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 GET messages and notify
61 * them in that case.
62 *
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.
70 */
71void
72GDS_CLIENTS_process_get (uint32_t options,
73 enum GNUNET_BLOCK_Type type,
74 uint32_t hop_count,
75 uint32_t desired_replication_level,
76 unsigned int path_length,
77 const struct GNUNET_PeerIdentity *path,
78 const struct GNUNET_HashCode *key);
79
80
81/**
82 * Check if some client is monitoring GET RESP messages and notify
83 * them in that case.
84 *
85 * @param type The type of data in the result.
86 * @param get_path Peers on GET path (or NULL if not recorded).
87 * @param get_path_length number of entries in @a get_path.
88 * @param put_path peers on the PUT path (or NULL if not recorded).
89 * @param put_path_length number of entries in @a get_path.
90 * @param exp Expiration time of the data.
91 * @param key Key of the @a data.
92 * @param data Pointer to the result data.
93 * @param size Number of bytes in @a data.
94 */
95void
96GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
97 const struct GNUNET_PeerIdentity *get_path,
98 unsigned int get_path_length,
99 const struct GNUNET_PeerIdentity *put_path,
100 unsigned int put_path_length,
101 struct GNUNET_TIME_Absolute exp,
102 const struct GNUNET_HashCode * key,
103 const void *data,
104 size_t size);
105
106
107/**
108 * Check if some client is monitoring PUT messages and notify
109 * them in that case.
110 *
111 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
112 * @param type The type of data in the request.
113 * @param hop_count Hop count so far.
114 * @param path_length number of entries in path (or 0 if not recorded).
115 * @param path peers on the PUT path (or NULL if not recorded).
116 * @param desired_replication_level Desired replication level.
117 * @param exp Expiration time of the data.
118 * @param key Key under which data is to be stored.
119 * @param data Pointer to the data carried.
120 * @param size Number of bytes in data.
121 */
122void
123GDS_CLIENTS_process_put (uint32_t options,
124 enum GNUNET_BLOCK_Type type,
125 uint32_t hop_count,
126 uint32_t desired_replication_level,
127 unsigned int path_length,
128 const struct GNUNET_PeerIdentity *path,
129 struct GNUNET_TIME_Absolute exp,
130 const struct GNUNET_HashCode * key,
131 const void *data,
132 size_t size);
133
134/**
135 * Initialize client subsystem.
136 *
137 * @param server the initialized server
138 */
139void
140GDS_CLIENTS_init (struct GNUNET_SERVER_Handle *server);
141
142
143/**
144 * Shutdown client subsystem.
145 */
146void
147GDS_CLIENTS_done (void);
148
149#endif