-fix (C) notices
[oweals/gnunet.git] / src / fs / fs_publish_ublock.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2010, 2012, 2013 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @file fs/fs_publish_ublock.h
23  * @brief publish a UBLOCK in GNUnet
24  * @see https://gnunet.org/encoding and #2564
25  * @author Krista Bennett
26  * @author Christian Grothoff
27  */
28 #ifndef FS_PUBLISH_UBLOCK_H
29 #define FS_PUBLISH_UBLOCK_H
30
31 #include "gnunet_util_lib.h"
32 #include "gnunet_datastore_service.h"
33 #include "gnunet_fs_service.h"
34 #include "gnunet_identity_service.h"
35
36
37 /**
38  * Decrypt the given UBlock, storing the result in output.
39  *
40  * @param input input data
41  * @param input_len number of bytes in input
42  * @param ns public key under which the UBlock was stored
43  * @param label label under which the UBlock was stored
44  * @param output where to write the result, has input_len bytes
45  */
46 void
47 GNUNET_FS_ublock_decrypt_ (const void *input,
48                            size_t input_len,
49                            const struct GNUNET_CRYPTO_EcdsaPublicKey *ns,
50                            const char *label,
51                            void *output);
52
53
54 /**
55  * Context for 'ublock_put_cont'.
56  */
57 struct GNUNET_FS_PublishUblockContext;
58
59
60 /**
61  * Signature of a function called as the continuation of a UBlock
62  * publication.
63  *
64  * @param cls closure
65  * @param emsg error message, NULL on success
66  */
67 typedef void (*GNUNET_FS_UBlockContinuation) (void *cls,
68                                               const char *emsg);
69
70
71 /**
72  * Publish a UBlock.
73  *
74  * @param h handle to the file sharing subsystem
75  * @param dsh datastore handle to use for storage operation
76  * @param label identifier to use
77  * @param ulabel update label to use, may be an empty string for none
78  * @param ns namespace to publish in
79  * @param meta metadata to use
80  * @param uri URI to refer to in the UBlock
81  * @param bo per-block options
82  * @param options publication options
83  * @param cont continuation
84  * @param cont_cls closure for cont
85  * @return NULL on error ('cont' will still be called)
86  */
87 struct GNUNET_FS_PublishUblockContext *
88 GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
89                            struct GNUNET_DATASTORE_Handle *dsh,
90                            const char *label,
91                            const char *ulabel,
92                            const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns,
93                            const struct GNUNET_CONTAINER_MetaData *meta,
94                            const struct GNUNET_FS_Uri *uri,
95                            const struct GNUNET_FS_BlockOptions *bo,
96                            enum GNUNET_FS_PublishOptions options,
97                            GNUNET_FS_UBlockContinuation cont, void *cont_cls);
98
99
100 /**
101  * Abort UBlock publishing operation.
102  *
103  * @param uc operation to abort.
104  */
105 void
106 GNUNET_FS_publish_ublock_cancel_ (struct GNUNET_FS_PublishUblockContext *uc);
107
108 #endif