aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_pr.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-02-08 00:10:36 +0000
committerChristian Grothoff <christian@grothoff.org>2011-02-08 00:10:36 +0000
commit1a11ec73bfe097463b60b41ceed503e3d2924a44 (patch)
tree7bf27c684adefa0af13fae69ad1c547bc568085b /src/fs/gnunet-service-fs_pr.c
parent86d7f49fc64f0c766d4bec6b3f34879f108fc8a9 (diff)
downloadgnunet-1a11ec73bfe097463b60b41ceed503e3d2924a44.tar.gz
gnunet-1a11ec73bfe097463b60b41ceed503e3d2924a44.zip
stuff
Diffstat (limited to 'src/fs/gnunet-service-fs_pr.c')
-rw-r--r--src/fs/gnunet-service-fs_pr.c195
1 files changed, 195 insertions, 0 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
new file mode 100644
index 000000000..343ec3ada
--- /dev/null
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -0,0 +1,195 @@
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 fs/gnunet-service-fs_pr.c
23 * @brief API to handle pending requests
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet-service-fs_pr.h"
28
29
30/**
31 * Create a new pending request.
32 *
33 * @param options request options
34 * @param type type of the block that is being requested
35 * @param query key for the lookup
36 * @param namespace namespace to lookup, NULL for no namespace
37 * @param target preferred target for the request, NULL for none
38 * @param bf bloom filter for known replies, can be NULL
39 * @param mingle mingle value for bf
40 * @param anonymity_level desired anonymity level
41 * @param priority maximum outgoing cummulative request priority to use
42 * @param replies_seen hash codes of known local replies
43 * @param replies_seen_count size of the 'replies_seen' array
44 * @param rh handle to call when we get a reply
45 * @param rh_cls closure for rh
46 * @return handle for the new pending request
47 */
48struct GSF_PendingRequest *
49GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
50 enum GNUNET_BLOCK_Type type,
51 const GNUNET_HashCode *query,
52 const GNUNET_HashCode *namespace,
53 const struct GNUNET_PeerIdentity *target,
54 struct GNUNET_CONTAINER_BloomFilter *bf,
55 int32_t mingle,
56 uint32_t anonymity_level,
57 uint32_t priority,
58 const GNUNET_HashCode *replies_seen,
59 unsigned int replies_seen_count,
60 GSF_PendingRequestReplyHandler rh,
61 void *rh_cls)
62{
63 return NULL; // FIXME
64}
65
66
67/**
68 * Update a given pending request with additional replies
69 * that have been seen.
70 *
71 * @param pr request to update
72 * @param replies_seen hash codes of replies that we've seen
73 * @param replies_seen_count size of the replies_seen array
74 */
75void
76GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
77 const GNUNET_HashCode *replies_seen,
78 unsigned int replies_seen_count)
79{
80 // FIXME
81}
82
83
84
85/**
86 * Get the query for a given pending request.
87 *
88 * @param pr the request
89 * @return pointer to the query (only valid as long as pr is valid)
90 */
91const GNUNET_HashCode *
92GSF_pending_request_get_query_ (const struct GSF_PendingRequest *pr)
93{
94 return NULL; // FIXME
95}
96
97
98/**
99 * Get the type of a given pending request.
100 *
101 * @param pr the request
102 * @return query type
103 */
104enum GNUNET_BLOCK_Type
105GSF_pending_request_get_type_ (const struct GSF_PendingRequest *pr)
106{
107 return 0; // FIXME
108}
109
110
111/**
112 * Generate the message corresponding to the given pending request for
113 * transmission to other peers (or at least determine its size).
114 *
115 * @param pr request to generate the message for
116 * @param buf_size number of bytes available in buf
117 * @param buf where to copy the message (can be NULL)
118 * @return number of bytes needed (if > buf_size) or used
119 */
120size_t
121GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
122 size_t buf_size,
123 void *buf)
124{
125 return 0; // FIXME
126}
127
128
129/**
130 * Explicitly cancel a pending request.
131 *
132 * @param pr request to cancel
133 */
134void
135GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr)
136{
137}
138
139
140/**
141 * Iterate over all pending requests.
142 *
143 * @param it function to call for each request
144 * @param cls closure for it
145 */
146void
147GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it,
148 void *cls)
149{
150 // FIXME
151}
152
153
154/**
155 * Handle P2P "CONTENT" message. Checks that the message is
156 * well-formed and then checks if there are any pending requests for
157 * this content and possibly passes it on (to local clients or other
158 * peers). Does NOT perform migration (content caching at this peer).
159 *
160 * @param other the other peer involved (sender or receiver, NULL
161 * for loopback messages where we are both sender and receiver)
162 * @param message the actual message
163 * @return how valueable was the content to us (0 for not at all),
164 * GNUNET_SYSERR if the message was malformed (close connection,
165 * do not cache under any circumstances)
166 */
167int
168GSF_handle_p2p_content_ (const struct GNUNET_PeerIdentity *other,
169 const struct GNUNET_MessageHeader *message)
170{
171 return GNUNET_SYSERR; // FIXME
172}
173
174
175/**
176 * Setup the subsystem.
177 */
178void
179GSF_pending_request_init_ ()
180{
181 // FIXME
182}
183
184
185/**
186 * Shutdown the subsystem.
187 */
188void
189GSF_pending_request_done_ ()
190{
191 // FIXME
192}
193
194
195/* end of gnunet-service-fs_pr.c */