indentation
[oweals/gnunet.git] / src / fs / gnunet-service-fs_indexing.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 fs/gnunet-service-fs_indexing.h
23  * @brief indexing for the file-sharing service
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_FS_INDEXING_H
27 #define GNUNET_SERVICE_FS_INDEXING_H
28
29 #include "gnunet_block_lib.h"
30 #include "gnunet_core_service.h"
31 #include "gnunet_datastore_service.h"
32 #include "gnunet_peer_lib.h"
33 #include "gnunet_protocols.h"
34 #include "gnunet_signatures.h"
35 #include "gnunet_util_lib.h"
36
37
38 /**
39  * We've received an on-demand encoded block from the datastore.
40  * Attempt to do on-demand encoding and (if successful), call the
41  * continuation with the resulting block.  On error, clean up and ask
42  * the datastore for more results.
43  *
44  * @param key key for the content
45  * @param size number of bytes in data
46  * @param data content stored
47  * @param type type of the content
48  * @param priority priority of the content
49  * @param anonymity anonymity-level for the content
50  * @param expiration expiration time for the content
51  * @param uid unique identifier for the datum;
52  *        maybe 0 if no unique identifier is available
53  * @param cont function to call with the actual block (at most once, on success)
54  * @param cont_cls closure for cont
55  * @return GNUNET_OK on success
56  */
57 int GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
58                                       uint32_t size, const void *data,
59                                       enum GNUNET_BLOCK_Type type,
60                                       uint32_t priority, uint32_t anonymity,
61                                       struct GNUNET_TIME_Absolute expiration,
62                                       uint64_t uid,
63                                       GNUNET_DATASTORE_DatumProcessor cont,
64                                       void *cont_cls);
65
66 /**
67  * Handle INDEX_START-message.
68  *
69  * @param cls closure
70  * @param client identification of the client
71  * @param message the actual message
72  */
73 void GNUNET_FS_handle_index_start (void *cls,
74                                    struct GNUNET_SERVER_Client *client,
75                                    const struct GNUNET_MessageHeader *message);
76
77
78 /**
79  * Handle INDEX_LIST_GET-message.
80  *
81  * @param cls closure
82  * @param client identification of the client
83  * @param message the actual message
84  */
85 void GNUNET_FS_handle_index_list_get (void *cls,
86                                       struct GNUNET_SERVER_Client *client,
87                                       const struct GNUNET_MessageHeader
88                                       *message);
89
90
91 /**
92  * Handle UNINDEX-message.
93  *
94  * @param cls closure
95  * @param client identification of the client
96  * @param message the actual message
97  */
98 void GNUNET_FS_handle_unindex (void *cls, struct GNUNET_SERVER_Client *client,
99                                const struct GNUNET_MessageHeader *message);
100
101
102 /**
103  * Initialize the indexing submodule.
104  *
105  * @param c configuration to use
106  * @param d datastore to use
107  * @return GNUNET_OK on success
108  */
109 int GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c,
110                              struct GNUNET_DATASTORE_Handle *d);
111
112
113 /**
114  * Shutdown the module.
115  */
116 void GNUNET_FS_indexing_done (void);
117
118
119 #endif